_updateSecStructure()

in packages/miew/src/io/parsers/MMTFParser.js [168:215]


  _updateSecStructure(complex, residue, groupData) {
    const helixClasses = [3, -1, 1, -1, 5];

    if (!_.isUndefined(groupData) && groupData.secStruct === this._ssType) {
      residue._secondary = this._ssStruct;
      if (this._ssStruct) {
        this._ssStruct.term = residue;
      }
      return;
    }

    if (!_.isUndefined(groupData)) {
      // start new secondary structure
      const type = secStructToType[groupData.secStruct];
      this._ssType = groupData.secStruct;
      this._ssStart = residue;

      let struct = null;
      switch (this._ssType) {
        case -1: // undefined
        case 7: // coil
          break;
        case 0: // pi helix
        case 2: // alpha helix
        case 4: // 3-10 helix
          struct = new Helix(helixClasses[this._ssType], residue, residue, 0, '', '', 0);
          complex._helices.push(struct);
          break;
        case 3: { // extended
          const sheet = new Sheet('', 0);
          complex._sheets.push(sheet);
          struct = new Strand(sheet, residue, residue, 0, null, null);
          break;
        }
        default:
          if (type !== undefined) {
            struct = new StructuralElement(type, residue, residue);
          }
          break;
      }

      this._ssStruct = struct;
      residue._secondary = struct;
      if (struct) {
        complex.structures.push(struct);
      }
    }
  }