Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I parse these reads

    Code:
    ::::::::::::::
    0H.ptFlagstat.txt
    ::::::::::::::
    49080460 + 0 in total 
    0 + 0 duplicates
    6444347 + 0 mapped (13.13%:nan%)
    49080460 + 0 paired in sequencing
    45547041 + 0 read1  
    3533419 + 0 read2   
    5822436 + 0 properly paired (11.86%:nan%)  ***
    5822436 + 0 with itself and mate mapped
    621911 + 0 singletons (1.27%:nan%)
    Good day.

    I would like to parse the paired reads (***) from PCR duplicates removed sorted BAM files. I knew SAMtools or Picard tools can do that, however, I'm not sure what function or what option I should use.

    Could anyone kindly please contribute the idea(s) or command line(s) or advice?

    Thank you very much.

  • #2
    PCR duplicates are marked in SAM/BAM as part of the read's FLAG entry (one of the bits).

    You can use 'samtools view' with the -f and/or -F switches to filter reads based on their FLAG values.

    By default 'samtools view' does BAM to SAM, but it can do SAM to SAM or BAM to BAM as well which is more sensible for filtering.

    Comment


    • #3
      What exactly are you trying to parse?

      You can use samtools view and filter by flags (-f or -F) to break out particular kinds of reads based ontheri flags. You can use samtools view to make a .sam, and pipe that straight into a program like awk or grep.

      Code:
      samtools view file.bam | grep whatever - > grepped.sam

      Comment


      • #4
        I want to exclude unmapped reads from the PCR duplicates removed BAM file (done by Picard MarkDuplicates tools) before carry on to downstream analysis. Thanks for the replied and suggestions. Appreciate that!

        Comment


        • #5
          Code:
          samtools view -bF 4 file.bam > mapped.bam
          will make a new .bam that has only mapped reads.

          the -F 4 means that it will exclude entries in your .bam that have the 4 flagged in the binary flag; 4 is the code for unmapped read. The -b means that it will output a .bam, instead of a .sam, which is the default behavior for samtools view.

          Comment


          • #6
            Thanks for the code and the explanation. Thanks a lot.

            Comment

            Latest Articles

            Collapse

            • seqadmin
              Advancing Precision Medicine for Rare Diseases in Children
              by seqadmin




              Many organizations study rare diseases, but few have a mission as impactful as Rady Children’s Institute for Genomic Medicine (RCIGM). “We are all about changing outcomes for children,” explained Dr. Stephen Kingsmore, President and CEO of the group. The institute’s initial goal was to provide rapid diagnoses for critically ill children and shorten their diagnostic odyssey, a term used to describe the long and arduous process it takes patients to obtain an accurate...
              12-16-2024, 07:57 AM
            • seqadmin
              Recent Advances in Sequencing Technologies
              by seqadmin



              Innovations in next-generation sequencing technologies and techniques are driving more precise and comprehensive exploration of complex biological systems. Current advancements include improved accessibility for long-read sequencing and significant progress in single-cell and 3D genomics. This article explores some of the most impactful developments in the field over the past year.

              Long-Read Sequencing
              Long-read sequencing has seen remarkable advancements,...
              12-02-2024, 01:49 PM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by seqadmin, 12-17-2024, 10:28 AM
            0 responses
            39 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 12-13-2024, 08:24 AM
            0 responses
            52 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 12-12-2024, 07:41 AM
            0 responses
            38 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 12-11-2024, 07:45 AM
            0 responses
            46 views
            0 likes
            Last Post seqadmin  
            Working...
            X