rjpbonnal / bioruby-samtools

Porting of samtools-ruby to BioRuby. Binder of samtools for ruby, on the top of FFI -from original project-
Other
33 stars 23 forks source link

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

Open ethering opened 9 years ago

ethering commented 9 years ago

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.

homonecloco commented 9 years ago

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.

danmaclean commented 9 years ago

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.

homonecloco commented 9 years ago

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).

danmaclean commented 9 years ago

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