shinyLabels: Interactively Inspect and Name Gene Signatures

Description Usage Arguments Value Examples

View source: R/shinyLabels.R

Description

This function launches a Shiny app to inspect the gene signatures defined in a Sets for the purpose of (re-)naming those signatures interactively. The app returns the updated Sets when closed using the "Done" button.

Usage

1
shinyLabels(gs, se)

Arguments

gs

A set of gene signatures inheriting from Sets.

se

An object of class inheriting from SummarizedExperiment.

Value

The updated set of gene signatures as a Sets.

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
# Example data ----

bs <- Sets(
    relations=DataFrame(
        element = c("Gene001", "Gene002", "Gene003", "Gene004"),
        set     = c(rep("Cell type 1", 2), rep("Cell type 2", 2))
    )
)

library(SummarizedExperiment)
nsamples <- 100
u <- matrix(rpois(20000, 2), ncol=nsamples)
rownames(u) <- paste0("Gene", sprintf("%03d", seq_len(nrow(u))))
colnames(u) <- paste0("Cell", sprintf("%03d", seq_len(ncol(u))))
se <- SummarizedExperiment(assays=list(counts=u))
colData(se)[, "cluster"] <- factor(sample(head(LETTERS, 3), ncol(se), replace=TRUE))

se1 <- predict(bs, se, method="ProportionPositive", cluster.col="cluster")

# Add reduced dimension results to enable app features
library(SingleCellExperiment)
library(Rtsne)
sce1 <- as(se1, "SingleCellExperiment")
reducedDim(sce1, "PCA") <- prcomp(t(assay(sce1)))$x
reducedDim(sce1, "TSNE") <- Rtsne(X=reducedDim(sce1, "PCA"))$Y

# Example usage ----

if (interactive()){
    library(shiny)
    x <- runApp(shinyLabels(bs, sce1))
}

kevinrue/hancock documentation built on May 17, 2020, 7:55 a.m.