asRaggedExperiment: Take a set of segmentations and make them into a...

View source: R/asRaggedExperiment.R

asRaggedExperimentR Documentation

Take a set of segmentations and make them into a RaggedExperiment.

Description

This seems pretty banal, and in some respects it is, but there are some fiddly bits to computing on segmentations, and this function attempts to ease them. For example, it simply isn't possible to use sparseAssay or disjoinAssay with character, integer, or factor matrices. If all states are represented in all segmentations, this reduces to generating and keeping a state-mapping key in metadata(), then referring to it on the way out of the RaggedExperiment (usually this will employ disjoinSummarizedExperiment to map a bunch of regions across a bunch of segmentation models). Yet another possibility is that each segmentation has a probability for each possible state, and a collection of segmentations would be better stored as a tensor (stack of arrays). This function attempts to finesse the most painful parts of the user experience (based on mine). Irritating problems like missing states can make life difficult, so this function deals with them up-front by enumerating states, then keying them.

Usage

asRaggedExperiment(segs, scHMM = FALSE, keycol = "name", to = "state")

Arguments

segs

segmentations, usually a GRangesList or GenomicSegmentations

scHMM

scChromHMM-like posterior probabilities? (different tricks)

keycol

mcols column to find the states that comprise a key ("name")

to

what to call this keycol to in the RaggedExperiment? ("state")

Details

The function will probably be wrapped by a coercion before too much longer.

The 'states' method uses 'key' on RE assays. metadata(RE)$yek, as its name implies, reverses 'key'.

Value

a RaggedExperiment RE, with 'key' and 'yek' in metadata(RE)

See Also

states

Examples


# some simplified chrY tracks 
data(simpleY, package="chromophobe")
asRaggedExperiment(simpleY)


ttriche/chromophobe documentation built on Oct. 14, 2024, 11:59 a.m.