Select only primary alignments and you should get one per read.

On 3 July 2014 09:36, Zhao, Shanrong <shanrong.z...@pfizer.com> wrote:

>  For unmapped reads, I believe
>
> samtools view  *-f* 4 file.bam > unmapped.bam
>
>
>
> However, for mapped reads, the command line maybe not work properly unless
> “no multiple mapping read in BAM”.
>
> samtools view -F 4 file.bam > mapped.sam
>
>
>
> I assume samtools does not check whether a read is mapped to multiple
> locations. For pair-ended sequencing, the mapping is more complex. In
> addition to unmapped reads, a read pair can be uniquely mapped or multiple
> location. Likewise, for singleton, one read can be mapped to multiple
> locations or uniquely with its mate unapped.
>
>
>
> What I want is: extract mapped reads and write them into FASTQ files.  For
> multiple mapping reads, only write them once.  Any advice?
>
>
>
> Thank you,
>
> Shanrong
>
>
> ------------------------------------------------------------------------------
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft
> _______________________________________________
> Samtools-help mailing list
> Samtools-help@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/samtools-help
>
>
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Samtools-help mailing list
Samtools-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/samtools-help

Reply via email to