AssayLinks: Links between Assays

Description Usage Arguments Value Constructors Methods and functions Creating links between assays Examples

View source: R/AssayLinks.R

Description

Links between assays within a QFeatures object are handled by an AssayLinks object. It is composed by a list of AssayLink instances.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## S4 method for signature 'AssayLink'
show(object)

AssayLink(name, from = NA_character_, fcol = NA_character_, hits = Hits())

AssayLinks(..., names = NULL)

assayLink(x, i)

assayLinks(x, i)

## S4 method for signature 'AssayLink,character,ANY,ANY'
x[i, j, ..., drop = TRUE]

## S4 method for signature 'AssayLinks,list,ANY,ANY'
x[i, j, ..., drop = TRUE]

addAssayLink(object, from, to, varFrom, varTo)

addAssayLinkOneToOne(object, from, to)

Arguments

object

An AssayLink object to show.

name

A mandatory name of the assay(s).

from

A character() or integer() indicating which assay(s) to link from in object

fcol

The feature variable of the parent assay used to generate the current assay (used in aggregateFeatures). NA_character_, if not applicable.

hits

An object of class S4Vectors::Hits matching the features of two assays.

...

A set of AssayLink objects or a list thereof.

names

A character() of AssayLink names. If provided, ... are ignored, and names is used to create an AssayLinks object with AssayLink instances with names names.

x

An instance of class QFeatures.

i

The index or name of the assay whose AssayLink and parents AssayLink instances are to be returned. For [, the feature names to filter on.

j

ignored.

drop

ignored.

to

A character(1) or integer(1) indicating which assay to link to in object

varFrom

A character() indicating the feature variable(s) to use to match the from assay(s) to the to assay. varFrom must have the same length as from and is assumed to be ordered as from.

varTo

A character(1) indicating the feature variable to use to match the to assay to the from assay(s).

Value

assayLink returns an instance of class AssayLink.

assayLinks returns an instance of class AssayLinks.

Constructors

Object can be created with the AssayLink() and AssayLinks() constructors.

Methods and functions

Creating links between assays

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
##-----------------------------
## Creating an AssayLink object
##-----------------------------

al1 <- AssayLink(name = "assay1")
al1

##------------------------------
## Creating an AssayLinks object
##------------------------------

AssayLinks(al1)

al2 <- AssayLinks(names = c("Assay1", "Assay2"))
al2

##---------------------------------------
## Adding an AssayLink between two assays
##---------------------------------------

## create a QFeatures object with 2 (identical) assays
## see also '?QFeatures'
se <- SummarizedExperiment(matrix(runif(20), ncol = 2,
                                  dimnames = list(LETTERS[1:10],
                                                  letters[1:2])),
                           rowData = DataFrame(ID = 1:10))
ft <- QFeatures(list(assay1 = se, assay2 = se))

## assay1 and assay2 are not linked
assayLink(ft, "assay2") ## 'from' is NA
assayLink(ft, "assay1") ## 'from' is NA

## Suppose assay2 was generated from assay1 and the feature variable
## 'ID' keeps track of the relationship between the two assays
ftLinked <- addAssayLink(ft, from = "assay1", to = "assay2",
                         varFrom = "ID", varTo = "ID")
assayLink(ftLinked, "assay2")

## For one-to-one relationships, you can also use
ftLinked <- addAssayLinkOneToOne(ft, from = "assay1", to = "assay2")
assayLink(ftLinked, "assay2")

##----------------------------------------
## Adding an AssayLink between more assays
##----------------------------------------

## An assay can also be linked to multiple parent assays
## Create a QFeatures object with 2 parent assays and 1 child assay
ft <- QFeatures(list(parent1 = se[1:6, ], parent2 = se[4:10, ], child = se))
ft <- addAssayLink(ft, from = c("parent1", "parent2"), to = "child",
                   varFrom = c("ID", "ID"), varTo = "ID")
assayLink(ft, "child")

QFeatures documentation built on Nov. 8, 2020, 6:51 p.m.