standardizeFeatureSets: Standardize feature sets

Description Usage Arguments Details Value Author(s) Examples

Description

Standardize feature sets across comparable IndexedRelations objects.

Usage

1

Arguments

x

An IndexedRelations object.

objects

A list of IndexedRelations object with the same number and classes of partners.

clean

Logical scalar indicating whether the each of the feature sets should contain sorted and unique entries.

Details

This function is intended for use by developers of downstream packages. The idea is to standardize the feature sets of different IndexedRelations objects, thereby allowing direct comparison of the integer indices in downstream algorithms.

Setting clean=TRUE will sort and remove duplicates within each feature set. This provides some structure that can be useful in some algorithms, e.g., ordering of partner indices reflects the ordering of the partner features.

In all cases, the “as if” behaviour of the IndexedRelations class is unaffected, i.e., the partner features are the same before and after running this function, even if the underlying representation is altered.

Value

A list containing x an IndexedRelations object; and objects, a list of IndexedRelations objects with the same feature sets as x.

Author(s)

Aaron Lun cleanFeatureSets, to clean the feature sets for a single IndexedRelations object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(GenomicRanges)
promoters <- GRanges("chrA", IRanges(1:10*20, 1:10*20+10))
enhancers <- GRanges("chrA", IRanges(1:20*10, 1:20*10+10))
partner1 <- sample(length(promoters), 100, replace=TRUE)
partner2 <- sample(length(enhancers), 100, replace=TRUE)

rel1 <- IndexedRelations(
    list(promoter=partner1, enhancer=partner2),
    featureSets=list(promoters=promoters, enhancers=enhancers)
)
rel2 <- IndexedRelations(
    list(promoter=partner1, enhancer=partner2),
    featureSets=list(promoters=rev(promoters), enhancers=rev(enhancers))
)

std.feat <- standardizeFeatureSets(rel1, list(rel2))
new.rel1 <- std.feat$x
new.rel2 <- std.feat$objects[[1]]
stopifnot(identical(featureSets(new.rel1), featureSets(new.rel2)))

LTLA/IndexedRelations documentation built on June 2, 2019, 10:03 p.m.