ssvAnnotateSubjectGRanges: ssvAnnotateSubjectGRanges

ssvAnnotateSubjectGRangesR Documentation

ssvAnnotateSubjectGRanges

Description

ssvAnnotateSubjectGRanges

Usage

ssvAnnotateSubjectGRanges(
  annotation_source,
  subject_gr,
  annotation_name = NULL,
  multi_resolver_FUN = "default"
)

## S4 method for signature 'GRanges'
ssvAnnotateSubjectGRanges(
  annotation_source,
  subject_gr,
  annotation_name = NULL,
  multi_resolver_FUN = "default"
)

## S4 method for signature 'list'
ssvAnnotateSubjectGRanges(
  annotation_source,
  subject_gr,
  annotation_name = NULL,
  multi_resolver_FUN = "default"
)

## S4 method for signature 'GRangesList'
ssvAnnotateSubjectGRanges(
  annotation_source,
  subject_gr,
  annotation_name = NULL,
  multi_resolver_FUN = "default"
)

Arguments

annotation_source

A single GRanges, a list of GRanges, or a GRangesList

subject_gr

The base GRanges to add annotation mcols to.

annotation_name

Optional name for single GRanges. Required for list inputs if list does not have names.

multi_resolver_FUN

Optional function to resolve multiple overlapping annotation source regions per subject region. This function must accept 2 arguments. x is the values in a single mcol attribute and variable.name is the name of variable. A single value must be returned or an error will be generated. The default of "default" can handle numeric, logical, character, and factor types.

Value

GRanges with the same regions as subject_gr but with addtional mcols added from annotation_source.

Examples

library(GenomicRanges)
data(CTCF_in_10a_narrowPeak_grs)
np_grs = CTCF_in_10a_narrowPeak_grs
olap_gr = ssvOverlapIntervalSets(np_grs)
# annotating with a signle GRanges is OK
ssvAnnotateSubjectGRanges(np_grs$MCF10A_CTCF, olap_gr)
# provide a name if that's useful
ssvAnnotateSubjectGRanges(np_grs$MCF10A_CTCF, olap_gr,
  annotation_name = "MCF10A")
# a named list adds each annotation
ssvAnnotateSubjectGRanges(np_grs, olap_gr)
# overriding list names is an option
ssvAnnotateSubjectGRanges(np_grs, olap_gr, LETTERS[1:3])
# GRangeList are handled like a standard list
ssvAnnotateSubjectGRanges(GRangesList(np_grs), olap_gr, LETTERS[1:3])

jrboyd/seqsetvis documentation built on Oct. 15, 2024, 11:28 p.m.