Atomcache function in biojava
0
0
Entering edit mode
10.3 years ago
mossig89 ▴ 10

Hi everyone I'm fairly new to biojava and trying to implement this piece of code:

AtomCache cache = new AtomCache();
cache.setPath("/tmp/");
FileParsingParameters params = cache.getFileParsingParams();
params.setLoadChemCompInfo(true);
StructureIO.setAtomCache(cache);
Structure strucuture = StructureIO.getStructure("4HHB");

after executing these lines I'm getting the following error message:

Exception in thread "main" java.lang.NoSuchFieldError: lineSplit at org.biojava.bio.structure.align.util.UserConfiguration.(UserConfiguration.java:87) at org.biojava.bio.structure.align.util.AtomCache.(AtomCache.java:115) at protein_structure.main(protein_structure.java:27) Java Result: 1

I can't figure out the reason for this error, I downloaded the pdb files for the proteins that I'm working with (in this case "4HHB" in the /tmp/ directory but still the same error is showing up. can anyone tell me how Atomcache function works? Thanks.

java biojava netbeans • 3.9k views
ADD COMMENT
1
Entering edit mode

From the stack trace that you report I would say that your error is related to something not properly configured in the environment. A "NoSuchFieldError" will only happen if some dependency is not properly set-up, i.e. some class path issue or similar.

How have you set up your environment? Are you using eclipse and maven? Are you running from command line? Also are you in Linux/Windows/Mac?

I would recommend that you use eclipse if you are not doing so already. You only need the m2e plugin (maven plugin) for it to work optimally.

ADD REPLY
0
Entering edit mode

im using linux 32 bit, with netbeanse 8.0. I tried using biojava with eclipse I followed the commands provided here: http://biojava.org/wiki/BioJava3_eclipse however I couldnt do step 5 of option 1 and step 4 of option 2, because whenever I right clicked on the biojava projects within the project explorer there is no option for share project under team.

using netbeanse for biojava I followed the steps provided here: http://biojava.org/wiki/How_to_integrate_BioJava_in_NetBeans_IDE

I followed option 3 in this case and was able to do all 9 steps, however after that when I opened netbeans I saw all the biojava modules on the left side but didnt know how to integrate them on my new projects, therefore using netbeans after that I simply downloaded the JAR files for biojava and for a new project I right click on the libraries under the project manager and I do Add JAR/Folder after doing so I start using biojava

ADD REPLY
2
Entering edit mode

About eclipse I would offer then a 3rd option that I know has worked well for me. If you have time you could give it a try:

  • From the command line clone the biojava project: git clone https://github.com/biojava/biojava.git
  • In eclipse (with m2e and egit installed) go to File -> Import -> Maven -> Existing Maven Projects. Then browse to the root dir of the biojava project that you just cloned and click ok and then Finish
  • Now eclipse will automatically detect all the pom.xml files (the maven config files) and will understand that it is a maven and a git-tracked project. Everything should work, you can test it by trying the DemoAtomCache in demos folder of the biojava3-structure module (under src/main/java)
ADD REPLY
0
Entering edit mode

whenever I go to file>import>maven>existing Maven Projects and after that select the biopython folder downloaded it's not selecting and saying under the Maven projects: "project biojava already exists add a version or a custom suffix using name template in Advanced settings "

it seems like ive already done this step, and added biojava as a maven project. what should I do? how should I import the biojava modules everytime I create a new java project from file> new> Java project

ADD REPLY
0
Entering edit mode

aight I deleted everything concerning eclipse, redid everything from scratch, installed egit, maven and after that followed your steps that you mentioned above. after that I tested the DemoAtomCache, it worked just fine. Thanks alot.

I created a new java project, in the Java settings under the projects tab I added all the biojava projects and than imported some biojava classes and it worked just fine. now is this the correct way to use biojava in my java projects or are there other ways to do it? thanks.

ADD REPLY
0
Entering edit mode

Glad that it worked in the end! Regarding how to use biojava. The way you did it is perfectly valid. It has the advantage that if you want to contribute to the biojava project you have it all set-up locally already. You can hack the biojava code and create pull requests to contribute back to it.

There are however other alternatives:

  • Download the biojava jars and set eclipse classpath to point to those (Properties -> Java Build Path -> Libraries)
  • Use maven for your project and point to biojava by setting the dependencies in the pom.xml file. This is the most powerful and flexible set-up. Maven will take care of your dependencies (biojava or any others you might have) and you won't need to worry about updating the jar files or downloading them or anything. Maven will do all that for you plus a lot more. Having said that, the complexities of maven might be a bit overwhelming at the beginning, so perhaps you can set it up in a second stage when you feel more confident with all the other tools.
ADD REPLY
0
Entering edit mode
ADD REPLY

Login before adding your answer.

Traffic: 2308 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