Browse Source

omit redundant code

JonStargaryen 4 years ago
parent
commit
37fdbfe12a
1 changed files with 3 additions and 18 deletions
  1. 3 18
      src/servers/model/ligand-writer/ligand-encoder.ts

+ 3 - 18
src/servers/model/ligand-writer/ligand-encoder.ts

@@ -4,7 +4,7 @@
  * @author Sebastian Bittrich <sebastian.bittrich@rcsb.org>
  */
 
-import { StringBuilder, deepEqual } from '../../../mol-util';
+import { StringBuilder } from '../../../mol-util';
 import Writer from '../../../mol-io/writer/writer';
 import { Encoder, Category, Field } from '../../../mol-io/writer/cif/encoder';
 import { ComponentBond } from '../../../mol-model-formats/structure/property/bonds/comp';
@@ -89,17 +89,12 @@ export abstract class LigandEncoder implements Encoder<string> {
     protected getAtoms<Ctx>(instance: Category.Instance<Ctx>, source: any): Atom[] {
         const sortedFields = this.getSortedFields(instance, ['Cartn_x', 'Cartn_y', 'Cartn_z', 'type_symbol']);
         const label_atom_id = this.getField(instance, 'label_atom_id');
-
-        // all of this is used to ensure that only 1 residue is written
-        const auxiliaryFields = this.getSortedFields(instance, ['label_seq_id', 'label_asym_id', 'pdbx_PDB_ins_code', 'pdbx_PDB_model_num']);
-
-        return this._getAtoms(source, sortedFields, label_atom_id, auxiliaryFields);
+        return this._getAtoms(source, sortedFields, label_atom_id);
     }
 
-    private _getAtoms(source: any, fields: Field<any, any>[], label_atom_id: Field<any, any>, auxiliaryFields: Field<any, any>[]): Atom[] {
+    private _getAtoms(source: any, fields: Field<any, any>[], label_atom_id: Field<any, any>): Atom[] {
         const atoms: Atom[] = [];
         let index = 0;
-        let id: (string | number)[] | undefined = void 0;
 
         // is outer loop even needed?
         l: for (let _c = 0; _c < source.length; _c++) {
@@ -112,16 +107,6 @@ export abstract class LigandEncoder implements Encoder<string> {
             while (it.hasNext)  {
                 const key = it.move();
 
-                // ensure only a single residue is written
-                // TODO fairly certain this can be done at query level
-                if (!id) {
-                    id = auxiliaryFields.map(af => af.value(key, data, 0));
-                } else {
-                    if (!deepEqual(id, auxiliaryFields.map(af => af.value(key, data, index)))) {
-                        break l;
-                    }
-                }
-
                 const lai = label_atom_id.value(key, data, index) as string;
                 const label = this.getLabel(lai);
                 if (this.skipHydrogen(label)) {