/** Construct a Structure object that only contains a single group * * @param g group object */ public StructureImpl(Group g){ this(); Chain c = new ChainImpl(); c.addGroup(g); addChain(c); }
split.addGroup(g);
public synchronized void setChain(Chain c){ List<Group> a = c.getAtomGroups(GroupType.AMINOACID); seqArr = new Character[a.size()]; chain = new ChainImpl(); Iterator<Group> iter = a.iterator(); int i = 0; while (iter.hasNext()){ AminoAcid aa = (AminoAcid) iter.next(); // preserver original hierarchy ... for highlighting in Jmol Chain old = aa.getChain(); chain.addGroup(aa); aa.setChain(old); seqArr[i] = aa.getAminoType(); i++; } chainLength = i; coordManager.setLength(chainLength); setPrefSize(); this.repaint(); }
/** 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; }
newChain.addGroup(ng);
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); }
/** * Create and set a new structure from a given atom array. * @param atoms */ public void setAtoms(Atom[] atoms){ Structure s = new StructureImpl(); Chain c = new ChainImpl(); c.setId("A"); for (Atom a: atoms){ c.addGroup(a.getGroup()); } s.addChain(c); setStructure(s); }
newChain.addGroup(newG);
public static void main(String[] args){ Chain c = new ChainImpl(); c.setId("X"); Group g = new AminoAcidImpl(); g.setResidueNumber(ResidueNumber.fromString("1A")); try { g.setPDBName("ALA"); } catch (Exception e){} Atom a = new AtomImpl(); a.setName("CA"); g.addAtom(a); c.addGroup(g); System.out.println(getPdbInfo(a)); }
/** * The method will return a new reference to a Chain with any consecutive groups * having same residue numbers removed. * This is necessary to solve the microheterogeneity issue in entries like 3u7t (see github issue #160) * @param c * @return */ private static Chain removeSeqResHeterogeneity(Chain c) { Chain trimmedChain = new ChainImpl(); ResidueNumber lastResNum = null; for (Group g:c.getAtomGroups()) { // note we have to deep copy this, otherwise they stay linked and would get altered in addGroup(g) ResidueNumber currentResNum = new ResidueNumber( g.getResidueNumber().getChainName(), g.getResidueNumber().getSeqNum(), g.getResidueNumber().getInsCode()); if (lastResNum == null || !lastResNum.equals(currentResNum) ) { trimmedChain.addGroup(g); } else { logger.debug("Removing seqres group because it seems to be repeated in entity_poly_seq, most likely has hetero='y': "+g); } lastResNum = currentResNum; } return trimmedChain; }
/** * Returns a {@link Structure} corresponding to the CATH identifier supplied in {@code structureName}, using the specified {@link CathDatabase}. */ public Structure getStructureForCathDomain(StructureName structureName, CathDatabase cathInstall) throws IOException, StructureException { CathDomain cathDomain = cathInstall.getDomainByCathId(structureName.getIdentifier()); Structure s = getStructureForPdbId(cathDomain.getIdentifier()); Structure n = cathDomain.reduce(s); // add the ligands of the chain... Chain newChain = n.getPolyChainByPDB(structureName.getChainId()); List<Chain> origChains = s.getNonPolyChainsByPDB(structureName.getChainId()); for ( Chain origChain : origChains) { List<Group> ligands = origChain.getAtomGroups(); for (Group g : ligands) { if (!newChain.getAtomGroups().contains(g)) { newChain.addGroup(g); } } } return n; }
chain.addGroup(group);
} catch (StructureException e) { newChain.addGroup(parentN);
entityChain.addGroup(g);
currentChain = chain; currentChain.addGroup(group);
n.setResidueNumber(g.getResidueNumber()); n.addAtom(a); newChain.addGroup(n); continue grouploop;
g = (Group)g.clone(); chain.addGroup(g);
g1.clearAtoms(); g1.addAtom(a); c1.addGroup(g1);