Description Usage Arguments Value Author(s) Examples
calcTGIF
function calculates what kind of cellular patterns
and functional patterns are contained in single-cell RNA-seq data and
reportTGIF
function generates report of analytic result.
1 2 3 4 | reportTGIF(sce, out.dir=tempdir(), html.open=FALSE,
title="The result of scTGIF",
author="The person who runs this script",
assayNames="counts")
|
sce |
A object generated by instantization of SingleCellExperiment-class. |
out.dir |
Output directory user want to save the report (Default: tempdir()). |
html.open |
Whether html is opened when |
title |
Title of report (Default: "The result of scTGIF") |
author |
The name of user name (Default: "The person who runs this script") |
assayNames |
The unit of gene expression for using scTGIF (e.g. normcounts, cpm...etc) (Default: "counts"). |
Some file is generated to output directory user specified.
Koki Tsuyuzaki [aut, cre]
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | if(interactive()){
# Package loading
library("SingleCellExperiment")
library("GSEABase")
library("msigdbr")
# Test data
data("DistalLungEpithelium")
data("pca.DistalLungEpithelium")
data("label.DistalLungEpithelium")
# Test data
par(ask=FALSE)
plot(pca.DistalLungEpithelium, col=label.DistalLungEpithelium, pch=16,
main="Distal lung epithelium dataset", xlab="PCA1",
ylab="PCA2", bty="n")
text(0.1, 0.05, "AT1", col="#FF7F00", cex=2)
text(0.07, -0.15, "AT2", col="#E41A1C", cex=2)
text(0.13, -0.04, "BP", col="#A65628", cex=2)
text(0.125, -0.15, "Clara", col="#377EB8", cex=2)
text(0.09, -0.2, "Cilliated", col="#4DAF4A", cex=2)
# Load the gmt file from MSigDB
# Only "Entrez Gene ID" can be used in scTGIF
# e.g. gmt <- GSEABase::getGmt(
# "/PATH/YOU/SAVED/THE/GMTFILES/h.all.v6.0.entrez.gmt")
# Here we use msigdbr to retrieve mouse gene sets
# Mouse gene set (NCBI Gene ID)
m_df <- msigdbr(species = "Mus musculus", category = "H")[,
c("gs_name", "entrez_gene")]
# Convert to GeneSetCollection
hallmark = unique(m_df$gs_name)
gsc <- lapply(hallmark, function(h){
target = which(m_df$gs_name == h)
geneIds = unique(as.character(m_df$entrez_gene[target]))
GeneSet(setName=h, geneIds)
})
gmt <- GeneSetCollection(gsc)
# SingleCellExperiment-class
sce <- SingleCellExperiment(
assays = list(counts = DistalLungEpithelium))
reducedDims(sce) <- SimpleList(PCA=pca.DistalLungEpithelium)
# User's Original Normalization Function
CPMED <- function(input){
libsize <- colSums(input)
median(libsize) * t(t(input) / libsize)
}
# Normalization
normcounts(sce) <- log10(CPMED(counts(sce)) + 1)
# Registration of required information into metadata(sce)
settingTGIF(sce, gmt, reducedDimNames="PCA",
assayNames="normcounts")
# Functional Annotation based on jNMF
calcTGIF(sce, ndim=7)
# HTML Reprt
reportTGIF(sce,
html.open=TRUE,
title="scTGIF Report for DistalLungEpithelium dataset",
author="Koki Tsuyuzaki")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.