I am trying to understand how to use samtools, and there is a little bit confusion.
I have one .BAM file which is 96 index is existed.
I can extract that specific index like below
samtool view -r B3 -b -o out.bam in.bam
[ Ref : Extract Bamfile using samtools ]
But I wonder if I want to use also Reference Name (fg, Reference name : A_01_01)
And Flag which is contain 0 or 16 . ( 0 mean Forward sequence and 16 mean Reverse sequence )
If I want to extract reference "A_01_01" and Flag 0 .
What is exactly command line I can use?
After that I can extract to fastq file using below command.
samtools bam2fq output.bam > output.fastq