lindenb / jvarkit

Java utilities for Bioinformatics
https://jvarkit.readthedocs.io/
Other
487 stars 133 forks source link

Task :vcf2bam FAILED #239

Open liyaron opened 1 year ago

liyaron commented 1 year ago

When I try ./gradlew vcf2bam, it always reports an error

[ant:javac] /lustre/sdb/zhangyaoz/lyr/software/jvarkit/src/main/java/com/github/lindenb/jvarkit/tools/vcf2bam/VcfToBam.java:27: error: cannot access Cigar [ant:javac] import htsjdk.samtools.Cigar; [ant:javac] ^ [ant:javac] bad class file: /lustre/sdb/zhangyaoz/lyr/software/jvarkit/lib/com/github/samtools/htsjdk/4.0.1/htsjdk-4.0.1.jar(htsjdk/samtools/Cigar.class) [ant:javac] class file has wrong version 61.0, should be 52.0 [ant:javac] Please remove or make sure it appears in the correct subdirectory of the classpath.

Task :vcf2bam FAILED

FAILURE: Build failed with an exception.

BUILD FAILED in 2s 1 actionable task: 1 executed

lindenb commented 1 year ago

what version of java are you using ?

Warrenkevin commented 1 year ago

@lindenb Greetings Pierre, I am having the same exact issue. I was wondering what version of the Java should I be using?

lindenb commented 1 year ago

at least java 17

lindenb commented 1 year ago

but you can always use the precompiled jar: https://github.com/lindenb/jvarkit/#download

Warrenkevin commented 1 year ago

@lindenb Thank you, it worked! :) I do have some clarifying questions, I am very new bash.

Q1: I built my manifest for the ancestral allele similar to how yours (see Manifest Example) but I keep getting an error (see Error message). I was wondering why this is?

Manifest Example:

"10|chr10    ANCESTOR_for_chromosome:GRCh37:10: 77,662,404-77,718,023  /usr3/graduate/warrenkb/Candidate_Genes_AA/Human_Ancestral_Condition_chr10.fa"

Error Message

[warrenkb@scc1 jvarkit]$ java -jar dist/jvarkit.jar vcfancestralalleles \

-m /usr3/graduate/warrenkb/Candidate_Genes_AA/manifest.txt \ usr3/graduate/warrenkb/Candidate_Genes_AA/Human_Ancestral_Condition/ALKBH1_37.vcf |\ bcftools annotate -x '^INFO/AA' [SEVERE][VcfAncestralAllele]Cannot read non-existent file: file:///usr3/graduate/warrenkb/Candidate_Genes_AA/manifest.txt htsjdk.samtools.SAMException: Cannot read non-existent file: file:///usr3/graduate/warrenkb/Candidate_Genes_AA/manifest.txt at htsjdk.samtools.util.IOUtil.assertFileIsReadable(IOUtil.java:498) at com.github.lindenb.jvarkit.io.IOUtils.openPathForReading(IOUtils.java:360) at com.github.lindenb.jvarkit.io.IOUtils.openPathForBufferedReading(IOUtils.java:374) at com.github.lindenb.jvarkit.tools.onekgenomes.VcfAncestralAllele.loadManifest(VcfAncestralAllele.java:171) at com.github.lindenb.jvarkit.tools.onekgenomes.VcfAncestralAllele.beforeVcf(VcfAncestralAllele.java:298) at com.github.lindenb.jvarkit.jcommander.OnePassVcfLauncher.doWork(OnePassVcfLauncher.java:123) at com.github.lindenb.jvarkit.util.jcommander.Launcher.instanceMain(Launcher.java:819) at com.github.lindenb.jvarkit.util.jcommander.Launcher.instanceMainWithExit(Launcher.java:982) at com.github.lindenb.jvarkit.tools.onekgenomes.VcfAncestralAllele.main(VcfAncestralAllele.java:314) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at com.github.lindenb.jvarkit.tools.jvarkit.JvarkitCentral$Command.execute(JvarkitCentral.java:276) at com.github.lindenb.jvarkit.tools.jvarkit.JvarkitCentral.run(JvarkitCentral.java:749) at com.github.lindenb.jvarkit.tools.jvarkit.JvarkitCentral.main(JvarkitCentral.java:760) [SEVERE][OnePassVcfLauncher]initialization failed [INFO][Launcher]vcfancestralalleles Exited with failure (-1) Failed to read from standard input: unknown file type

