/** * Returns an Atom array of the C-alpha atoms. Any atom that is a carbon and * has CA name will be returned. * * @param c * the structure object * @return an Atom[] array * @see #getRepresentativeAtomArray(Chain) */ public static final Atom[] getAtomCAArray(Chain c) { List<Atom> atoms = new ArrayList<Atom>(); for (Group g : c.getAtomGroups()) { if (g.hasAtom(CA_ATOM_NAME) && g.getAtom(CA_ATOM_NAME).getElement() == Element.C) { atoms.add(g.getAtom(CA_ATOM_NAME)); } } return atoms.toArray(new Atom[atoms.size()]); }
/** * Return an Atom array of the C-alpha atoms. Any atom that is a carbon and * has CA name will be returned. * * @param s * the structure object * @return an Atom[] array * @see #getRepresentativeAtomArray(Structure) */ public static Atom[] getAtomCAArray(Structure s) { List<Atom> atoms = new ArrayList<Atom>(); for (Chain c : s.getChains()) { for (Group g : c.getAtomGroups()) { if (g.hasAtom(CA_ATOM_NAME) && g.getAtom(CA_ATOM_NAME).getElement() == Element.C) { atoms.add(g.getAtom(CA_ATOM_NAME)); } } } return atoms.toArray(new Atom[atoms.size()]); }
/** * Check to see if a Hydrogen has a Deuterated brother in the group. * @param atom the input atom that is putatively hydorgen * @param currentGroup the group the atom is in * @return true if the atom is hydrogen and it's Deuterium equiv exists. */ public static boolean hasDeuteratedEquiv(Atom atom, Group currentGroup) { if(atom.getElement()==Element.H && currentGroup.hasAtom(replaceFirstChar(atom.getName(),'H', 'D'))) { // If it's hydrogen and has a deuterated brother return true; } return false; }
/** * Check to see if an Deuterated atom has a non deuterated brother in the group. * @param atom the input atom that is putatively deuterium * @param currentGroup the group the atom is in * @return true if the atom is deuterated and it's hydrogen equive exists. */ public static boolean hasNonDeuteratedEquiv(Atom atom, Group currentGroup) { if(atom.getElement()==Element.D && currentGroup.hasAtom(replaceFirstChar(atom.getName(),'D', 'H'))) { // If it's deuterated and has a non-deuterated brother return true; } return false; }
@Override public boolean matches(Group group) { if( group == null ) return false; ChemComp chem = group.getChemComp(); if(chem == null) return false; // Get polymer type PolymerType polyType = chem.getPolymerType(); if( polyType == null) { ResidueType type = chem.getResidueType(); if(type != null ) { polyType = type.getPolymerType(); } } if( polyType == null ) { return false; } return PolymerType.PROTEIN_ONLY.contains(polyType) && group.hasAtom(StructureTools.CA_ATOM_NAME); } };
if ( ! currentGroup.hasAtom(atom.getName())) { currentGroup.addAtom(atom);
/** * Cleans up the structure's alternate location (altloc) groups. All alternate location groups should have all atoms (except * in the case of microheterogenity) or when a deuterium exists. * Ensure that all the alt loc groups have all the atoms in the main group. * @param structure The Structure to be cleaned up */ public static void cleanUpAltLocs(Structure structure) { for (int i =0; i< structure.nrModels() ; i++){ for (Chain chain : structure.getModel(i)) { for (Group group : chain.getAtomGroups()) { for (Group altLocGroup : group.getAltLocs()) { for ( Atom groupAtom : group.getAtoms()) { // If this alt loc doesn't have this atom if (! altLocGroup.hasAtom(groupAtom.getName())) { // Fix for microheterogenity if (altLocGroup.getPDBName().equals(group.getPDBName())) { // If it's a Hydrogen then we check for it's Deuterated brother if(!hasDeuteratedEquiv(groupAtom, altLocGroup)){ altLocGroup.addAtom(groupAtom); } } } } } } } } }
if ( ! currentGroup.hasAtom(atomName)) {
if (!group.hasAtom(atom.getName())) {