Description Usage Arguments Value Examples
View source: R/getSimDataFrame.R
This function takes in a CellScabbard object, or both a similarity vector
or data frame as returned by getSimScores
and a subset of AIBSARNA
as returned by getRelevantGenes
. Constructs a data.frame
with columns age, structure_acroynym, and either cosine_similarity or
euclidean_similarity, sorted by similarity score in decreasing order.
In the case of a similarity data frame, a list of data frames is returned.
1 2 3 4 5 6 | getSimDataFrame(
data = NULL,
sim_score = NULL,
relevantGenes = NULL,
similarity_method = "cosine"
)
|
data |
a CellScabbard object with non-empty relevantGenes and
similarityScores slots, or a SummarizedExperiment created using the
|
sim_score |
a vector or data frame of similarity scores |
relevantGenes |
a SummarizedExperiment object created using the
|
similarity_method |
currently supported similarity methods are "cosine" and "euclidean", defaults to "cosine" |
a three-column data.frame or list of data frames
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 | AIBSARNA <- buildAIBSARNA(mini = TRUE)
# Example 1 - using CellScabbard class
# get a random sample of 3 genes
totalGenes <- nrow(AIBSARNA)
gene_idx <- sample.int(totalGenes, 3)
sample_idx <- c(1,3,5)
# Subset AIBSARNA
exprs <- assay(AIBSARNA)[gene_idx, sample_idx]
fd <- rowData(AIBSARNA)[gene_idx, ]
pd <- colData(AIBSARNA)[sample_idx, ]
# build a trimmed data set
myGenes <- CellScabbard(exprsData = exprs, phenoData = pd, featureData = fd,
AIBSARNA = AIBSARNA, autoTrim = TRUE)
# cosine similarity method
similarityScores(myGenes) <- getSimScores(data = myGenes,
similarity_method = "cosine")
similarityDFs(myGenes) <- getSimDataFrame(data = myGenes,
similarity_method = "cosine")
similarityDFs(myGenes)
# euclidean similarity method
similarityScores(myGenes) <- getSimScores(data = myGenes,
similarity_method = "euclidean")
similarityDFs(myGenes) <- getSimDataFrame(data = myGenes,
similarity_method = "euclidean")
similarityDFs(myGenes)
# Example 2 - manual gene selection and relevant gene extraction
myGenes <- c(4.484885, 0.121902, 0.510035)
names(myGenes) <- c("TSPAN6", "DPM1", "C1orf112")
myGeneSet <- getRelevantGenes(myGenes, AIBSARNA = AIBSARNA,
AIBSARNAid = "gene_symbol")
myCosScore <- getSimScores(myGenes, relevantGenes = myGeneSet,
similarity_method = "cosine")
myEucScore <- getSimScores(myGenes, relevantGenes = myGeneSet,
similarity_method = "euclidean")
myCosineDF <- getSimDataFrame(sim_score = myCosScore,
relevantGenes = myGeneSet,
similarity_method = "cosine")
myEuclideanDF <- getSimDataFrame(sim_score = myEucScore,
relevantGenes = myGeneSet,
similarity_method = "euclidean")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.