getSimMatrix {BrainSABER} | R Documentation |
This function takes a similarity vector or data frame as returned by
getSimScores
and either a CellScabbard object or a subset of AIBSARNA
as returned by getRelevantGenes
. Returns a numeric matrix or list
of matrices of similarity scores with rows labeled by age, and columns
labeled by structure_acronym.
getSimMatrix(data = NULL, sim_score = NULL, relevantGenes = NULL)
data |
a CellScabbard object with non-empty relevantGenes slot |
sim_score |
a vector or data frame of similarity scores |
relevantGenes |
a SummarizedExperiment created using the
|
a numeric matrix of similarity scores, or a list of matrices
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) similarityScores(myGenes) <- getSimScores(data = myGenes, similarity_method = "cosine") similarityMatrices(myGenes) <- getSimMatrix(data = myGenes) similarityMatrices(myGenes) similarityScores(myGenes) <- getSimScores(data = myGenes, similarity_method = "euclidean") similarityMatrices(myGenes) <- getSimMatrix(data = myGenes) similarityMatrices(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, myGeneSet, similarity_method = "cosine") myEucScore <- getSimScores(myGenes, myGeneSet, similarity_method = "euclidean") myCosineMatrix <- getSimMatrix(sim_score = myCosScore, relevantGenes = myGeneSet) myEuclideanMatrix <- getSimMatrix(sim_score = myEucScore, relevantGenes = myGeneSet)