Browse Source

better cif-core data naming

Alexander Rose 5 years ago
parent
commit
c6efa475a5

+ 4 - 0
data/cif-field-names/cif-core-field-names.csv

@@ -1,8 +1,12 @@
 audit.block_doi
 
 database_code.depnum_ccdc_archive
+database_code.depnum_ccdc_fiz
+database_code.ICSD
+database_code.MDF
 database_code.NBS
 database_code.CSD
+database_code.COD
 
 chemical.name_systematic
 chemical.name_common

+ 18 - 0
src/mol-io/reader/cif/schema/cif-core.ts

@@ -365,6 +365,10 @@ export const CifCore_Schema = {
      * originate from that source.
      */
     database_code: {
+        /**
+         * Code assigned by Crystallography Open Database (COD).
+         */
+        COD: str,
         /**
          * Code assigned by the Cambridge Structural Database.
          */
@@ -375,6 +379,20 @@ export const CifCore_Schema = {
          * archived by the CCDC.
          */
         depnum_ccdc_archive: str,
+        /**
+         * Deposition numbers assigned by the Fachinformationszentrum
+         * Karlsruhe (FIZ) to files containing structural information
+         * archived by the Cambridge Crystallographic Data Centre (CCDC).
+         */
+        depnum_ccdc_fiz: str,
+        /**
+         * Code assigned by the Inorganic Crystal Structure Database.
+         */
+        ICSD: str,
+        /**
+         * Code assigned in the Metals Data File.
+         */
+        MDF: str,
         /**
          * Code assigned by the NBS (NIST) Crystal Data Database.
          */

+ 18 - 2
src/mol-model-formats/structure/cif-core.ts

@@ -87,7 +87,11 @@ async function getModels(db: CifCore_Database, format: CifCoreFormat, ctx: Runti
         pdbx_PDB_model_num: Column.ofConst(1, atomCount, Column.Schema.int),
     }, atomCount);
 
-    const name = db.chemical.name_common.value(0) || db.chemical.name_systematic.value(0)
+    const name = (
+        db.chemical.name_common.value(0) ||
+        db.chemical.name_systematic.value(0) ||
+        db.chemical_formula.sum.value(0)
+    )
 
     const entityBuilder = new EntityBuilder()
     entityBuilder.setNames([['MOL', name || 'Unknown Entity']])
@@ -175,7 +179,19 @@ namespace CifCoreFormat {
 
     export function fromFrame(frame: CifFrame, db?: CifCore_Database): CifCoreFormat {
         if (!db) db = CIF.schema.cifCore(frame)
-        return { kind: 'cifCore', name: db._name, data: { db, frame } };
+
+        const name = (
+            db.database_code.depnum_ccdc_archive.value(0) ||
+            db.database_code.depnum_ccdc_fiz.value(0) ||
+            db.database_code.ICSD.value(0) ||
+            db.database_code.MDF.value(0) ||
+            db.database_code.NBS.value(0) ||
+            db.database_code.CSD.value(0) ||
+            db.database_code.COD.value(0) ||
+            db._name
+        )
+
+        return { kind: 'cifCore', name, data: { db, frame } };
     }
 }