Hi all,
Simple question, is it possible to run samtools index (or any of the samtools in fact) on multiple bam files at the same time from the command line? I tried samtools index *.bam
from within the directory with all more bam files stored and got the following error
Samtools-htslib-API: bam_index_build2() not yet implemented
Abort trap: 6
I also had a go at using ls *.bam | samtools index
which also didn't work. To note, my bam files are all co-ordinate sorted. I went through the pain of doing that one by one.
It would be especially useful to be able to use samtools on multiple files when it comes to filtering on MAPQ scores etc etc.
Any ideas?
Thanks Pierre I'll try it out. I already have GNU Parallel installed so I'll use that. And this should work for other samtools too?
And can I ask a naive newbie question? What is the '{}' doing specifically? What does it mean? I saw this in other posts and wasn't sure.
'{}' will be replaced by the filename.
And sorry to bug you again but I just tried the following command :-
in an effort to try out Parallel with a different samtool (I want to filter multiple bam files based on mapq score) and this happened and scared me....
I got reams and reams of stuff like this before terminal eventually stopped responding (I think it crashed)
I'm guessing that ain't normal??
because samtools view (not index as you asked) ouput bam to stdout. See the parallel manual for '{.}' and '{/}' etc...