annotateGRLfromGRL: Annotate GRangesList from GRangesList objects

annotateGRLfromGRLR Documentation

Annotate GRangesList from GRangesList objects

Description

Annotate GRangesList from GRangesList objects

Usage

annotateGRLfromGRL(
  GRL1,
  GRL2,
  annoName1 = "name",
  annoName2 = "name",
  grlOL = NULL,
  add_grl_name = FALSE,
  returnType = c("GRL", "GR"),
  splitColname = annoName1,
  verbose = FALSE,
  ...
)

Arguments

GRL1

GRangesList query

GRL2

GRangesList subject, used to add annotations to GRL1

annoName1

character value indicating either the colname of values(GRL1) to use as the name, or if "name" then it uses names(GRL1).

annoName2

character value indicating either the colname of values(GRL2) to use as the name, or if "name" then it uses names(GRL2).

grlOL

overlap result (optional) from GenomicRanges::findOverlaps() for these same GRangesList objects, used to save time by not re-running GenomicRanges::findOverlaps() again.

add_grl_name

logical indicating whether to add the names of each GRangesList object to the output object, useful for tracking the annotations to the source data.

returnType

character value indicating whether to return GRangesList "GRL" or GRange "GR" object.

splitColname

character value used internally to indicate how to split the resulting GRanges annotated data back to GRangesList. Almost always, this value should be identical to annoName1 which will split the resulting GRanges back into the identical input GRangesList.

verbose

logical indicating whether to print verbose output.

...

additional arguments are passed to annotateGRfromGR(). To customize the aggregation functions, supply numShrinkFunc or stringShrinkFunc as described in annotateGRfromGR().

Details

This function extends annotateGRfromGR() for the special case of GRangesList objects. It requires both GRangesList objects have identical length, and assumes both are in equivalent order. It then restricts all overlapping annotations to those where the query and subject are the same original GRangesList index.

This function is particularly useful following an operation on a GRangesList object that otherwise removes all annotations in values(GRL1), for example GenomicRanges::reduce() or GenomicRanges::flank(). This function can be used to re-annotate the resulting features using the original GRangesList object.

Note that annotations are added at the level of individual GRanges entries, equivalent to values(GRL1@unlistData). This function does not currently apply annotations at the GRangesList level, thus it does not use values(GRL2) if they exist.

Value

GRangesList object with the same length and lengths as the input GRL1, with annotation columns added from GRL2.

See Also

Other jam GRanges functions: addGRLgaps(), addGRgaps(), annotateGRfromGR(), assignGRLexonNames(), closestExonToJunctions(), combineGRcoverage(), exoncov2polygon(), findOverlapsGRL(), flattenExonsBy(), getFirstStrandedFromGRL(), getGRLgaps(), getGRcoverageFromBw(), getGRgaps(), grl2df(), jam_isDisjoint(), make_ref2compressed(), sortGRL(), spliceGR2junctionDF(), stackJunctions()

Examples

gr12 <- GenomicRanges::GRanges(
   seqnames=rep(c("chr1", "chr2", "chr1"), c(3,3,3)),
   ranges=IRanges::IRanges(
      start=c(100, 200, 400, 500, 300, 100, 200, 400, 600),
      width=c(100,150,50, 50,50,100, 50,200,50)
   ),
   strand=rep(c("+", "-", "+"), c(3,3,3)),
   gene_name=rep(c("GeneA", "GeneB", "GeneC"), each=3)
)

# Now split into GRangesList
grl1 <- GenomicRanges::split(gr12[,0],
   GenomicRanges::values(gr12)$gene_name);
grl2 <- GenomicRanges::split(gr12,
   GenomicRanges::values(gr12)$gene_name);

# The first object is a GRangesList with no annotations
grl1;

# The second object is a GRangesList with annotation,
# assumed to be in the same order
grl2;

annotateGRLfromGRL(grl1, grl2);


jmw86069/splicejam documentation built on Dec. 9, 2022, midnight