Ejemplo n.º 1
0
  private static SecStrucGroup[] initGroupArray(Structure s) {
    List<SecStrucGroup> groupList = new ArrayList<SecStrucGroup>();
    // GroupIterator iter = new GroupIterator(s);
    for (Chain c : s.getChains()) {

      for (Group g : c.getAtomGroups()) {
        // System.out.println(g);
        //			 we can also calc secstruc if hetatom is a modified amino acid.
        if (g.hasAminoAtoms()) {

          SecStrucGroup sg = new SecStrucGroup();
          sg.setPDBCode(g.getPDBCode());
          sg.setPDBFlag(true);
          try {
            sg.setPDBName(g.getPDBName());
          } catch (PDBParseException e) {
            e.printStackTrace();
          }
          sg.setParent(g.getChain());

          try {

            sg.setN((Atom) g.getAtomByPDBname(" N  ").clone());
            sg.setCA((Atom) g.getAtomByPDBname(" CA ").clone());
            sg.setC((Atom) g.getAtomByPDBname(" C  ").clone());
            sg.setO((Atom) g.getAtomByPDBname(" O  ").clone());
            sg.setOriginal(g);
            // create H in calc_H

          } catch (StructureException e) {
            e.printStackTrace();
            // one of these atoms is not found!
            continue;
          }

          SecStrucState state = new SecStrucState();
          Map m = sg.getProperties();
          if (m == null) {
            m = new HashMap();
            sg.setProperties(m);
          }

          m.put("secstruc", state);

          groupList.add(sg);
        } else {
          // System.out.println("not an amino group");
        }
      }
    }

    return (SecStrucGroup[]) groupList.toArray(new SecStrucGroup[groupList.size()]);
  }