From 06927aaabad8b41cc3bbfc28e2a998ae8538a9ec Mon Sep 17 00:00:00 2001 From: Alexander Rose <alex.rose@rcsb.org> Date: Fri, 3 May 2019 17:04:47 -0700 Subject: [PATCH] ihm parsing tweaks --- src/mol-model-formats/structure/mmcif/parser.ts | 7 +++---- src/mol-plugin/state/transforms/helpers.ts | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mol-model-formats/structure/mmcif/parser.ts b/src/mol-model-formats/structure/mmcif/parser.ts index 4c4067686..4c92a0b9e 100644 --- a/src/mol-model-formats/structure/mmcif/parser.ts +++ b/src/mol-model-formats/structure/mmcif/parser.ts @@ -324,14 +324,13 @@ function splitTable<T extends Table<any>>(table: T, col: Column<number>) { } async function readIHM(ctx: RuntimeContext, format: mmCIF_Format, formatData: FormatData) { - if (format.data.atom_site._rowCount && !format.data.atom_site.ihm_model_id.isDefined) { - throw new Error('expected _atom_site.ihm_model_id to be defined') - } + // when `atom_site.ihm_model_id` is undefined fall back to `atom_site.pdbx_PDB_model_num` + const atom_sites_modelColumn = format.data.atom_site.ihm_model_id.isDefined ? format.data.atom_site.ihm_model_id : format.data.atom_site.pdbx_PDB_model_num const { ihm_model_list } = format.data; const entities = getEntities(format) - const atom_sites = splitTable(format.data.atom_site, format.data.atom_site.ihm_model_id); + const atom_sites = splitTable(format.data.atom_site, atom_sites_modelColumn); // TODO: will coarse IHM records require sorting or will we trust it? // ==> Probably implement a sort as as well and store the sourceIndex same as with atomSite // If the sorting is implemented, updated mol-model/structure/properties: atom.sourceIndex diff --git a/src/mol-plugin/state/transforms/helpers.ts b/src/mol-plugin/state/transforms/helpers.ts index 730f140e5..2a72f7a52 100644 --- a/src/mol-plugin/state/transforms/helpers.ts +++ b/src/mol-plugin/state/transforms/helpers.ts @@ -42,7 +42,7 @@ export function getStructureTransparency(structure: Structure, script: Script, v * Attaches ComputedSecondaryStructure property when unavailable in sourceData */ export async function ensureSecondaryStructure(s: Structure) { - if (s.model.sourceData.kind === 'mmCIF') { + if (s.model && s.model.sourceData.kind === 'mmCIF') { if (!s.model.sourceData.data.struct_conf.id.isDefined && !s.model.sourceData.data.struct_sheet_range.id.isDefined) { await ComputedSecondaryStructure.attachFromCifOrCompute(s) } -- GitLab