Q2: I am having a little trouble dissecting this code, can you help? How I understand it is and how I figure my code will look is a little something like this (see below).

$ java -jar dist/jvarkit.jar vcfancestralalleles \ ---------------------Stays the same

_-m /commun/data/pubdb/ftp.1000genomes.ebi.ac.uk/vol1/ftp/phase1/analysis_results/supporting/human_ancestor_GRCh37_e59/manifest.mf_ \ --------------------------------This is the location of my manifest. Does my manifest have to be as a .mf or will a .txt file work. I know that your directions say that it should be tab delimited file. 

_src/test/resources/gnomad.exomes.r2.0.1.sites.vcf.gz |\
bcftools annotate -x '^INFO/AA'_  -----------------------this is my VCF file of my candidate gene that is adding the ancestral allele to the VCF file. Is the correct? My VCF file is only a .vcf, not a .vcf.gz. Does that matter? 
lindenb commented 1 year ago
-m /usr3/graduate/warrenkb/Candidate_Genes_AA/manifest.txt
usr3/graduate/warrenkb/Candidate_Genes_AA/Human_Ancestral_Condition/ALKBH1_37.vcf 

first path starts with a '/' (full path) second is a relative path. Something is wrong here.

lindenb commented 1 year ago

Does my manifest have to be as a .mf or will a .txt file work

suffix is meaningless

lindenb commented 1 year ago

My VCF file is only a .vcf, not a .vcf.gz. Does that matter?

no

Warrenkevin commented 1 year ago

@lindenb Hi Pierre, thank you for that. I believe something may be wrong with my manifest?

I keep getting this error:

BUILD SUCCESSFUL in 47s 1 actionable task: 1 executed [warrenkb@scc1 jvarkit]$ java -jar dist/jvarkit.jar vcfancestralalleles \

-m /usr3/graduate/warrenkb/Candidate_Genes_AA/Human_Ancestral_Condition/Manifest.txt \ /usr3/graduate/warrenkb/Candidate_Genes_AA/Human_Ancestral_Condition/ALKBH1_37.vcf |\ bcftools annotate -x '^INFO/AA' [SEVERE][OnePassVcfLauncher]expected two columns

  • [1] "10|chr10� � ANCESTOR_for_chromosome:GRCh37:10: 77,662,404-77,718,023� � /usr3/graduate/warrenkb/Candidate_Genes_AA/Human_Ancestral_Condition_10.fa" com.github.lindenb.jvarkit.lang.JvarkitException$TokenErrors: expected two columns
  • [1] "10|chr10� � ANCESTOR_for_chromosome:GRCh37:10: 77,662,404-77,718,023� � /usr3/graduate/warrenkb/Candidate_Genes_AA/Human_Ancestral_Condition_10.fa" at com.github.lindenb.jvarkit.tools.onekgenomes.VcfAncestralAllele.loadManifest(VcfAncestralAllele.java:176) at com.github.lindenb.jvarkit.tools.onekgenomes.VcfAncestralAllele.beforeVcf(VcfAncestralAllele.java:298) at com.github.lindenb.jvarkit.jcommander.OnePassVcfLauncher.doWork(OnePassVcfLauncher.java:123) at com.github.lindenb.jvarkit.util.jcommander.Launcher.instanceMain(Launcher.java:819) at com.github.lindenb.jvarkit.util.jcommander.Launcher.instanceMainWithExit(Launcher.java:982) at com.github.lindenb.jvarkit.tools.onekgenomes.VcfAncestralAllele.main(VcfAncestralAllele.java:314) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at com.github.lindenb.jvarkit.tools.jvarkit.JvarkitCentral$Command.execute(JvarkitCentral.java:276) at com.github.lindenb.jvarkit.tools.jvarkit.JvarkitCentral.run(JvarkitCentral.java:749) at com.github.lindenb.jvarkit.tools.jvarkit.JvarkitCentral.main(JvarkitCentral.java:760) [INFO][Launcher]vcfancestralalleles Exited with failure (-1) Failed to read from standard input: unknown file type

