private Chain getEntityChain(String entity_id){ for (Chain chain : entityChains) { if ( chain.getId().equals(entity_id)){ return chain; } } // does not exist yet, so create... Chain chain = new ChainImpl(); chain.setId(entity_id); entityChains.add(chain); return chain; }
@Override public void setChainInfo(String chainId, String chainName, int groupCount) { // First check to see if the chain exists Map<String, Chain> modelChainMap = chainMap.get(modelNumber); if(modelChainMap.containsKey(chainId)){ chain = modelChainMap.get(chainId); } // If we need to set a new chain do this else{ chain = new ChainImpl(); chain.setId(chainId.trim()); chain.setName(chainName); chain.setAtomGroups(new ArrayList<>(groupCount)); modelChainMap.put(chainId, chain); chainList.add(chain); } }
/** 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); }
public SequenceScalePanel(int position) { super(); this.position = position; this.setBackground(BACKGROUND_COLOR); chain = new ChainImpl(); setDoubleBuffered(true); seqArr = new Character[0]; chainLength = 0; scale = 1.0f; setPrefSize(); coordManager = new CoordManager(); apos = new ArrayList<AlignedPosition>(); }
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 = new ChainImpl(); newChain.setName(parentC.getName()); model.add(newChain);
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 = new ChainImpl(); newChain.setName(parentC.getName()); model.add(newChain);
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; }
public Object clone() { ChainImpl n = new ChainImpl();
newChain = new ChainImpl(); newChain.setId(parentC.getId()); newChain.setName(parentC.getName());
Chain newchain = new ChainImpl(); newchain.setName(c.getName());
c = new ChainImpl(); Chain orig = a.getGroup().getChain(); c.setId(orig.getId()); Chain orig = a.getGroup().getChain(); if (!orig.getId().equals(prevChainId)) { c = new ChainImpl(); c.setId(orig.getId()); c.setName(orig.getName()); c = new ChainImpl(); Chain orig = a.getGroup().getChain(); c.setId(orig.getId()); Chain orig = a.getGroup().getChain(); if (!orig.getId().equals(prevChainId)) { c = new ChainImpl(); c.setId(orig.getId()); c.setName(orig.getName());
throw new IllegalArgumentException("Could not find residue " + rn + " in structure", e); Chain chain = new ChainImpl(); chain.setName(group.getChain().getName()); chain.setId(group.getChain().getId());
Chain newChain = new ChainImpl(); newChain.setId(chain.getId()); newChain.setName(chain.getName());
for ( Chain c : orig.getChains()){ Chain c1 = new ChainImpl(); c1.setId(c.getId()); c1.setName(c.getName());