Chain objects
A Chain
object represents a UCSC chain alignment, typically
imported from a chain
file, and is essentially a list of
ChainBlock
objects. Each ChainBlock
has a corresponding
chromosome (its name in the list) and is a run-length
encoded alignment, mapping a set of intervals on that chromosome to
intervals on the same or other chromosomes.
In the code snippets below, x
and object
are
ChainBlock
objects.
ranges(x)
:
Get the IntegerRanges
object holding
the starts and ends of the "from" ranges. Each range is a
contiguous block of positions aligned without gaps to the other
sequence.
offset(x)
: Integer offset from the "from" start to the
"end" start (which could be in another chromosome).
score(x)
: The score for each mapping.
space(x)
: The space (chromosome) of the "to" range.
reversed(x)
: Whether the mapping inverts the region, i.e.,
the alignment is between different strands.
A Chain
object can be loaded from a UCSC chain format file
simply by passing the path import
function. If the file
extension is not “chain”, then either pass “chain” to
the format
argument, or cast the path to a ChainFile
object. The import.chain
function is provided as a (slight)
convenience. It is documented below, along with the extra
exclude
argument to the import
method.
import.chain(con, exclude = "_", ...)
:
Imports a chain file named con
as a Chain
object, a
list of ChainBlock
s. Alignments for chromosomes matching the
exclude
pattern are not imported.
A chain file essentially details many local alignments, so it is possible for the "from" ranges to map to overlapping regions in the other sequence. The "from" ranges are guaranteed to be disjoint (but do not necessarily cover the entire "from" sequence).
Michael Lawrence
liftOver
for performing lift overs using a chain alignment
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.