addMetricAndArrangeRSE: addMetricAndArrangeRSE()

View source: R/addMetricAndArrangeRSE.R

addMetricAndArrangeRSER Documentation

addMetricAndArrangeRSE()

Description

Perform an inner join between a rangedSummarizedExperiment object and a data.frame. Sort the resulting rangedSummarizedExperiment based on a metric column.

Usage

addMetricAndArrangeRSE(
  rse,
  order,
  rse_key = "name",
  order_key = "name",
  order_value = "exp",
  shuffle_tie = TRUE
)

Arguments

rse

a rangedSummarizedExperiment object.

order

a data.frame with at least two columns: keys and values.

rse_key

name of the gr metadata column containing unique names for each genomic region in rowRanges(rse). Usually gene names/id or peak id.

order_key

name of the order column that will be used as key for the inner join.

order_value

name of the order column that contain value used for sorting.

shuffle_tie

a boolean Value (TRUE / FALSE). When TRUE, shuffle the GRanges before sorting, mixing the ties.

Details

This utility function allow the addition of a metric column to genomic regions of interest. One of its common use case is to add gene expression values on a set of transcription start sites. The resulting GRanges object will only contain regions presents in both rse and order.

Value

a rangedSummarizedExperiment sorted in descending order.

Examples

data("stackepi")
ramdomOrder <- data.frame(
   gene_id = SummarizedExperiment::rowRanges(stackepi)$gene_id,
   value = rnorm(length(stackepi))
)
addMetricAndArrangeRSE(stackepi,
   ramdomOrder, rse_key = "gene_id",
   order_key = "gene_id", order_value = "value")



GenEpi-GenPhySE/epistack documentation built on July 27, 2023, 1:09 a.m.