Sfoglia il codice sorgente

Merge pull request #878 from JonStargaryen/ccd-fix

Fix logic for trajectoryFromCCD
Alexander Rose 1 anno fa
parent
commit
9bc0ab12e7
2 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 2 0
      CHANGELOG.md
  2. 2 1
      src/mol-plugin-state/transforms/model.ts

+ 2 - 0
CHANGELOG.md

@@ -6,6 +6,8 @@ Note that since we don't clearly distinguish between a public and private interf
 
 ## [Unreleased]
 
+- Don't rely solely on `chem_comp_atom` when detecting CCD files (#877)
+
 ## [v3.38.1] - 2023-07-22
 
 - Fix pixel-scale not updated in SSAO pass

+ 2 - 1
src/mol-plugin-state/transforms/model.ts

@@ -303,7 +303,8 @@ const TrajectoryFromMmCif = PluginStateTransform.BuiltIn({
                 const header = params.blockHeader || a.data.blocks[0].header;
                 const block = a.data.blocks.find(b => b.header === header);
                 if (!block) throw new Error(`Data block '${[header]}' not found.`);
-                trajectory = block.categoryNames.includes('chem_comp_atom') ? await trajectoryFromCCD(block).runInContext(ctx) : await trajectoryFromMmCIF(block).runInContext(ctx);
+                const isCcd = block.categoryNames.includes('chem_comp_atom') && !block.categoryNames.includes('atom_site') && !block.categoryNames.includes('ihm_sphere_obj_site') && !block.categoryNames.includes('ihm_gaussian_obj_site');
+                trajectory = isCcd ? await trajectoryFromCCD(block).runInContext(ctx) : await trajectoryFromMmCIF(block).runInContext(ctx);
             }
             if (trajectory.frameCount === 0) throw new Error('No models found.');
             const props = trajectoryProps(trajectory);