Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • Convert merged BAM back to per lane BAM or FASTQ file

    I have got some illumina data in a a merged BAM file for a particular sample and I would like to convert it back to per lane data files (BAM or fastq) so it would be compatible with the analysis pipeline. Any ideas on the best way to do this?

  • #2
    When I did this a few days ago (with only knowledge of command-line stuff and samtools), here's a rough guide to what I did:
    1. Extract header from BAM file
      Code:
      samtools view -H infile.bam > header.sam
    2. filter out lanes from BAM file, add header
      Code:
      (cat header.sam; samtools view infile.bam | grep '^DATA...._<lane>_.') > out_lane<lane>.sam
    3. convert SAM to BAM
      Code:
      samtools view -S out_lane<lane>.sam -b > out_lane<lane>.bam


    There's probably some better way, but it would have taken longer for me to find than for me to just do it and deal with the additional overhead of storing temporary SAM files per lane.

    Comment


    • #3
      If the lane info is stored in RG tags you can use this: http://genome.sph.umich.edu/wiki/SplitBam

      Comment


      • #4
        SplitBam looks ideal, but I can't find a download link for it. Any ideas?

        And thanks for the other suggestion too, that makes a lot of sense.

        --EDIT--
        Actually it looks like there are no @RG in the headers ... Oh Dear.
        Last edited by danielsbrewer; 09-29-2011, 01:03 AM.

        Comment


        • #5
          SplitBam download link?

          I am trying to do the exact same thing and I do have @RG tags, but I can not find a download link for SplitBam. Does anyone know how to download this program?

          Jason

          Comment


          • #6
            Originally posted by danielsbrewer View Post
            SplitBam looks ideal, but I can't find a download link for it. Any ideas?

            And thanks for the other suggestion too, that makes a lot of sense.

            --EDIT--
            Actually it looks like there are no @RG in the headers ... Oh Dear.
            Originally posted by jtladner View Post
            I am trying to do the exact same thing and I do have @RG tags, but I can not find a download link for SplitBam. Does anyone know how to download this program?

            Jason
            Go here and either follow the instructions for retrieving the current development release from the source repository or download the tarball for the latest stable realese (0.1.4). Note that either way you are downloading the entire libStatGen toolkit, which you must then compile. SplitBam is merely one of the programs in the toolkit.

            Comment


            • #7
              Originally posted by jtladner View Post
              I am trying to do the exact same thing and I do have @RG tags, but I can not find a download link for SplitBam. Does anyone know how to download this program?

              Jason


              splitBam is part of the bamUtil package, which i found it here https://github.com/Homebrew/homebrew-science and it was very easy to download it.

              Comment

              Latest Articles

              Collapse

              • seqadmin
                New Genomics Tools and Methods Shared at AGBT 2025
                by seqadmin


                This year’s Advances in Genome Biology and Technology (AGBT) General Meeting commemorated the 25th anniversary of the event at its original venue on Marco Island, Florida. While this year’s event didn’t include high-profile musical performances, the industry announcements and cutting-edge research still drew the attention of leading scientists.

                The Headliner
                The biggest announcement was Roche stepping back into the sequencing platform market. In the years since...
                03-03-2025, 01:39 PM
              • seqadmin
                Investigating the Gut Microbiome Through Diet and Spatial Biology
                by seqadmin




                The human gut contains trillions of microorganisms that impact digestion, immune functions, and overall health1. Despite major breakthroughs, we’re only beginning to understand the full extent of the microbiome’s influence on health and disease. Advances in next-generation sequencing and spatial biology have opened new windows into this complex environment, yet many questions remain. This article highlights two recent studies exploring how diet influences microbial...
                02-24-2025, 06:31 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by seqadmin, Yesterday, 12:50 PM
              0 responses
              11 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 03-03-2025, 01:15 PM
              0 responses
              182 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 02-28-2025, 12:58 PM
              0 responses
              278 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 02-24-2025, 02:48 PM
              0 responses
              664 views
              0 likes
              Last Post seqadmin  
              Working...
              X