public ResidueIdentifier(Group g) { Chain c = g.getChain(); if (c==null) { logger.warn("Chain is not available for group {}. Contact comparison will not work for this residue",g.toString()); this.seqResIndex = -1; } else { EntityInfo comp = c.getEntityInfo(); if (comp==null) { logger.warn("Compound is not available for group {}. Contact comparison will not work for this residue",g.toString()); this.seqResIndex = -1; } else { this.seqResIndex = comp.getAlignedResIndex(g, c); } } }
private Structure getParentStructure() { Atom[] firstMol = this.molecules.getFirst(); if (firstMol.length==0) { logger.warn("No atoms found in first molecule, can't get parent Structure"); return null; } return firstMol[0].getGroup().getChain().getStructure(); }
/** * Finds the parent chains by looking up the references of first atom of each side of this interface * @return */ public Pair<Chain> getParentChains() { Atom[] firstMol = this.molecules.getFirst(); Atom[] secondMol = this.molecules.getSecond(); if (firstMol.length==0 || secondMol.length==0) { logger.warn("No atoms found in first or second molecule, can't get parent Chains"); return null; } return new Pair<Chain>(firstMol[0].getGroup().getChain(), secondMol[0].getGroup().getChain()); }
public static void toPDB(Atom a, StringBuffer str) { toPDB(a,str,a.getGroup().getChain().getName()); }
afpChain.setName2(ca2[0].getGroup().getChain().getStructure().getName()); } catch( Exception e) {}
private static CharSequence getPDBPos(Atom atom) { Group g = atom.getGroup(); if ( g!= null){ Chain c = g.getChain(); if (c != null){ return g.getResidueNumber().toString()+":" + c.getName() ; //return g.getPDBCode()+":" + c.getName() + "." + getOneLetter(g) ; } } return "!"; }
while (gi.hasNext()){ Group g = gi.next(); Chain c = g.getChain();
/** * This method is provisional and should only be used for coloring Subunits. * A new coloring schema has to be implemented to allow the coloring of * Subunits, without implying one Subunit = one Chain. * * @return A List of the Model number of each Subunit */ public List<Integer> getModelNumbers() { List<Integer> models = new ArrayList<Integer>(getSubunitCount()); // Loop through all subunits in the clusters and fill Lists for (int c = 0; c < clusters.size(); c++) { for (int s = 0; s < clusters.get(c).size(); s++) { Atom[] atoms = clusters.get(c).getAlignedAtomsSubunit(s); // TODO guess them chain and model (very ugly) Chain chain = atoms[0].getGroup().getChain(); int model = 0; for (int m = 0; m < chain.getStructure().nrModels(); m++) { if (chain.getStructure().getModel(m).contains(chain)) { model = m; break; } } models.add(model); } } return models; }
private void getPdbRegions(Atom[] ca1, Atom[] ca2){ pdbresnum1 = new String[idx1.length]; pdbresnum2 = new String[idx2.length]; for (int i =0 ; i < idx1.length;i++){ Atom a1 = ca1[idx1[i]]; Atom a2 = ca2[idx2[i]]; Group p1 = a1.getGroup(); Group p2 = a2.getGroup(); Chain c1 = p1.getChain(); Chain c2 = p2.getChain(); String cid1 = c1.getId(); String cid2 = c2.getId(); String pdb1 = p1.getResidueNumber().toString(); String pdb2 = p2.getResidueNumber().toString(); if ( ! cid1.equals(" ")) pdb1 += ":" + cid1; if ( ! cid2.equals(" ")) pdb2 += ":" + cid2; pdbresnum1[i] = pdb1; pdbresnum2[i] = pdb2; } }
/** get the position of PDB residue nr X in the ato marray * * @param pdbresnum pdbresidue number * @param authId chain name * @param atoms atom array * @return */ private static int getPositionForPDBresunm(String pdbresnum, String authId , Atom[] atoms){ ResidueNumber residueNumber = ResidueNumber.fromString(pdbresnum); residueNumber.setChainName(authId); boolean blankChain = authId == null || authId.equalsIgnoreCase("null") || authId.equals("_"); for ( int i =0; i< atoms.length ;i++){ Group g = atoms[i].getGroup(); // match _ to any chain if( blankChain ) { residueNumber.setChainName(g.getChain().getName()); } //System.out.println(g.getResidueNumber() + "< ? >" + residueNumber +"<"); if ( g.getResidueNumber().equals(residueNumber)){ //System.out.println(g + " == " + residueNumber ); Chain c = g.getChain(); if ( blankChain || c.getName().equals(authId)){ return i; } } } return -1; }
/** get an artificial List of chains containing the Atoms and groups. * Does NOT rotate anything. * @param ca * @return a list of Chains that is built up from the Atoms in the ca array * @throws StructureException */ public static final List<Chain> getAlignedModel(Atom[] ca){ List<Chain> model = new ArrayList<Chain>(); for ( Atom a: ca){ Group g = a.getGroup(); Chain parentC = g.getChain(); Chain newChain = null; for ( Chain c : model) { if ( c.getId().equals(parentC.getId())){ newChain = c; break; } } if ( newChain == null){ newChain = new ChainImpl(); newChain.setId(parentC.getId()); model.add(newChain); } newChain.addGroup(g); } return model; }
chain.setName(group.getChain().getName()); chain.setId(group.getChain().getId()); if (currentChain == null || !currentChain.getId().equals(chain.getId())) { structure.addChain(chain); chain.setEntityInfo(group.getChain().getEntityInfo()); chain.setStructure(structure); chain.setSwissprotId(group.getChain().getSwissprotId()); chain.setId(group.getChain().getId()); chain.setName(group.getChain().getName()); currentChain = chain;
private void setAtoms(Structure s, SequenceScalePanel panel){ if ( structurePairAligner == null){ System.err.println("StructurePairAligner has not been set"); return; } Atom[] ca1 = structurePairAligner.getAlignmentAtoms(s); Chain c = new ChainImpl(); c.setChainID("1"); for (Atom atom : ca1) { Group g = atom.getGroup(); Chain parentChain = g.getChain(); c.addGroup(g); // hack for Jmol? g.setChain(parentChain); } panel.setChain(c); }
apos++; Group parentG = a.getGroup(); Chain parentC = parentG.getChain();
Chain parentC = g.getChain();
if (ca1.length!=0 && ca1[0].getGroup().getChain()!=null && ca1[0].getGroup().getChain().getStructure()!=null) afpChain.setName1(ca1[0].getGroup().getChain().getStructure().getName()); if (ca2.length!=0 && ca2[0].getGroup().getChain()!=null && ca2[0].getGroup().getChain().getStructure()!=null) afpChain.setName2(ca2[0].getGroup().getChain().getStructure().getName());
public static void printXMLEQRInferPositions(PrettyXMLWriter xml, AFPChain afpChain, int bk, Atom[] ca1, Atom[] ca2) throws IOException{ int[] optLen = afpChain.getOptLen(); if ( optLen == null) return; int[][][] optAln = afpChain.getOptAln(); for ( int pos=0;pos< optLen[bk];pos++){ int pos1 = optAln[bk][0][pos]; int pos2 = optAln[bk][1][pos]; xml.openTag("eqr"); xml.attribute("eqrNr", String.valueOf(pos)); xml.attribute("pdbres1",ca1[pos1].getGroup().getResidueNumber().toString()); xml.attribute("chain1", ca1[pos1].getGroup().getChain().getName()); xml.attribute("pdbres2",ca2[pos2].getGroup().getResidueNumber().toString()); xml.attribute("chain2", ca2[pos2].getGroup().getChain().getName()); xml.closeTag("eqr"); //System.out.println("aligned position: " + pos1 + ":" + pos2 + //" pdbresnum " + ca1[pos1].getGroup().getResidueNumber().toString() + " " + //ca1[pos1].getParent().getPDBName()+":" + //ca2[pos2].getGroup().getResidueNumber().toString() + " " + ca2[pos2].getParent().getPDBName()); } }
Structure s = atoms[0].getGroup().getChain().getStructure(); if (SecStrucTools.getSecStrucInfo(s).isEmpty()) { logger.info("Calculating Secondary Structure...");
sg.setPDBFlag(true); sg.setPDBName(g.getPDBName()); sg.setChain(g.getChain());
/** Suggest domains for a set of Calpha atoms * * @param ca an array of Calpha atoms * @return a list of possible domains * @throws StructureException */ public static List<Domain> suggestDomains(Atom[] ca) throws StructureException{ GetDistanceMatrix distMaxCalculator = new GetDistanceMatrix(); PDPDistanceMatrix pdpMatrix = distMaxCalculator.getDistanceMatrix(ca); Domain dom = new Domain(); Chain c = ca[0].getGroup().getChain(); dom.setId("D"+c.getStructure().getPDBCode()+c.getId()+"1"); dom.setSize(ca.length); dom.setNseg(1); dom.getSegmentAtPos(0).setFrom(0); dom.getSegmentAtPos(0).setTo(ca.length-1); CutSites cutSites = new CutSites(); // Do the initial splitting CutDomain cutDomain = new CutDomain(ca,pdpMatrix); cutDomain.cutDomain(dom, cutSites, pdpMatrix); List<Domain> domains = cutDomain.getDomains(); // domains = ClusterDomains.cluster(domains, pdpMatrix); ShortSegmentRemover.cleanup(domains); return domains; }