Question: Picard MergeSam error : Cannot use index file with textual SAM file
0
gravatar for Apoorva
3.5 years ago by
Apoorva260
United States
Apoorva260 wrote:

I tried to run a simple mergesam using picard on two bam files using the following command

java -jar /opt/picard/picard.jar MergeSamFiles I=file1.bam I=file2.bam O=merged_output.bam USE_THREADING=TRUE

This is giving me the following error

Exception in thread "main" java.lang.RuntimeException: **Cannot use index file with textual SAM file**
    at htsjdk.samtools.SamReaderFactory$SamReaderFactoryImpl.open(SamReaderFactory.java:317)
    at htsjdk.samtools.SamReaderFactory$SamReaderFactoryImpl.open(SamReaderFactory.java:145)
    at picard.sam.MergeSamFiles.doWork(MergeSamFiles.java:142)
    at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:208)
    at picard.cmdline.PicardCommandLine.instanceMain(PicardCommandLine.java:95)

What does it mean and how do I fix it ?

Thanks

mergesam picard • 2.2k views
ADD COMMENTlink modified 3.5 years ago • written 3.5 years ago by Apoorva260

Figured it out. I only had a partial bam file. Once i downloaded it again, MergeSam ran perfectly. Easy solution to a very silly problem.

Thanks for your time Pierre.

ADD REPLYlink written 3.5 years ago by Apoorva260

if it answered your question, click on the green mark near my answer to close the post.

ADD REPLYlink written 3.5 years ago by Pierre Lindenbaum130k
2
gravatar for Pierre Lindenbaum
3.5 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum130k wrote:

can your please run the following command:

file file1.bam file2.bam

it should return:

gzip compressed data, extra field

if not (eg: ASCII text) your files are SAM but not BAM.

if not, I suggest your update your version of picard because there is no such method SamReaderFactoryImpl.openat line 317. https://github.com/samtools/htsjdk/blob/master/src/main/java/htsjdk/samtools/SamReaderFactory.java#L317

ADD COMMENTlink written 3.5 years ago by Pierre Lindenbaum130k

Thank you. I tried the command and I got this

file1.bam: gzip compressed data, extra field

file2.bam: data

Does this mean my file2 is a SAM file ?

ADD REPLYlink modified 3.5 years ago • written 3.5 years ago by Apoorva260

mean my file2 is a SAM file

try head file2.bamor hexdump -c file2.bam | head to see if you can guess the format...

ADD REPLYlink written 3.5 years ago by Pierre Lindenbaum130k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1155 users visited in the last hour