Determine if an ATM/HETATM is before/after a TER statement

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

Charles I think you can probably use the fact that an atom that is in a group that you’re interested in is also in a monomer. Or possibly you could check to see if it’s in a biopolymer which would exclude calcium.

Robert M. Hanson
St. Olaf College Chemistry

···

from my Windows phone


From: Charles Ofoegbu (Staff)
Sent: ‎7/‎18/‎2016 9:00 AM
To: hansonr@stolaf.edu
Cc: Jalview Development List
Subject: Determine if an ATM/HETATM is before/after a TER statement

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

Dear Bob,

Thanks for the prompt reply. We were originally processing the data in a similar fashion as you suggested. However, I discovered that inserted residues are excluded from the biopolymer / monomers, and that was one of the reasons for the decision to traverse the entire atom array to generate sequences which includes inserted residues.

I’m wondering if there is any other way to achieve this and still retain inserted residues.

PS: CA in my previous mail refers to alpha Carbon and not Calcium.

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

···

On 18 Jul 2016, at 19:47, Bob <hansonr@stolaf.edu> wrote:

Charles I think you can probably use the fact that an atom that is in a group that you’re interested in is also in a monomer. Or possibly you could check to see if it’s in a biopolymer which would exclude calcium.

Robert M. Hanson
St. Olaf College Chemistry
from my Windows phone


From: Charles Ofoegbu (Staff)
Sent: ‎7/‎18/‎2016 9:00 AM
To: hansonr@stolaf.edu
Cc: Jalview Development List
Subject: Determine if an ATM/HETATM is before/after a TER statement

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

The University of Dundee is a registered Scottish Charity, No: SC015096