Difference between revisions of "BamUtil: writeRegion"

From Genome Analysis Wiki
Jump to: navigation, search
(Update parameters)
(No difference)

Revision as of 13:02, 2 September 2011


Overview of the writeRegion function of bamUtil

The writeRegion 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 refID or refName and start and/or end
    • region as defined in the bed file
    • overlapping or fully within if --withinReg 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

	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.

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


Wrote t.sam with 2 records.