Skip to content
Snippets Groups Projects
Commit 06927aaa authored by Alexander Rose's avatar Alexander Rose
Browse files

ihm parsing tweaks

parent 9881fbc3
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment