bwringe / hybriddetective

13 stars 7 forks source link

getTopLoc error: Unable to access jarfile PGDSpider2-cli.jar #5

Open apaijmans opened 6 years ago

apaijmans commented 6 years ago

Hi, I'm following the basic workflow, however, I keep running into issues when trying to generate the example data.

> nh_build_example_results(dir = "6 NewHybrids/Example/")
Error in nh_build_example_results(dir = "6 NewHybrids/Example/") : 
  object 'dir1' not found

I think there might just be a typo in the code of nh_build_example_results, I guess 'dir1' should be 'dir'?

I also get an error when trying to use getTopLoc:

> getTopLoc(GPD = "D:/SimPurePops.txt", panel.size = 50, where.PLINK = your_plink_path, where.PGDspider = your_pgdspider_path)
Reading Data
Creating training and working datasets
Calculating Fst
Error: Unable to access jarfile PGDSpider2-cli.jar
Error in file(file, "r") : cannot open the connection
In addition: Warning messages:
1: running command 'C:\Windows\system32\cmd.exe /c cd D:/PGDSpider/ && java -Xmx1024m -Xms512m -jar PGDSpider2-cli.jar -inputfile GPD_for_GET_TOP_LOC.txt -inputformat GENEPOP -outputfile for_FST.txt -outputformat FSTAT -spid GP_FSTAT.spid' had status 1 
2: In shell(run.PGDspider) :
  'cd D:/PGDSpider/ && java -Xmx1024m -Xms512m -jar PGDSpider2-cli.jar -inputfile GPD_for_GET_TOP_LOC.txt -inputformat GENEPOP -outputfile for_FST.txt -outputformat FSTAT -spid GP_FSTAT.spid' execution failed with error code 1
3: In file.copy(from = paste0(where.PGDspider, "/for_FST.txt"), to = path.start,  :
  problem copying D:\PGDSpider\\for_FST.txt to C:\Users\localadmin.UBIO-BIO1-8013\Documents\for_FST.txt: No such file or directory
4: In file(file, "r") :
  cannot open file 'for_FST.txt': No such file or directory

I am not sure what is going on here. I am working under Windows. I have already tried changing PGDSpider and PLINK to another folder, in case the problem was caused by permission errors, but I get thesame error. Same for running RStudio als admin. Do you have any idea what could cause these issues?

Thank you! Anneke

rystanley commented 6 years ago

Anneke,

You were right regarding the bug with the 'dir1' variable. That error has been fixed and the function should now work if you re-download and install the package.

The other error you are getting can have a variety of causes. Permissions is one, but it looks like you have played around with that issue. The other errors reported propagate from the first one where the function can't find PGDspider. Be sure that the file it is looking for is in the directory provided. You can do this by setting your working directory to that path and using dir setwd(your_pgd_path) dir(). Also, have you installed the newest version of New Hybrids? Hybrid detective is built to work specifically with the newest New Hybrids build that can be found on the developers github - (https://github.com/eriqande/newhybrids). This might be the problem if you have the version that is found on the web. I don't have any issues using the most recent NewHybrids build and getTopLoc on a computer with partially locked down admin privileges. If you do have the right build we can try to track down why that error might be occurring.

apaijmans commented 6 years ago

Hi Ryan, Thanks for your quick reply!

I had installed the latest version of newHybrids, but just in case I downloaded it again. I think the problem is somehow caused by PGDSpider, though. I got the same error as long as the working directory was not set to the PGDSPider folder (eventhough where.PGDspider = your_pgdspider_path pointed to the exact same folder). After changing the working directory to the PDGSpider folder, I got a different error, which seems to be related to Java...

> getTopLoc(GPD = "D:/Example/SimPurePops.txt", panel.size = 50, where.PLINK = your_plink_path, where.PGDspider = your_pgdspider_path)
Reading Data
Creating training and working datasets
Calculating Fst
Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/dom/ls/DocumentLS
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
    at java.base/java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(Unknown Source)
    at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(Unknown Source)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(Unknown Source)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
    at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.<init>(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown Source)
    at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:861)
    at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:773)
    at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:901)
    at ch.unibe.iee.cmpg.pgdspider.PGDSpiderCli.main(PGDSpiderCli.java:15)
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ls.DocumentLS
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
    at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
    ... 15 more
Error in file(file, "r") : cannot open the connection
apaijmans commented 6 years ago

I removed and re-installed JAVA, unfortunatly to no avail as I still get errors (see below)... a quick google seach points me still into the direction of JAVA. Maybe it does not work with the newer versions of JAVA?

I start to wonder if I can just run the dataset I have with parallelnewhybrids (which seems to work fine with the example data), then use hybriddetective to do the nh_preCheckR and make plots. Or is it crucial to simulate training data first?

