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.
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.
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
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:
git clone https://github.com/biojava/biojava.git
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
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.
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:
Cross posted: http://stackoverflow.com/questions/25399930