Entering edit mode
4.4 years ago
Bioinfonext
▴
460
Hi,
I do have multiple pair end sam files. I am thinking to use below command to extract unmapped read from all sam files to bam files by using below command and after this I am trying to use reformat.sh from bbtools to extract the unmapped read pair from bam file.
Is there any way to run the reformat.sh on all unmapped bam files to extract the pair end reads or any other best way to do it.
ls *.sam | xargs -n 1 -I {} sh -c 'samtools view -f 4 -b {} > {}.bam'
reformat.sh in=x.bam out=z.fq unmappedonly primaryonly
thanks nabiyogesh
Why not try something like (BTW: I am using your command line above which appears to be incorrect). Reformat.sh should work with SAM files as well so you don't need to convert them just for this.
Hi Genomax,
thanks for your all help. above command seems very confusing for me as it only generate a single fastq files if I run it on sam file as well.
instead of this I am using the below three command in loop command one by one as suggest by you earlier: if I come across any issue, will let you know.
~
Thanks nabiyogesh
As I said in my earlier comment the command you had was what I reused. It was not correct, if you had paired end data.
You will need to use for that case: