Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • strand-specific bam files

    Hello all,

    I know this must be a very simple and common task, sorry if I've overlooked an existing recommendation while searching the forum.

    Given: BAM file with aligned paired-end reads
    Needed: split it into 2 strand-specific BAM files (first read in each aligned pair should correspond to F strand of the reference in the first BAM file and to the R strand of the reference in the second BAM file).

    Thanks a lot!

  • #2
    Look at the samtools view -f and -F options, you could do this by filtering on the FLAG 0x10 values.

    (If you have paired data things are more interesting...)

    Comment


    • #3
      Originally posted by maubp View Post
      Look at the samtools view -f and -F options, you could do this by filtering on the FLAG 0x10 values.

      (If you have paired data things are more interesting...)
      I believe the FLAG relates to an individual read, right? My first BAM file needs to have first reads aligned to F and second reads to R of the reference. I cannot believe there is no standard solution for this task (that is supposed to be popular in downstream analysis) for paired-end data that is overwhelmingly popular now... Is this indeed the case?

      Comment


      • #4
        I don't know why you would want to do (what popular downstream analysis exactly?), but you could do this with 'samtools view' and the FLAG filters.

        Before spending any effort on this, please clarify if you want file one to have reads like this:

        Code:
               1 ---> 
        =========================
                       <--- 2
        And file two to have:

        Code:
               2 ---> 
        =========================
                       <--- 1

        Comment


        • #5
          Originally posted by maubp View Post
          I don't know why you would want to do (what popular downstream analysis exactly?), but you could do this with 'samtools view' and the FLAG filters.

          Before spending any effort on this, please clarify if you want file one to have reads like this:

          Code:
                 1 ---> 
          =========================
                         <--- 2
          And file two to have:

          Code:
                 2 ---> 
          =========================
                         <--- 1

          Thank you,

          Yes, that's exactly the desired outcome.
          As to downstream analysis, I am talking about investigating on antisense transcription phenomena (given a strand-specific library), which is going to be increasingly popular down the road. Thanks a lot!

          Comment


          • #6
            Put the reads with flags of 99 (read 1, mapped forward, mate mapped reverse, properly paired) and 147(read 2, mapped reverse, properly paired) in file 1, and the reads with flags 83 and 163 in file 2.

            Comment


            • #7
              I concur file one needs:

              0x1 - paired
              0x2 - properly paired
              0x20 - partner on reverse strand
              0x40 - read one
              FLAGs 0x1 + 0x2 + 0x20 + 0x40 = 0x63 = 99 in decimal

              And file one also needs:

              0x1 - paired
              0x2 - properly paired
              0x10 - on reverse strand
              0x80 - read two
              FLAGs 0x1 + 0x2 + 0x10 + 0x80 = 0x93 = 147 in decimal

              So I'd use 'samtools view' twice to get those reads, then 'samtools merge' to combine them into file one.

              Likewise for file two:

              0x1 - paired
              0x2 - properly paired
              0x10 - reverse strand
              0x40 - read one
              FLAGs 0x1 + 0x2 + 0x10 + 0x40 = 0x53 = 83 in decimal

              And file two also needs:

              0x1 - paired
              0x2 - properly paired
              0x30 - partner on reverse strand
              0x80 - read two
              FLAGs 0x1 + 0x2 + 0x20 + 0x80 = 0xA3 = 163 in decimal

              Comment


              • #8
                Originally posted by maubp View Post
                I concur file one needs:

                0x1 - paired
                0x2 - properly paired
                0x20 - partner on reverse strand
                0x40 - read one
                FLAGs 0x1 + 0x2 + 0x20 + 0x40 = 0x63 = 99 in decimal

                And file one also needs:

                0x1 - paired
                0x2 - properly paired
                0x10 - on reverse strand
                0x80 - read two
                FLAGs 0x1 + 0x2 + 0x10 + 0x80 = 0x93 = 147 in decimal

                So I'd use 'samtools view' twice to get those reads, then 'samtools merge' to combine them into file one.

                Likewise for file two:

                0x1 - paired
                0x2 - properly paired
                0x10 - reverse strand
                0x40 - read one
                FLAGs 0x1 + 0x2 + 0x10 + 0x40 = 0x53 = 83 in decimal

                And file two also needs:

                0x1 - paired
                0x2 - properly paired
                0x30 - partner on reverse strand
                0x80 - read two
                FLAGs 0x1 + 0x2 + 0x20 + 0x80 = 0xA3 = 163 in decimal
                Thank you! That's outstanding!

                Comment

                Latest Articles

                Collapse

                • seqadmin
                  Latest Developments in Precision Medicine
                  by seqadmin



                  Technological advances have led to drastic improvements in the field of precision medicine, enabling more personalized approaches to treatment. This article explores four leading groups that are overcoming many of the challenges of genomic profiling and precision medicine through their innovative platforms and technologies.

                  Somatic Genomics
                  “We have such a tremendous amount of genetic diversity that exists within each of us, and not just between us as individuals,”...
                  05-24-2024, 01:16 PM
                • seqadmin
                  Recent Advances in Sequencing Analysis Tools
                  by seqadmin


                  The sequencing world is rapidly changing due to declining costs, enhanced accuracies, and the advent of newer, cutting-edge instruments. Equally important to these developments are improvements in sequencing analysis, a process that converts vast amounts of raw data into a comprehensible and meaningful form. This complex task requires expertise and the right analysis tools. In this article, we highlight the progress and innovation in sequencing analysis by reviewing several of the...
                  05-06-2024, 07:48 AM

                ad_right_rmr

                Collapse

                News

                Collapse

                Topics Statistics Last Post
                Started by seqadmin, 05-24-2024, 07:15 AM
                0 responses
                123 views
                0 likes
                Last Post seqadmin  
                Started by seqadmin, 05-23-2024, 10:28 AM
                0 responses
                134 views
                0 likes
                Last Post seqadmin  
                Started by seqadmin, 05-23-2024, 07:35 AM
                0 responses
                134 views
                0 likes
                Last Post seqadmin  
                Started by seqadmin, 05-22-2024, 02:06 PM
                0 responses
                11 views
                0 likes
                Last Post seqadmin  
                Working...
                X