bioruby-samtools icon indicating copy to clipboard operation
bioruby-samtools copied to clipboard

index fails using samtools v1.0+ when providing .bai filename

Open ethering opened this issue 10 years ago • 4 comments

As documented here: http://sourceforge.net/p/samtools/mailman/message/32904732/ providing the SAMtools index method with an outfile name (e.g. 'samtools index aln.bam alignment.bai') causes an error.

Removing the code in test_sam.rb test_index() after #as above, but give the output a different name would fix the test, but a fix is needed in the method itself.

ethering avatar Feb 11 '15 13:02 ethering

So, I'm looking at the code and I could add an option to move the file after the option is set. Which is a bit patchy, but it could work. However, I'm wondering if that will be useful, given the current approach of samtools of having default names.

homonecloco avatar Feb 24 '15 14:02 homonecloco

Does SAMtools generate the .bai by default? Then use that unless a filename is given - so yes, implement an mv if providing a filename doesn't work.

danmaclean avatar Feb 24 '15 15:02 danmaclean

samtools generates a default name. It fails when you provide a name, but it generates a bai file, that only has the header, so it wasn't picked up by the unit tests (it just validates it existed before).

homonecloco avatar Feb 24 '15 15:02 homonecloco

Then I think your proposed fix is sensible - mv to the provided name if it is there, but dont pass the provided name to SAMtools. MonkeyPatch

danmaclean avatar Feb 24 '15 16:02 danmaclean