All the best, Anneke

> getTopLoc(GPD = "D:/Example/SimPurePops.txt", panel.size = 50, where.PLINK = your_plink_path, where.PGDspider = your_pgdspider_path)
Reading Data
Creating training and working datasets
Calculating Fst
INFO  16:36:02 - load PGDSpider configuration from: D:\Programs\PGDSpider\spider.conf.xml
Warning: Could not get charToByteConverterClass!
ERROR 16:36:02 - Missing parser for Format 'null'
initialize convert process...
read input file...
ERROR 16:36:02 - input file error at line: 0
read input file done.
write output file...
ERROR 16:36:02 - No Microsat, Standard, SNP or AFLP data in the input file. FSTAT can only handle these data types!!!
write output file done.
Read 0 items
rystanley commented 6 years ago

Strange. I wonder if you could try to do the conversion manually (outside of the package) in PGDspider to see if you can replicate the error. Certainly this error isn't something that is common, but Java can definitely cause headaches.

Before skipping the simulation step it might be worth while trying the data on another computer with clean installations of PGDspider and the package from git. Alternatively you could email your data or a subset of your data so we can see if there is an issue with the code.

apaijmans commented 6 years ago

I have used PGDSpider to convert other files for a different project, and that seems to work fine. I tried to run it on a different PC, but no luck. I think it keeps getting stuck somehow on java (see error below).

So far I have only tried it so far with the example data SimPurePops, not yet with my own data. Would it be possible to upload the output of the getTopLoc function, so I can see if I can get the other functions to work? I tried nh_analysis_simulateR_generateR, but it gave me the following error: object 'out.name' not found I think this is a typo in the code, I think out.name should be outputName?

> getTopLoc(GPD = "D:/seals/Example/SimPurePops.txt", panel.size = 50, where.PLINK = your_plink_path, where.PGDspider = your_pgdspider_path)
Reading Data
Creating training and working datasets
Calculating Fst
'java' is not recognized as an internal or external command,
operable program or batch file.
rystanley commented 6 years ago

Sure I can get the getTopLoc output for you using that simulated data. I will get on that ASAP

rystanley commented 6 years ago

SimPurePops.txt SimPurePops_50_Loci_Panel.txt

rystanley commented 6 years ago

Also you are correct the parameter ouputName was misspecified in the code. I have fixed that. If you reinstall it should work correctly.

mkd143 commented 6 years ago

your_plink_path = "C:\Program Files/plink_win64/" your_pgdspider_path = "C:\Program Files/PGDSpider_2.1.1.5/PGDSpider_2.1.1.5/" your_example_data_path = paste0(path.hold, "/hybriddetective example/SimPurePops.txt")

getTopLoc(GPD = your_example_data_path, panel.size = 50, where.PLINK = your_plink_path, where.PGDspider = your_pgdspider_path) Reading Data Creating training and working datasets Calculating Fst The system cannot find the path specified. Error in file(file, "r") : cannot open the connection In addition: Warning messages: 1: In shell(run.PGDspider) : 'cd C:\Program\ Files/PGDSpider_2.1.1.5/PGDSpider_2.1.1.5/ && java -Xmx1024m -Xms512m -jar PGDSpider2-cli.jar -inputfile GPD_for_GET_TOP_LOC.txt -inputformat GENEPOP -outputfile for_FST.txt -outputformat FSTAT -spid GP_FSTAT.spid' execution failed with error code 1 2: In file.copy(from = paste0(where.PGDspider, "/for_FST.txt"), to = path.start, : problem copying C:\Program Files\PGDSpider_2.1.1.5\PGDSpider_2.1.1.5\for_FST.txt to C:\Users\Meghann\Desktop\RWorking\hybriddetective\for_FST.txt: No such file or directory 3: In file(file, "r") : cannot open file 'for_FST.txt': No such file or directory

I tried with both JAVA 8 and JAVA 10 installed in Windows.

I can manually convert the files in PGDspider and manually run through plink but the pipeline isn't working for me.

rspfau commented 3 years ago

I'm assuming this issue was never resolved. I'm having the same problem.

JHHartman commented 1 year ago

Did anyone ever figure this out? I am also having this problem. I even went back and installed Java 7 and can't seem to get it to work.

JHHartman commented 1 year ago

Did anyone ever figure this out? I am also having this problem. I even went back and installed Java 7 and can't seem to get it to work.

UPDATE: I am using a windows 64-bit and here are the changes I made to get the script to run! Line 160 and 279: changed the arrow to an equal sign Line 198 and 316: changed where.PGDspider.PGD to where.PGDspider I also commented out lines 166-185 and 283-303 (although I am not sure if this really did anything). Outside of R, I also changed the compatibility of my PGDspider2-cli files to Windows 8.