SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert BAM file to FASTQ malachig Bioinformatics 28 02-02-2016 03:04 AM
How to put header back to .bam file? eilosei Bioinformatics 6 02-06-2014 05:22 PM
Are there any good ways to use SAMtools java API to convert .bam file into .txt file? alextree Bioinformatics 8 01-24-2012 09:20 AM
Picard's SortSam error with a merged bam file tomato2 Bioinformatics 1 11-01-2011 09:18 PM
How to convert Eland file to BAM or SAM? fanshu Bioinformatics 0 10-30-2010 11:46 PM

Reply
 
Thread Tools
Old 09-28-2011, 07:40 AM   #1
danielsbrewer
Member
 
Location: UK

Join Date: Feb 2009
Posts: 29
Default 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?
danielsbrewer is offline   Reply With Quote
Old 09-28-2011, 12:49 PM   #2
gringer
David Eccles (gringer)
 
Location: Wellington, New Zealand

Join Date: May 2011
Posts: 821
Default

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.
gringer is offline   Reply With Quote
Old 09-28-2011, 01:09 PM   #3
Chipper
Senior Member
 
Location: Sweden

Join Date: Mar 2008
Posts: 324
Default

If the lane info is stored in RG tags you can use this: http://genome.sph.umich.edu/wiki/SplitBam
Chipper is offline   Reply With Quote
Old 09-29-2011, 12:50 AM   #4
danielsbrewer
Member
 
Location: UK

Join Date: Feb 2009
Posts: 29
Default

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 at 01:03 AM.
danielsbrewer is offline   Reply With Quote
Old 10-06-2011, 05:06 PM   #5
jtladner
Junior Member
 
Location: California

Join Date: Feb 2010
Posts: 3
Default 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
jtladner is offline   Reply With Quote
Old 10-07-2011, 05:17 AM   #6
kmcarr
Senior Member
 
Location: USA, Midwest

Join Date: May 2008
Posts: 1,150
Default

Quote:
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.
Quote:
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.
kmcarr is offline   Reply With Quote
Old 10-03-2013, 07:29 AM   #7
zebrafisch
Junior Member
 
Location: Greece

Join Date: Oct 2012
Posts: 2
Default

Quote:
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.
zebrafisch is offline   Reply With Quote
Reply

Tags
bam, convert, lane

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 05:59 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO