difference between imports in biojava
1
0
Entering edit mode
9.2 years ago
Moses ▴ 150

I'm using biojava classes and modules over Eclipse IDE. While going over the cookbook provided by the wiki page I reached the following point: http://biojava.org/wiki/BioJava:CookBook:PDB:read3.0

trying to implement the following example:

// by default PDB files will be stored in a temporary directory

        // there are two ways of configuring a directory, that can get re-used multiple times:
        // A) set the environment variable PDB_DIR
        // B) call cache.setPath(path)
        AtomCache cache = new AtomCache();

        try {
            // alternative: try d4hhba_ 4hhb.A 4hhb.A:1-100
            Structure s = cache.getStructure("4hhb");
            System.out.println(s);
        }  catch (Exception e) {
            e.printStackTrace();
        }

while running this piece of code I used two different set of imports:

First set:

import org.biojava.nbio.structure.Structure;
import org.biojava.nbio.structure.StructureIO;
import org.biojava.nbio.structure.align.util.AtomCache;

Second set is:

import org.biojava.bio.structure.*;
import org.biojava3.structure.StructureIO;
import org.biojava.bio.structure.align.util.AtomCache;

Now with the different set of imports the execution of the code is giving different results. My question is what's the exact difference between these imports, and why are they giving different results for the same piece of code? And which one should I use? Thank you.

biojava eclipse java • 2.6k views
ADD COMMENT
1
Entering edit mode

Looks like the differences are because of some mess with versions, to get more details you need to check the version of biojava and the source code of imported classes. I suggest you can manage biojava dependencies via Maven to resolve those inconsistencies, check out these links:

You can also clone a specific tag (say 4.0.0) from this github repo: https://github.com/biojava/biojava

ADD REPLY
0
Entering edit mode

Thank you, I'll give that a go. Also is there any proper documentation for Biojava? the cookbook on the wiki page is just giving some chunks of code from here and there and is barely commenting on what the scripts are about, in biopython for instance the cookbook is much more in details, well written and explains in details all the functions and methods that the library has to offer.

ADD REPLY
2
Entering edit mode
9.2 years ago
andreas.prlic ▴ 290

The difference in imports is due to the package name change in Biojava version 4. Now all packages are starting with org.biojava.nbio. There is a biojava tutorial at https://github.com/biojava/biojava-tutorial

ADD COMMENT

Login before adding your answer.

Traffic: 2420 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6