Protein Data Bank PDB File Reading in Java Tool Example Code biojava api integration
package pdb;
import java.util.Map;
import org.biojava.bio.structure.AminoAcid;
import org.biojava.bio.structure.Chain;
import org.biojava.bio.structure.Group;
import org.biojava.bio.structure.GroupIterator;
import org.biojava.bio.structure.HetatomImpl;
import org.biojava.bio.structure.Structure;
import org.biojava.bio.structure.io.PDBFileReader;
/**
*
* @author Usman
*/
public class PDBInfo {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// also works for gzip compressed files
String ProjectPath= System.getProperties().getProperty("user.dir");
String filename = ProjectPath+"/SamplePDB/12E8.pdb" ;
PDBFileReader pdbreader = new PDBFileReader();
try{
Structure struc = pdbreader.getStructure(filename);
System.out.println(struc);
GroupIterator gi = new GroupIterator(struc);
while (gi.hasNext()){
Group g = (Group) gi.next();
if ( g instanceof AminoAcid ){
System.out.println("Group********************************************");
AminoAcid aa = (AminoAcid)g;
Map sec = aa.getSecStruc();
Chain c = g.getParent();
System.out.println("Chain name : "+c.getName() + " Group: " + g.getAtoms() + " Sec Strucure:" + sec);
}
if ( g instanceof HetatomImpl ){
System.out.println("Group********************************************");
HetatomImpl aa = (HetatomImpl)g;
Chain c = g.getParent();
System.out.println("Chain name : "+c.getName() + " Group: " + g.getAtoms());
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
package pdb;
import java.util.Map;
import org.biojava.bio.structure.AminoAcid;
import org.biojava.bio.structure.Chain;
import org.biojava.bio.structure.Group;
import org.biojava.bio.structure.GroupIterator;
import org.biojava.bio.structure.HetatomImpl;
import org.biojava.bio.structure.Structure;
import org.biojava.bio.structure.io.PDBFileReader;
/**
*
* @author Usman
*/
public class PDBInfo {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// also works for gzip compressed files
String ProjectPath= System.getProperties().getProperty("user.dir");
String filename = ProjectPath+"/SamplePDB/12E8.pdb" ;
PDBFileReader pdbreader = new PDBFileReader();
try{
Structure struc = pdbreader.getStructure(filename);
System.out.println(struc);
GroupIterator gi = new GroupIterator(struc);
while (gi.hasNext()){
Group g = (Group) gi.next();
if ( g instanceof AminoAcid ){
System.out.println("Group********************************************");
AminoAcid aa = (AminoAcid)g;
Map sec = aa.getSecStruc();
Chain c = g.getParent();
System.out.println("Chain name : "+c.getName() + " Group: " + g.getAtoms() + " Sec Strucure:" + sec);
}
if ( g instanceof HetatomImpl ){
System.out.println("Group********************************************");
HetatomImpl aa = (HetatomImpl)g;
Chain c = g.getParent();
System.out.println("Chain name : "+c.getName() + " Group: " + g.getAtoms());
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
0 comments:
Post a Comment