From 76ee97301b13e7bee77244bb2fe14434dd541e37 Mon Sep 17 00:00:00 2001 From: dsehnal <david.sehnal@gmail.com> Date: Mon, 7 Feb 2022 17:44:03 +0100 Subject: [PATCH] atom_site.pdbx_label_index support --- data/cif-field-names/mmcif-field-names.csv | 1 + src/mol-io/reader/cif/schema/mmcif.ts | 5 +++++ .../structure/export/categories/atom_site.ts | 13 +++++++++++++ .../structure/util/superposition-db-mapping.ts | 1 - 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/data/cif-field-names/mmcif-field-names.csv b/data/cif-field-names/mmcif-field-names.csv index 860ac4780..c5b1751cf 100644 --- a/data/cif-field-names/mmcif-field-names.csv +++ b/data/cif-field-names/mmcif-field-names.csv @@ -24,6 +24,7 @@ atom_site.auth_asym_id atom_site.auth_seq_id atom_site.pdbx_PDB_model_num atom_site.ihm_model_id +atom_site.pdbx_label_index atom_site.pdbx_sifts_xref_db_name atom_site.pdbx_sifts_xref_db_acc atom_site.pdbx_sifts_xref_db_num diff --git a/src/mol-io/reader/cif/schema/mmcif.ts b/src/mol-io/reader/cif/schema/mmcif.ts index 94e387d62..cd21924ad 100644 --- a/src/mol-io/reader/cif/schema/mmcif.ts +++ b/src/mol-io/reader/cif/schema/mmcif.ts @@ -215,6 +215,11 @@ export const mmCIF_Schema = { * formal charge assignment normally found in chemical diagrams. */ pdbx_formal_charge: int, + /** + * This data item is an ordinal which identifies distinct chemical components in the atom_site category, both + * polymeric and non-polymeric. + */ + pdbx_label_index: int, /** * The name of additional external databases with residue level mapping. */ diff --git a/src/mol-model/structure/export/categories/atom_site.ts b/src/mol-model/structure/export/categories/atom_site.ts index 77729c73e..6f082686b 100644 --- a/src/mol-model/structure/export/categories/atom_site.ts +++ b/src/mol-model/structure/export/categories/atom_site.ts @@ -30,6 +30,17 @@ function atom_site_auth_asym_id(e: StructureElement.Location) { return l + suffix; } + +const atom_site_pdbx_label_index = { + shouldInclude(s: AtomSiteData) { + return !!s.atom_site?.pdbx_label_index.isDefined; + }, + value(e: StructureElement.Location, d: AtomSiteData) { + const srcIndex = d.sourceIndex.value(e.element); + return d.atom_site!.pdbx_label_index.value(srcIndex); + }, +}; + const SIFTS = { shouldInclude(s: AtomSiteData) { return SIFTSMapping.isAvailable(s.structure.models[0]); @@ -113,6 +124,8 @@ const atom_site_fields = () => CifWriter.fields<StructureElement.Location, AtomS .int('pdbx_PDB_model_num', P.unit.model_num, { encoder: E.deltaRLE }) + .int('pdbx_label_index', atom_site_pdbx_label_index.value, { shouldInclude: atom_site_pdbx_label_index.shouldInclude }) + // SIFTS .str('pdbx_sifts_xref_db_name', SIFTS.pdbx_sifts_xref_db_name.value, { shouldInclude: SIFTS.shouldInclude, valueKind: SIFTS.pdbx_sifts_xref_db_name.valueKind }) .str('pdbx_sifts_xref_db_acc', SIFTS.pdbx_sifts_xref_db_acc.value, { shouldInclude: SIFTS.shouldInclude, valueKind: SIFTS.pdbx_sifts_xref_db_acc.valueKind }) diff --git a/src/mol-model/structure/structure/util/superposition-db-mapping.ts b/src/mol-model/structure/structure/util/superposition-db-mapping.ts index 725826622..2c220eae6 100644 --- a/src/mol-model/structure/structure/util/superposition-db-mapping.ts +++ b/src/mol-model/structure/structure/util/superposition-db-mapping.ts @@ -5,7 +5,6 @@ */ import { Segmentation } from '../../../../mol-data/int'; -import { Mat4 } from '../../../../mol-math/linear-algebra'; import { MinimizeRmsd } from '../../../../mol-math/linear-algebra/3d/minimize-rmsd'; import { SIFTSMapping } from '../../../../mol-model-props/sequence/sifts-mapping'; import { ElementIndex } from '../../model/indexing'; -- GitLab