Difference between revisions of "BamUtil: bam2FastQ"
From Genome Analysis Wiki
Jump to navigationJump to searchLine 10: | Line 10: | ||
Output FastQ Files | Output FastQ Files | ||
Output : --first [], --second [], --single [] | Output : --first [], --second [], --single [] | ||
+ | |||
+ | Required parameter | ||
+ | -i InputBAM/SAM | ||
+ | |||
+ | Optional parameters for output (however either --single or both --first and --second have to be provided) | ||
+ | --first firstReadInAPair_FastQ | ||
+ | --second secondReadInAPair_FastQ | ||
+ | --single 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 myinout.sortByName.bam | ||
+ | |||
+ | 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 | ||
+ | |||
+ | bam2FastQ -i myinput.sortByName.BAM --first myread1.fastQ --second myread2.fastQ --single myreadSingle.fastQ | ||
+ | |||
+ | Or using bam (sorted or not) file to extract single end fastq files | ||
+ | |||
+ | bam2FastQ -i myinput.sortByName.BAM --single myreadSingle.fastQ |
Revision as of 16:07, 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 [], --single []
Required parameter
-i InputBAM/SAM
Optional parameters for output (however either --single or both --first and --second have to be provided)
--first firstReadInAPair_FastQ --second secondReadInAPair_FastQ --single 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 myinout.sortByName.bam
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
bam2FastQ -i myinput.sortByName.BAM --first myread1.fastQ --second myread2.fastQ --single myreadSingle.fastQ
Or using bam (sorted or not) file to extract single end fastq files
bam2FastQ -i myinput.sortByName.BAM --single myreadSingle.fastQ