From 2e67bf6af72daf431225d53781a1a6ca84d2c8e2 Mon Sep 17 00:00:00 2001 From: David Koes Date: Wed, 6 Mar 2024 10:14:37 -0500 Subject: [PATCH] Fix fix. In which an importante life lesson of not pushing commits until after running tests is reinforced along with not letting laziness prevent defensive programming. --- src/parsers/CIF.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/parsers/CIF.ts b/src/parsers/CIF.ts index 597fc9cd..cdf61fbd 100644 --- a/src/parsers/CIF.ts +++ b/src/parsers/CIF.ts @@ -238,16 +238,16 @@ export function CIF(str: string, options: ParserOptionsSpec = {}) { } atom.chain = mmCIF._atom_site_auth_asym_id ? mmCIF._atom_site_auth_asym_id[i] - : mmCIF._atom_site_label_asym_id[i]; + : (mmCIF._atom_site_label_asym_id ? mmCIF._atom_site_label_asym_id[i] : undefined); atom.resi = mmCIF._atom_site_auth_seq_id ? parseInt(mmCIF._atom_site_auth_seq_id[i]) - : mmCIF._atom_site_label_seq_id[i]; + : (mmCIF._atom_site_label_seq_id ? mmCIF._atom_site_label_seq_id[i] : undefined); atom.resn = mmCIF._atom_site_auth_comp_id ? mmCIF._atom_site_auth_comp_id[i].trim() - : mmCIF._atom_site_label_comp_id[i].trim(); + : (mmCIF._atom_site_label_comp_id ? mmCIF._atom_site_label_comp_id[i].trim() : undefined); atom.atom = mmCIF._atom_site_auth_atom_id ? mmCIF._atom_site_auth_atom_id[i].replace(/"/gm, "") - : mmCIF._atom_site_label_atom_id[i].replace(/"/gm, ""); //"primed" names are in quotes + : (mmCIF._atom_site_label_atom_id ? mmCIF._atom_site_label_atom_id[i].replace(/"/gm, "") : undefined); //"primed" names are in quotes atom.hetflag = !mmCIF._atom_site_group_pdb || mmCIF._atom_site_group_pdb[i] === "HETA" ||