Should I look to see how my manifest is created?

lindenb commented 1 year ago

attach your manifest in that issue please.

Warrenkevin commented 1 year ago

@lindenb Here is a copy of my manifest.

Manifest Example .txt

lindenb commented 1 year ago

this is a windows file.


file manifest.txt
manifest.txt: ISO-8859 text, with CRLF line terminators

not a text file, not a tab delimited file. https://unix.stackexchange.com/questions/108271/

Warrenkevin commented 1 year ago

@lindenb HI Pierre, my apologies, I uploaded the wrong one. This is the correct one. I am still running into the same issue. How I made the the file was in a text editor, converting it into plain text and then saving is as UTF-8. Is my Manifest still wrong?

Manifest_Example.zip

lindenb commented 1 year ago

it's not a tab delimited file. You used spaces. $ unzip -p tmp.zip Manifest_Example | tr " " "." 10|chr10 . .ANCESTOR_for_chromosome:GRCh37:10:.77,662,404-77,718,023 . ./usr3/graduate/warrenkb/Candidate_Genes_AA/Human_Ancestral_Condition_10.fa 14|chr14 . .ANCESTOR_for_chromosome:GRCh37:14:.53,939,736-53,968,761. ./usr3/graduate/warrenkb/Candidate_Genes_AA/Human_Ancestral_Condition_14.fa$

a return is missing for the last line and it's always a windows file ( CRLF line terminators )


~$ unzip -p tmp.zip  Manifest_Example | file -
/dev/stdin: Unicode text, UTF-8 text, with CRLF line terminators
Warrenkevin commented 1 year ago

@lindenb Hi Pierre, I believe I have fixed the issue (e.g., replaced the spaces with tabs):

Manifest_Example.zip

I wanted to share my code with you and the error that I keep getting. I recently changed the file name to mirror the .fa files and am getting the following error:

[SEVERE][VcfAncestralAllele]Cannot read non-existent file: file:///usr3/graduate/warrenkb/Candidate_Genes_AA/Human_Ancestral_Condition_10.fa htsjdk.samtools.SAMException: Cannot read non-existent file: file:///usr3/graduate/warrenkb/Candidate_Genes_AA/Human_Ancestral_Condition_10.fa

I was wondering is it because I changed the path and maybe the system has not caught up with it yet? Here is my code.

[warrenkb@scc1 human_ancestor]$ module load htslib/1.17 [warrenkb@scc1 human_ancestor]$ module load samtools/1.17 [warrenkb@scc1 human_ancestor]$ module load bcftools/1.17 [warrenkb@scc1 human_ancestor]$ module load java/17.0.8 [warrenkb@scc1 human_ancestor]$ cd jvarkit [warrenkb@scc1 jvarkit]$ java -jar dist/jvarkit.jar vcfancestralalleles \ -m /usr3/graduate/warrenkb/Candidate_Genes_AA/human_ancestor/Manifest_Example \ usr3/graduate/warrenkb/Candidate_Genes_AA/human_ancestor/ALKBH1_37.vcf |\ bcftools annotate -x '^INFO/AA'

Everything looks about right.

lindenb commented 1 year ago

what is the output of

ls /usr3/graduate/warrenkb/Candidate_Genes_AA/Human_Ancestral_Condition_10.fa

if it's "file not found", then the path is not correct...