Changes

From Genome Analysis Wiki
Jump to navigationJump to search
2,556 bytes added ,  14:02, 2 September 2011
Update parameters
[[Category:BamUtil|writeRegion]]
[[Category:BAM Software]]
[[Category:Software]]

= Overview of the <code>writeRegion</code> function of <code>bamUtil</code> =
The <code>writeRegion</code> option on the [[bamUtil]] executable uses an indexed BAM file to only write the alignments that:
* fall within the region specified
** region as defined by <code>refID</code> or <code>refName</code> and <code>start</code> and/or <code>end</code>
** region as defined in the <code>bed</code> file
** overlapping or fully within if <code>--withinReg</code> is specified
* have a specific read name (if specified)

have a specific read name (if specified) and/or fall into the specified region (reference id and start/end position) by being either entirely within or overlapping the region depending on the parameters.

= Parameters =
<pre>
Required Parameters:
--in : the BAM file to be read
--out : the SAM/BAM file to write to
Optional Parameters:
--bamIndex : the path/name of the bam index file
(if not specified, uses the --in value + ".bai")
--refName : the BAM reference Name to read
Either this or refID can be specified.
Defaults to all references.
--refID : the BAM reference ID to read.
Either this or refName can be specified.
Defaults to all references.
Specify -1 for unmapped
--start : inclusive 0-based start position.
Defaults to -1: meaning from the start of the reference.
Only applicable if refName/refID is set.
--end : exclusive 0-based end position.
Defaults to -1: meaning til the end of the reference.
Only applicable if refName/refID is set.
--bed : use the specified bed file for regions.
--withinReg : only print reads fully enclosed within the region.
--readName : only print reads with this read name.
--params : print the parameter settings
--noeof : do not expect an EOF block on a bam file.
</pre>

= Usage =

./bam writeRegion --in <inputFilename> --out <outputFilename> [--bamIndex <bamIndexFile>] [--refName <reference Name> | --refID <reference ID>] [--start <0-based start pos>] [--end <0-based end psoition>] [--bed <bed filename>] [--withinRegion] [--readName <readName>] [--params] [--noeof]

= Return Value =
* 0: all records are successfully read and written.
* non-0: at least one record was not successfully read or written.

= Example Output =
<pre>

Wrote t.sam with 2 records.
</pre>

Navigation menu