lindenb / jvarkit

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

[INFO][Launcher]bamstats04 Exited with failure (-1): bam is not indexed #123

Closed innagsc closed 4 years ago

innagsc commented 5 years ago

Verify

Subject of the issue

My input is a .bed file with exons and a .bam file

Your environment

Steps to reproduce

My command: java -jar dist/bamstats04.jar -B /path/to/.bed /pth/to/.bam

Expected behaviour

Get statistics (mean, max, median and min)

Actual behaviour

[INFO][BamStats04]/path/to/bam [SEVERE][BamStats04]/path/to/bam is not indexed [INFO][Launcher]bamstats04 Exited with failure (-1)

I used samtools to get .bai file. Tried to run it and got the same error. What is wrong?

Thanks :)

lindenb commented 5 years ago

what is the output of

ls -lah /pth/to/*.ba*

innagsc commented 5 years ago

-rw-rw-r-- 1 user group 11G Mar 28 09:51 /pth/to/.ba

lindenb commented 5 years ago

there is no bam file.

what is that .ba file ? whith a prefix '.' it's a hidden file ?

where is the bai file ?

innagsc commented 5 years ago

Sorry, this is the correct output: -rw-rw-r-- 1 user group 11G Mar 28 09:51 path/to/.bam -rw-rw-r-- 1 user group 7.1M Mar 28 14:27 /path/to/.bam.bai

lindenb commented 5 years ago

there is a "bam.bai' but no '.bam.bai' (dot prefix)

innagsc commented 5 years ago

.bam and .bam.bai are located in the same directory

lindenb commented 5 years ago

that's a very unusual way to name a file. Please set a valid filename.

mv path/to/.bam path/to/f.bam
mv path/to/.bam.bai path/to/f.bam.bai

and retry.

innagsc commented 5 years ago

Sorry, I probably didn't explain it well. My files are named: path/to/f.bam and path/to/f.bam.bai. And unfortunately, I am still having the same problem.

lindenb commented 5 years ago

there are some test data in the jvarkit directory. src/test/resources/

what happens when you're trying to use those files; Try:

$ java -jar dist/bamstats04.jar -B <(echo -e "RF01\t10\t20") src/test/resources/S1.bam
#chrom  start   end length  sample  mincov  maxcov  avgcov_0    mediancov_0 nocoveragebp_0  percentcovered_0
RF01    10  20  10  S1  3   4   3.9 4.0 0   100