Dear Bob,
We are employing JMol API to parse some structure files in Jalview. For the sake of flexibility and a bunch of other reasons, I’m generating sequences by iterating through the atom collection from Jmol’s API and then making residues from significant atoms (i.e. CA or P atoms/hetatoms).
Now the problem is that sometimes extra unwanted residues are added to the sequences. I’ve tracked down the problem to including CA HETATMs which falls after the ‘TER’ statement in a PDB file for a given chain to the list of significant atoms. The snippet below shows the bit of code that converts significant atoms from Jmol’s data model to Jalview’s data model.
private List convertSignificantAtoms(ModelSet ms)
{
List significantAtoms = new ArrayList();
for (org.jmol.modelset.Atom atom : ms.at)
{
if (atom.getAtomName().equalsIgnoreCase(“CA”)
atom.getAtomName().equalsIgnoreCase(“P”))
{
Atom curAtom = new Atom(atom.x, atom.y, atom.z);
curAtom.atomIndex = atom.getIndex();
curAtom.chain = atom.getChainIDStr();
curAtom.insCode = atom.group.getInsertionCode();
curAtom.name = atom.getAtomName();
curAtom.number = atom.getAtomNumber();
curAtom.resName = atom.getGroup3(true);
curAtom.resNumber = atom.getResno();
curAtom.occupancy = ms.occupancies != null ? ms.occupancies[atom
.getIndex()] : Float.valueOf(atom.getOccupancy100());
curAtom.resNumIns = “” + curAtom.resNumber + curAtom.insCode;
curAtom.tfactor = atom.getBfactor100() / 100f;
curAtom.type = 0;
significantAtoms.add(curAtom);
}
}
return significantAtoms;
}
Is there an existing method in Jmol to determine if an atom is before TER record of its chain? if such method exists say atom.isBeforeChainTER(). Then modifying the snippet above as below would ignore insignificant CA and P HETATMs and would solve the problem.
private List convertSignificantAtoms(ModelSet ms)
{
List significantAtoms = new ArrayList();
for (org.jmol.modelset.Atom atom : ms.at)
{
if (atom.getAtomName().equalsIgnoreCase(“CA”)
atom.getAtomName().equalsIgnoreCase(“P”))
{
if (atom.isHetero() && !atom.isBeforeChainTer())
{
continue;
}
Atom curAtom = new Atom(atom.x, atom.y, atom.z);
curAtom.atomIndex = atom.getIndex();
curAtom.chain = atom.getChainIDStr();
curAtom.insCode = atom.group.getInsertionCode();
curAtom.name = atom.getAtomName();
curAtom.number = atom.getAtomNumber();
curAtom.resName = atom.getGroup3(true);
curAtom.resNumber = atom.getResno();
curAtom.occupancy = ms.occupancies != null ? ms.occupancies[atom
.getIndex()] : Float.valueOf(atom.getOccupancy100());
curAtom.resNumIns = “” + curAtom.resNumber + curAtom.insCode;
curAtom.tfactor = atom.getBfactor100() / 100f;
curAtom.type = 0;
significantAtoms.add(curAtom);
}
}
return significantAtoms;
}
I don’t know if this is the best way to go about this. I’m looking forward to your prompt reply as usual and would welcome alternative solutions.
Thanks and regards,
Charles
Ofoegbu Tochukwu Charles
Jalview Visual Analytics Developer/Scientist
The Barton Group
Division of Computational Biology
School of Life Sciences
University of Dundee, Dundee, Scotland, UK.
Skype: cofoegbu
www.jalview.org
www.compbio.dundee.ac.uk
The University of Dundee is a registered Scottish Charity, No: SC015096