This is a test version of Biostars. For the public version, visit https://www.biostars.org.
from unmapped bam file picard samtofastq produced no output

I generated bam of unmapped reads using:

$ samtools view -b -f 4 input.bam >unmapped.bam

$ samtools flagstat unmapped.bam

2313037 + 4694809 in total (QC-passed reads + QC-failed reads) 0 + 0 secondary 0 + 0 supplementary 0 + 0 duplicates 0 + 0 mapped (0.00%:0.00%) 2313037 + 4694809 paired in sequencing 750304 + 2057201 read1 1562733 + 2637608 read2 0 + 0 properly paired (0.00%:0.00%) 0 + 0 with itself and mate mapped 0 + 0 singletons (0.00%:0.00%) 0 + 0 with mate mapped to a different chr 0 + 0 with mate mapped to a different chr (mapQ>=5)

$ samtools view unmapped.bam | head -3

HS9_357:1:2102:12947:42607 629 chr1 10537 0 * = 10537 0 AGGCGGAGCAGGGGGCTCCTCAGATGATGATTATTCCCCACCTTCTAAGAGAAAAAGACCAACGACCCACCACAG <<8<>;;;=896367???>=?>;8)?>???><351???>:>?>?::199BEC<

However, when I use

$ bedtool bamtobed -i unmapped.bam

or

$ picard samtofastq I=unmapped.bam F=R1.fastq F2=R2.fastq FU=unmapped.fastq

, they do not print any output.

I am not sure why this is happening, any suggestion will be very useful.

rna-seq picard bedtools

1 answer

This link might be helpful samtools extract unmapped reads

Log in to answer this question.