public Object clone() { ChainImpl n = new ChainImpl(); n.setId(getId()); n.setName(getName()); n.setSwissprotId ( getSwissprotId()); n.setEntityInfo(this.entity); n.addGroup(g); g.setChain(n); g = n.getAtomGroup(i); } else { n.setSeqResGroups(tmpSeqRes);
int sizeAminos = getAtomGroups(GroupType.AMINOACID).size(); int sizeNucleotides = getAtomGroups(GroupType.NUCLEOTIDE).size(); List<Group> hetAtoms = getAtomGroups(GroupType.HETATM); int sizeHetatoms = hetAtoms.size(); int sizeWaters = 0; + "Counts: # aa residues: {}, # nuc residues: {}, # non-water het residues: {}, # waters: {}, " + "ratio aa/total: {}, ratio nuc/total: {}", getId(), ratioResiduesToTotal, max, sizeAminos, sizeNucleotides, sizeHetatomsWithoutWater, sizeWaters, (double) sizeAminos / (double) fullSize,
/** String representation. * @return String representation of the Chain */ @Override public String toString(){ String newline = System.getProperty("line.separator"); StringBuilder str = new StringBuilder(); str.append("Chain asymId:").append(getChainID()).append(" authId:").append(getName()).append(newline); if ( entity != null ){ if ( entity.getDescription() != null){ str.append(entity.getDescription()).append(newline); } } str.append("total SEQRES length: ").append(getSeqResGroups().size()).append(" total ATOM length:") .append(getAtomLength()).append(" residues ").append(newline); return str.toString() ; }
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 boolean isWaterOnly() { for (Group g : getAtomGroups()) { if (!g.isWater()) return false; } return true; }
/** * {@inheritDoc} * */ @Override public Group[] getGroupsByPDB(ResidueNumber start, ResidueNumber end) throws StructureException { return getGroupsByPDB(start, end, false); }
@Override public EntityType getEntityType() { if (getEntityInfo()==null) return null; return getEntityInfo().getType(); }
pdbResnum, group.getPDBName(), getChainID(), groups.get(pdbResnumMap.get(pdbResnum)).getResidueNumber(), groups.get(pdbResnumMap.get(pdbResnum)).getPDBName()); if ( group instanceof AminoAcid) pdbResnumMap.put(pdbResnum,pos);
@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); } }
@Override public boolean isPureNonPolymer() { for (Group g : getAtomGroups()) { //ChemComp cc = g.getChemComp(); if ( g.isPolymeric() && !g.isHetAtomInFile() ) { // important: the aminoacid or nucleotide residue can be in Atom records return false; } } return true; }
/** 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); }
/** * {@inheritDoc} */ @Override public String getAtomSequence(){ List<Group> groups = getAtomGroups(); StringBuilder sequence = new StringBuilder() ; for ( Group g: groups){ ChemComp cc = g.getChemComp(); if ( PolymerType.PROTEIN_ONLY.contains(cc.getPolymerType()) || PolymerType.POLYNUCLEOTIDE_ONLY.contains(cc.getPolymerType())){ // an amino acid residue.. use for alignment String oneLetter= ChemCompGroupFactory.getOneLetterCode(cc); if ( oneLetter == null) oneLetter = Character.toString(StructureTools.UNKNOWN_GROUP_LABEL); sequence.append(oneLetter); } } return sequence.toString(); }
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; }
if ( currentChain == null) { currentChain = new ChainImpl(); currentChain.setId(chainID); currentChain.setName(chainID);
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); }
newChain = new ChainImpl(); newChain.setName(parentC.getName()); model.add(newChain);
/** * 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); }