HMMRATAC icon indicating copy to clipboard operation
HMMRATAC copied to clipboard

BR: HMMRATAC doesn't run if samtools index made with multithreading

Open pratarora opened this issue 3 years ago • 2 comments

Hi

I was using HMMRATAC with the instructions provided, however, I found that the following error:

Exception in thread "main" java.lang.RuntimeException: Invalid file header in BAM index

This error has also been reported in issue #58. I eventually found out that I was making the index file by using multithreading in samtools. If I make the index without multithreading, HMMRATAC starts to work then.

Hope this helps.

Best Regards Prateek

pratarora avatar Mar 30 '21 07:03 pratarora

Thanks @pratarora !! Great catch!

EvanTarbell avatar Mar 30 '21 13:03 EvanTarbell

In the referenced issue it says that an index was created using: samtools index -@ 4 -m 2G /path/C1-F_sorted.bam /path/C1-F_sorted.bai > logs/C1-F_index.log

It should be noted 2 arguments are passed, one is the multi threading argument @ but also -m is passed. The help page says the following:

Usage: samtools index [-bc] [-m INT] <in.bam> [out.index]
Options:
  -b       Generate BAI-format index for BAM files [default]
  -c       Generate CSI-format index for BAM files
  -m INT   Set minimum interval size for CSI indices to 2^INT [14]
  -@ INT   Sets the number of threads [none]

Note that -m can only be used for CSI files. However the command used generates a bai file.

I tried to run the code by changing the above commend to generate a CSI file and everything worked perfectly. (after adding support to CSI files as mentioned in #96)

What this means: The problem is not in using the multi-threading tool but in using the -m option. This means this issue can be closed since it talks about improper use of samtools instead of an issue in HMMRATAC.

jitsedesmet avatar May 30 '22 09:05 jitsedesmet