_extractConfs()

in packages/miew/src/io/parsers/CIFParser.js [417:478]


  _extractConfs(complex, helicesData) {
    const { asymDict } = this;
    if (!helicesData.conf_type_id || !helicesData.beg_label_seq_id || !helicesData.end_label_seq_id
      || !helicesData.beg_label_asym_id) {
      return;
    }

    const types = arrize(helicesData.conf_type_id);
    const starts = arrize(helicesData.beg_auth_seq_id);
    const stICodes = arrize(helicesData.pdbx_beg_PDB_ins_code) || [];
    const ends = arrize(helicesData.end_auth_seq_id);
    const endICodes = arrize(helicesData.pdbx_end_PDB_ins_code) || [];
    const comments = arrize(helicesData.details) || [];
    const lengths = arrize(helicesData.pdbx_PDB_helix_length) || [];
    const helixClasses = arrize(helicesData.pdbx_PDB_helix_class) || [];
    const names = arrize(helicesData.id) || [];
    const chains = arrize(helicesData.beg_label_asym_id);

    for (let i = 0, n = types.length; i < n; ++i) {
      const type = getTypeFromId(types[i]);
      if (!type) {
        continue;
      }
      const name = names[i] || types[i];
      const chain = complex.getChain(asymDict[chains[i]]);

      const startIdx = starts[i];
      const endIdx = ends[i];
      const startICode = stICodes[i] || ' ';
      const endICode = endICodes[i] || ' ';

      const start = chain.findResidue(startIdx, startICode);
      const end = chain.findResidue(endIdx, endICode);

      // TODO think about last condition
      if (!start || !end) {
        continue;
      }
      const comment = comments[i] || '';
      const length = lengths[i] || 0;
      const helixClass = helixClasses[i] || ' ';
      let struct;
      if (type === 'helix') {
        const idx = complex._helices.length;
        struct = new Helix(helixClass, start[0], end[0], idx, name, comment, length);
        complex.addHelix(struct);
        complex.structures.push(struct);
      } else if (type === 'turn') {
        struct = new StructuralElement(StructuralElement.Type.TURN, start[0], end[0]);
        complex.structures.push(struct);
      } else {
        struct = null;
      }
      if (!struct) {
        continue;
      }
      const residues = chain.getResidues();
      for (let r = start[1]; r <= end[1]; ++r) {
        residues[r]._secondary = struct;
      }
    }
  }