I am using samtools mpileup over different regions:
samtools mpileup -Q 0 -l regions.bed reads.sort.bam > counts.txt
I would like to output for each region (in regions.bed) a separated file, so that results from different regions will be in different output files. Is there any possibility to do so without running a samtools command for each region separately?
Or is it possible to output results in different files for different .bam files without again running a loop for each file?
samtools mpileup -Q 0 -l chr1:1222454-1342444 reads1.sort.bam reads2.sort.bam > counts.txt