Arguments

...

Additional arguments.

For BamFileList, this can either be a single character vector
of paths to BAM files, or several instances of BamFile
objects. When a character vector of paths, a second named argument
‘index’ can be a character() vector of length equal to
the first argument specifying the paths to the index files, or
character() to indicate that no index file is available. See
BamFile.

con

An instance of BamFile.

x, object, file, files

A character vector of BAM file paths
(for BamFile) or a BamFile instance (for other
methods).

index

character(1); the BAM index file path (for
BamFile); ignored for all other methods on this page.

yieldSize

Number of records to yield each time the file
is read from with scanBam. See ‘Fields’
section for details.

asMates

Logical indicating if records should be paired
as mates. See ‘Fields’ section for details.

qnamePrefixEnd

Single character (or NA) marking the
end of the qname prefix. When specified, all characters prior to
and including the qnamePrefixEnd are removed from the qname.
If the prefix is not found in the qname the qname is not trimmed.
Currently only implemented for mate-pairing (i.e., when
asMates=TRUE in a BamFile.

qnameSuffixStart

Single character (or NA) marking the
start of the qname suffix. When specified, all characters following
and including the qnameSuffixStart are removed from the qname.
If the suffix is not found in the qname the qname is not trimmmed.
Currently only implemented for mate-pairing (i.e., when
asMates=TRUE in a BamFile.

obeyQname

Logical indicating if the BAM file is sorted
by qname. In Bioconductor > 2.12 paired-end files do
not need to be sorted by qname. Instead use
asMates=TRUE for reading paired-end data. See
‘Fields’ section for details.

value

Logical value for setting asMates and
obeyQname in a BamFile instance.

what

For scanBamHeader, a character vector specifying
that either or both of c("targets", "text") are to be
extracted from the header; see scanBam for
additional detail.

filter

A FilterRules instance. Functions in the
FilterRules instance should expect a single DataFrame
argument representing all information specified by
param. Each function must return a logical vector,
usually of length equal to the number of rows of the
DataFrame. Return values are used to include (when
TRUE) corresponding records in the filtered BAM file.

destination

character(1) file path to write filtered reads to.

indexDestination

logical(1) indicating whether the destination
file should also be indexed.

byQname, maxMemory

See sortBam.

param

An optional ScanBamParam instance to
further influence scanning, counting, or filtering.

rw

Mode of file; ignored.

main.groups.only

See quickBamFlagSummary.

Objects from the Class

Objects are created by calls of the form BamFile().

Fields

The BamFile class inherits fields from the
RsamtoolsFile class and has fields:

yieldSize:

Number of records to yield each time the file is
read from using scanBam or, when length(bamWhich())
!= 0, a threshold which yields records in complete ranges whose
sum first exceeds yieldSize. Setting yieldSize on a
BamFileList does not alter existing yield sizes set on the
individual BamFile instances.

asMates:

A logical indicating if the records should be
returned as mated pairs. When TRUEscanBam attempts
to mate (pair) the records and returns two additional fields
groupid and mate_status. groupid is an integer
vector of unique group ids; mate_status is a factor with level
mated for records successfully paired by the algorithm,
ambiguous for records that are possibly mates but cannot be
assigned unambiguously, or unmated for reads that did not
have valid mates.

Mate criteria:

Bit 0x40 and 0x80: Segments are a pair of first/last OR
neither segment is marked first/last

Flags, tags and ranges may be specified in the ScanBamParam
for fine tuning of results.

obeyQname:

A logical(0) indicating if the file was sorted by
qname. In Bioconductor > 2.12 paired-end files do not need to be
sorted by qname. Instead set asMates=TRUE in the
BamFile when using the readGAlignmentsList
function from the GenomicAlignments package.

Return or set a logical(0)
indicating if the file was sorted by qname.

asMates, asMates<-

Return or set a logical(0)
indicating if the records should be returned as mated pairs.

Methods:

scanBamHeader

Visit the path in path(file), returning
the information contained in the file header; see
scanBamHeader.

seqinfo, seqnames, seqlength

Visit the path in
path(file), returning a Seqinfo,
character, or named integer vector containing information on the
anmes and / or lengths of each sequence. Seqnames are ordered
as they appear in the file.

scanBam

Visit the path in path(file), returning the
result of scanBam applied to the specified path.

countBam

Visit the path(s) in path(file), returning
the result of countBam applied to the specified
path.

idxstatsBam

Visit the index in index(file), quickly
returning a data.frame with columns seqnames,
seqlength, mapped (number of mapped reads on
seqnames) and unmapped (number of unmapped reads).

filterBam

Visit the path in path(file), returning the
result of filterBam applied to the specified
path. A single file can be filtered to one or several
destinations, as described in filterBam.

indexBam

Visit the path in path(file), returning
the result of indexBam applied to the specified
path.

sortBam

Visit the path in path(file), returning the
result of sortBam applied to the specified path.

mergeBam

Merge several BAM files into a single BAM file. See
mergeBam for details; additional arguments supported
by mergeBam,character-method are also available for
BamFileList.

show

Compactly display the object.

Author(s)

Martin Morgan and Marc Carlson

See Also

The readGAlignments,
readGAlignmentPairs,
and readGAlignmentsList
functions defined in the GenomicAlignments package.

summarizeOverlaps and
findSpliceOverlaps-methods in the
GenomicAlignments package for methods that work on a
BamFile and BamFileList objects.