dpuiu / MitoHPC

MIT License
10 stars 12 forks source link

--write-index not a valid command #8

Open RogueRussell opened 1 year ago

RogueRussell commented 1 year ago

In the filter.sh script, there is a step that calls for samtools sort --write-index. However, for newer versions of samtools sort, --write-index is not a valid option and the samtools manual says to use samtools index to create an index. I just removed the --write-index options in the filter.sh script and added a samtools index step right after that. It ran successfully after that.

I'm creating an issue regarding this in case anyone else runs into the same problem as me. Maybe the filter.sh script can be changed to reflect this. If not, it is a simple enough fix on the users end.

Thanks for the great pipeline. Much appreciated.

dpuiu commented 1 year ago

Hi RogueRussell , and thank you for your report on MitoHPC.

I've just installed and tested the latest version of samtools (1.17) It looks like "samtools sort --write-index" is still a valid option, though for some reason is not documented in the official online manual : http://www.htslib.org/doc/samtools-sort.html

##################################################################################################

$ samtools --version | head -1 samtools 1.17

$ samtools sort Options: ... --write-index Automatically index the output files [off]

$ samtools index Options: -b Generate BAI-format index for BAM files [default] -c Generate CSI-format index for BAM files ... ##################################################################################################

"samtoosl sort --write-index" only generates CSI-format indexes, so, as you said, it is better to run "samtools index" afterwards. I will implement the change in the next release.

RogueRussell commented 1 year ago

You are absolutely correct. The new samtools does have that option. I did a little digging and realized I have an older version of samtools (1.9) which did not have the --write-index option. I assumed that since 1.9 is higher than 1.17, that it was a newer version - but apparently they changed the numbering after version 1.9, and 1.9 is actually relatively outdated (2018). You're right, it isn't in the manual, but they did add in --write-index after 1.9. My apologies! So this is still a good lesson for anyone running this on an older version of bedtools and runs into this issue. Thanks again!