Writing your first Biojava program using NetBeans in 3 easy steps

If you are using Java for your bioinformatics work, you should consider using Biojava as it saves lot of time in writing codes.

Prerequisites:
NetBeans 6.5.1
Biojava library
Biojava support library

Step 1 Create a new Java Application in NetBeans.

Step 2 Open the projects windows, right-click Libraries and select "Add JAR/Folder..." and add the two jar files you have downloaded previously in the prerequisites section.

Step 3 Open Main.java and start writing your biojava code. A sample code for reading a PDB file and accessing its contents is shown below(Don't forget to click "Fix Imports" after copying this code to automatically add the required import statements).


String filename = "path/to/pdbfile.pdb" ;

PDBFileReader pdbreader = new PDBFileReader();

// the following parameters are optional:

//the parser can read the secondary structure
// assignment from the PDB file header and add it to the amino acids
pdbreader.setParseSecStruc(true);

// align the SEQRES and ATOM records, default = true
// slows the parsing speed slightly down, so if speed matters turn it off.
pdbreader.setAlignSeqRes(true);

// parse the C-alpha atoms only, default = false
pdbreader.setParseCAOnly(false);

// download missing PDB files automatically from EBI ftp server, default = false
pdbreader.setAutoFetch(false);

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 ){
AminoAcid aa = (AminoAcid)g;
Map sec = aa.getSecStruc();
Chain c = g.getParent();
System.out.println(c.getName() + " " + g + " " + sec);
}
}

} catch (Exception e) {
e.printStackTrace();
}


From the structure object, you could get the atoms and do calculations on it.

The best place to start learning about the features of Biojava is the Biojava CookBook
Share/Bookmark

3 comments:

  1. If you are ready to watch comical videos online then I suggest you to go to see this web site, it consists of truly
    so funny not only videos but also other information.


    Feel free to surf to my homepage - relevant web page

    ReplyDelete
  2. Of course, one of the reasons why this area of Ohio
    has remained so persistently branded as a pocket of joblessness is its failure to recover from the death of the steel industry and also because
    of automotive production lines outsourced to foreign lands.

    He was instrumental in MTV showing African American artists.

    The facility of websites and online news are also getting
    lot of appreciation because it is very time saving and people
    can read it in between their work.

    my blog: Latest Daily News

    ReplyDelete
  3. You will find the most updated news being uploaded or published in blogs and celeb news
    sites. Also, find one that has includes videos explaining the latest news because that is sometimes the best way to see it.

    With this online store you need not worry about being fooled because the site is accorded security.


    my weblog; latest celeb news

    ReplyDelete


Powered by  MyPagerank.Net

LinkWithin