User b339fedd4e
07-12-2007 11:23:43
hi,
i am new to this jchem
Could u pls give me the code for retreiving the triplet code from pdb file
in java.
Thank u
Regards,
richa
ChemAxon efa1591b5a
07-12-2007 12:45:19
User b339fedd4e
10-12-2007 08:53:51
Hi,
Here I am pasting my code.
DataOutputStream dos = new DataOutputStream(new FileOutputStream("out.txt"));
PDBReader pdbReader = new PDBReader();
String filename = "./1ZZL.pdb";
InputStream is = new FileInputStream(new File(filename));
MolInputStream mis = new MolInputStream(is);
MacroMolecule macroMol;
AtomProperty ap;
AtomIterator ai;
ComponentIterator compIt;
Component comp;
MolExporter molExp = new MolExporter(os, "sdf");
pdbReader.setInput(mis);
macroMol = pdbReader.read();
compIt = macroMol.getIterator();
int j=0;
while (compIt.hasNext())
{
j++;
comp = compIt.next();
double x = ai.getX();
double y = ai.getY();
double z = ai.getZ();
dos.writeBytes(x +"\t" + y + "\t" + z + "\n");
}
If I run this code I am getting the following exception.
Exception in thread "main" java.lang.ClassCastException: chemaxon.marvin.modules.MoleculeIterators$MoleculeAtomIterator
and if I run this following code
ap = (AtomProperty)comp.getAtomProperty();
for(int i = 0; i<=comp.getAtomCount();i++)
{
double x = ap.getX(i);
double y = ap.getY(i);
double z = ap.getZ(i);
//System.out.println(x);
dos.writeBytes(x +"\t" + y + "\t" + z + "\n");
I am getting some junk data like Infinite as x coordinates and y and z as 0.00
Residue lable as unrecognized command.
My profile is updated.
Could u please rectify my doubt.
Thank you.
Waiting for ur reply.
Regards,
richa.
ChemAxon efa1591b5a
10-12-2007 09:46:10