MatchedGRanges: MatchedGRanges objects

MatchedGRanges-classR Documentation

MatchedGRanges objects

Description

The MatchedGRanges class is a subclass of both Matched and GRanges. Therefore, it contains slots and methods for both of these classes.

Details

The MatchedGRanges class uses a delegate object during initialization to assign its GRanges slots. MatchedGRanges behaves as a GRanges but also includes additional Matched object functionality (see ?Matched). For more information about GRanges see ?GenomicRanges::GRanges.

Slots

focal

A GRanges object containing the focal data to match.

pool

A GRanges object containing the pool from which to select matches.

delegate

A GRanges object used to initialize GRanges-specific slots. matchRanges() assigns the matched set to the slot.

matchedData

A data.table with matched data

matchedIndex

An integer vector corresponding to the indices in the pool which comprise the matched set.

covar

A character vector describing the covariates used for matching.

method

Character describing replacement method used for matching.

replace

TRUE/FALSE describing if matching was done with or without replacement.

seqnames

seqnames(delegate)

ranges

ranges(delegate)

strand

strand(delegate)

seqinfo

seqinfo(delegate)

elementMetadata

elementMetadata(delegate)

elementType

elementType(delegate)

metadata

metadata(delegate)

Accessor methods for Matched Class

Functions that get data from Matched subclasses (x) such as MatchedDataFrame, MatchedGRanges, and MatchedGInteractions are listed below:

  • matchedData(x): Get matched data from a Matched object

  • covariates(x): Get covariates from a Matched object

  • method(x): Get matching method used for Matched object

  • withReplacement(x): Get replace method

  • indices(x, set): Get indices of matched set

For more detail check the help pages for these functions.

Accessor methods for Matched subclass objects

Additional functions that get data from Matched subclasses (x) such as MatchedDataFrame, MatchedGRanges, and MatchedGInteractions include:

  • focal(x): Get focal set from a Matched object

  • pool(x): Get pool set from a Matched object

  • matched(x): Get matched set from a Matched object

  • unmatched(x): Get unmatched set from a Matched object

For more detail check the help pages for these functions.

See Also

GenomicRanges::GRanges

matchedData, covariates, method, withReplacement, indices

focal, pool, matched, unmatched

Examples

## Contructing MatchedGRanges with matchRanges
set.seed(123)
gr <- makeExampleMatchedDataSet(type = "GRanges")
mgr <- matchRanges(
  focal = gr[gr$feature1, ],
  pool = gr[!gr$feature1, ],
  covar = ~ feature2 + feature3,
  method = "rejection",
  replace = FALSE
)
class(mgr)

## Make MatchedGRanges example
set.seed(123)
x <- makeExampleMatchedDataSet(type = "GRanges", matched = TRUE)
## Accessor functions for Matched class
matchedData(x)
covariates(x)
method(x)
withReplacement(x)
head(indices(x, set = 'matched'))

## Accessor functions for Matched subclasses
focal(x)
pool(x)
matched(x)
unmatched(x)


nullranges/nullranges documentation built on Aug. 29, 2023, 12:13 a.m.