Difference between revisions of "BamUtil: bam2FastQ"
Line 17: | Line 17: | ||
--first firstReadInAPair_FastQ | --first firstReadInAPair_FastQ | ||
--second secondReadInAPair_FastQ | --second secondReadInAPair_FastQ | ||
− | -- | + | --unpaired unpairedReads_FastQ |
In order to extract paired end reads, the BAM file has to be sorted by name, e.g. using samtools. Suppose the BAM file is myinput.bam | In order to extract paired end reads, the BAM file has to be sorted by name, e.g. using samtools. Suppose the BAM file is myinput.bam |
Revision as of 17:17, 18 March 2010
Purpose
This converts a BAM file into FastQ files. This is necessary when only BAM files are delivered but a new alignment is desired. By converting BAM to FastQ files new alignments can be done using FastQ files
How to use it
When bam2FastQ is invoked without any arguments the following information is displayed
The following parameters are in effect: Input BAM/SAM File : (-iname) Output FastQ Files Output : --first [], --second [], --unpaired []
Required parameter
-i InputBAM/SAM
Optional parameters for output (however either --unpaired is present or both --first and --second are provided)
--first firstReadInAPair_FastQ --second secondReadInAPair_FastQ --unpaired unpairedReads_FastQ
In order to extract paired end reads, the BAM file has to be sorted by name, e.g. using samtools. Suppose the BAM file is myinput.bam
samtools sort -n myinput.bam myinput.sortByName
Using sorted bam file to extract paired end fastq files
bam2FastQ -i myinput.sortByName.BAM --first myread1.fastQ --second myread2.fastQ
Or to extract both paired end and single end fastq files (if the bam file contains both single and paired end reads)
bam2FastQ -i myinput.sortByName.BAM --first myread1.fastQ --second myread2.fastQ --unpaired myreadSingle.fastQ
Or using bam (sorted or not) file to extract single end fastq files
bam2FastQ -i myinput.sortByName.BAM --unpaired myreadSingle.fastQ