From d346b5078ef412332227b285ae0ca609868d2258 Mon Sep 17 00:00:00 2001 From: Michael-Geuenich Date: Sat, 12 Aug 2023 15:25:03 -0400 Subject: [PATCH 1/3] Update utils.R Fixes object 'exp_type' not found when loading single cell experiment object --- R/utils.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/utils.R b/R/utils.R index e15a77f..8efc54a 100644 --- a/R/utils.R +++ b/R/utils.R @@ -483,15 +483,15 @@ extractSCE <- function(sce_object, exp_slot_name = "counts"){ sampTab$sample_name = rownames(sampTab) #extract expression matrix - if(exp_type == "counts"){ + if(exp_slot_name == "counts"){ expDat = counts(sce_object) } - if(exp_type == "normcounts"){ + if(exp_slot_name == "normcounts"){ expDat = normcounts(sce_object) } - if(exp_type == "logcounts"){ + if(exp_slot_name == "logcounts"){ expDat = logcounts(sce_object) } From 7411e8d470f904cfcab2ed293995ce5a7c37ea71 Mon Sep 17 00:00:00 2001 From: Michael Geuenich Date: Sat, 12 Aug 2023 14:32:56 -0700 Subject: [PATCH 2/3] run document --- DESCRIPTION | 2 +- NAMESPACE | 5 +---- man/cn_barplot_grnSing_base.Rd | 12 ++++++++++-- man/cn_clPerf.Rd | 10 ++++++++-- man/cn_classAssess.Rd | 9 +++++++-- man/cn_computeAUCPR.Rd | 8 ++++++-- man/cn_eval.Rd | 10 ++++++++-- man/compareGenePairs.Rd | 13 ++++++++++--- man/csRenameOrth.Rd | 9 +++++++-- man/findClassyGenes.Rd | 12 ++++++++++-- man/hm_enr.Rd | 3 +-- man/hm_gpa_sel.Rd | 15 ++++++++++++--- man/load10x.Rd | 12 +++++++++--- man/makeGeneCompareTab.Rd | 9 +++++++-- man/mergeLoad10x.Rd | 8 ++++++-- man/pca_to_tsne.Rd | 3 +-- man/plotGeneComparison.Rd | 11 +++++++++-- man/ptGetTop.Rd | 10 ++++++++-- man/sc_Accu.Rd | 11 ++++++++--- man/sc_classAssess.Rd | 15 ++++++++++++--- man/sc_hmClass.Rd | 13 +++++++++++-- man/sc_makeClassifier.Rd | 11 +++++++++-- man/scn_extract_SN_DF.Rd | 3 +-- man/scn_netScores.Rd | 12 ++++++++++-- man/scn_score.Rd | 12 ++++++++++-- man/scn_train.Rd | 21 +++++++++++++++------ man/scn_trainGRN.Rd | 17 +++++++++++++---- man/skylineClass.Rd | 11 +++++++++-- man/tsneMultsimp.Rd | 13 ++++++++++--- 29 files changed, 229 insertions(+), 71 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 390729f..266cc05 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -24,4 +24,4 @@ Imports: dplyr, cowplot, reshape2 -RoxygenNote: 6.1.1 +RoxygenNote: 7.2.3 diff --git a/NAMESPACE b/NAMESPACE index 1b44fd1..ad3349d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,5 @@ # Generated by roxygen2: do not edit by hand -export() export(GEP_makeMean) export(addRandToSampTab) export(addToST) @@ -26,12 +25,12 @@ export(findAvgLabel) export(findBestPairs) export(findClassyGenes) export(findVarGenes) -export(get_cate) export(getGenesFromGO) export(getSpecGenes) export(getTopGenes) export(getTopGenesList) export(getUniqueGenes) +export(get_cate) export(gnrAll) export(gnrBP) export(harmonize) @@ -109,7 +108,5 @@ export(utils_strip_fname) export(utils_stripwhite) export(weighted_down) import(parallel) -import(umap) -import(viridis) importFrom(RColorBrewer,brewer.pal) importFrom(randomForest,randomForest) diff --git a/man/cn_barplot_grnSing_base.Rd b/man/cn_barplot_grnSing_base.Rd index 5a8e86c..768325f 100644 --- a/man/cn_barplot_grnSing_base.Rd +++ b/man/cn_barplot_grnSing_base.Rd @@ -4,8 +4,16 @@ \alias{cn_barplot_grnSing_base} \title{barplot this specific GRN} \usage{ -cn_barplot_grnSing_base(qScores, ctrlScores, stQuery, dLevelQ, snName, - ctrSamps, bOrder, sidCol = "sample_id") +cn_barplot_grnSing_base( + qScores, + ctrlScores, + stQuery, + dLevelQ, + snName, + ctrSamps, + bOrder, + sidCol = "sample_id" +) } \arguments{ \item{qScores}{queryScores} diff --git a/man/cn_clPerf.Rd b/man/cn_clPerf.Rd index a1e094e..72b244c 100644 --- a/man/cn_clPerf.Rd +++ b/man/cn_clPerf.Rd @@ -4,8 +4,14 @@ \alias{cn_clPerf} \title{determine performance of classification at given threshold} \usage{ -cn_clPerf(vect, sampTab, dLevel, classification, thresh, - dLevelSID = "sample_id") +cn_clPerf( + vect, + sampTab, + dLevel, + classification, + thresh, + dLevelSID = "sample_id" +) } \arguments{ \item{vect}{vector of values} diff --git a/man/cn_classAssess.Rd b/man/cn_classAssess.Rd index 2513cb2..ee67e30 100644 --- a/man/cn_classAssess.Rd +++ b/man/cn_classAssess.Rd @@ -4,8 +4,13 @@ \alias{cn_classAssess} \title{Assess classifiers based on validation data} \usage{ -cn_classAssess(ct_scores, stVal, classLevels = "description2", - dLevelSID = "sample_id", resolution = 0.005) +cn_classAssess( + ct_scores, + stVal, + classLevels = "description2", + dLevelSID = "sample_id", + resolution = 0.005 +) } \arguments{ \item{ct_scores}{matrix of classification scores, rows = classifiers, columns = samples, colnames=sampleids} diff --git a/man/cn_computeAUCPR.Rd b/man/cn_computeAUCPR.Rd index 0dcefa1..05e20ad 100644 --- a/man/cn_computeAUCPR.Rd +++ b/man/cn_computeAUCPR.Rd @@ -4,8 +4,12 @@ \alias{cn_computeAUCPR} \title{compute AUPCR} \usage{ -cn_computeAUCPR(perfDF, precisionCol = "Precision", - recallCol = "Recall", predCol = "Predictions") +cn_computeAUCPR( + perfDF, + precisionCol = "Precision", + recallCol = "Recall", + predCol = "Predictions" +) } \arguments{ \item{perfDF}{a df} diff --git a/man/cn_eval.Rd b/man/cn_eval.Rd index f3ebcd1..d27a64b 100644 --- a/man/cn_eval.Rd +++ b/man/cn_eval.Rd @@ -4,8 +4,14 @@ \alias{cn_eval} \title{run cn_clPerf across thresholds} \usage{ -cn_eval(vect, sampTab, dLevel, classification, threshs = seq(0, 1, by = - 0.05), dLevelSID = "sample_id") +cn_eval( + vect, + sampTab, + dLevel, + classification, + threshs = seq(0, 1, by = 0.05), + dLevelSID = "sample_id" +) } \arguments{ \item{vect}{named vector} diff --git a/man/compareGenePairs.Rd b/man/compareGenePairs.Rd index 843bafa..f63929f 100644 --- a/man/compareGenePairs.Rd +++ b/man/compareGenePairs.Rd @@ -4,9 +4,16 @@ \alias{compareGenePairs} \title{Compile genePairs comparison matrix} \usage{ -compareGenePairs(query_exp, training_exp, training_st, classCol, - sampleCol = NULL, RF_classifier, numPairs = 20, - trainingOnly = TRUE) +compareGenePairs( + query_exp, + training_exp, + training_st, + classCol, + sampleCol = NULL, + RF_classifier, + numPairs = 20, + trainingOnly = TRUE +) } \arguments{ \item{query_exp}{the expression matrix of query samples} diff --git a/man/csRenameOrth.Rd b/man/csRenameOrth.Rd index 9f5a8b5..9074d69 100644 --- a/man/csRenameOrth.Rd +++ b/man/csRenameOrth.Rd @@ -4,8 +4,13 @@ \alias{csRenameOrth} \title{enable cross-species comparison} \usage{ -csRenameOrth(expQuery, expTrain, orthTable, speciesQuery = "human", - speciesTrain = "mouse") +csRenameOrth( + expQuery, + expTrain, + orthTable, + speciesQuery = "human", + speciesTrain = "mouse" +) } \arguments{ \item{expQuery}{expQuery} diff --git a/man/findClassyGenes.Rd b/man/findClassyGenes.Rd index f048db9..c14bb2b 100644 --- a/man/findClassyGenes.Rd +++ b/man/findClassyGenes.Rd @@ -4,8 +4,16 @@ \alias{findClassyGenes} \title{Find Classifier-Worthy Gene Candidates} \usage{ -findClassyGenes(expDat, sampTab, dLevel, topX = 25, dThresh = 0, - alpha1 = 0.05, alpha2 = 0.001, mu = 2) +findClassyGenes( + expDat, + sampTab, + dLevel, + topX = 25, + dThresh = 0, + alpha1 = 0.05, + alpha2 = 0.001, + mu = 2 +) } \arguments{ \item{expDat}{a matrix of normalized expression data from \code{\link{trans_prop}}} diff --git a/man/hm_enr.Rd b/man/hm_enr.Rd index ade51cb..0b9b070 100644 --- a/man/hm_enr.Rd +++ b/man/hm_enr.Rd @@ -4,8 +4,7 @@ \alias{hm_enr} \title{heatmap of the enrichment result} \usage{ -hm_enr(esList, threshold = 0.05, cRows = FALSE, cCols = FALSE, - fsr = 4) +hm_enr(esList, threshold = 0.05, cRows = FALSE, cCols = FALSE, fsr = 4) } \arguments{ \item{esList}{returned from ks.extract.more} diff --git a/man/hm_gpa_sel.Rd b/man/hm_gpa_sel.Rd index 46dc258..5b708a6 100644 --- a/man/hm_gpa_sel.Rd +++ b/man/hm_gpa_sel.Rd @@ -4,9 +4,18 @@ \alias{hm_gpa_sel} \title{heatmap genes and groups} \usage{ -hm_gpa_sel(expDat, genes, grps, maxPerGrp = 100, cRow = FALSE, - cCol = FALSE, limits = c(0, 10), toScale = FALSE, - fontsize_row = 4, reOrderCells = FALSE) +hm_gpa_sel( + expDat, + genes, + grps, + maxPerGrp = 100, + cRow = FALSE, + cCol = FALSE, + limits = c(0, 10), + toScale = FALSE, + fontsize_row = 4, + reOrderCells = FALSE +) } \arguments{ \item{expDat}{expDat} diff --git a/man/load10x.Rd b/man/load10x.Rd index f3780ee..d03d54d 100644 --- a/man/load10x.Rd +++ b/man/load10x.Rd @@ -4,9 +4,15 @@ \alias{load10x} \title{Loads 10x data mtx} \usage{ -load10x(path, prefix, mtx_fname = "matrix.mtx", - gene_fname = "genes.tsv", bc_fname = "barcodes.tsv", - bcFiltered = TRUE, removeRedundant = TRUE) +load10x( + path, + prefix, + mtx_fname = "matrix.mtx", + gene_fname = "genes.tsv", + bc_fname = "barcodes.tsv", + bcFiltered = TRUE, + removeRedundant = TRUE +) } \arguments{ \item{path}{path} diff --git a/man/makeGeneCompareTab.Rd b/man/makeGeneCompareTab.Rd index a8d90e7..a5b2c08 100644 --- a/man/makeGeneCompareTab.Rd +++ b/man/makeGeneCompareTab.Rd @@ -4,8 +4,13 @@ \alias{makeGeneCompareTab} \title{Make Gene Comparison Table} \usage{ -makeGeneCompareTab(queryExpTab, avgGeneTab, querySample = NULL, - trainingCat = NULL, geneSamples) +makeGeneCompareTab( + queryExpTab, + avgGeneTab, + querySample = NULL, + trainingCat = NULL, + geneSamples +) } \arguments{ \item{queryExpTab}{a matrix of normalized expression query data from \code{\link{trans_prop}}} diff --git a/man/mergeLoad10x.Rd b/man/mergeLoad10x.Rd index bfb858e..7a6e4d7 100644 --- a/man/mergeLoad10x.Rd +++ b/man/mergeLoad10x.Rd @@ -4,8 +4,12 @@ \alias{mergeLoad10x} \title{Loads 10x data mtx} \usage{ -mergeLoad10x(basePath, pNames, nCells = 1000, - secPath = "filtered_matrices_mex/hg19") +mergeLoad10x( + basePath, + pNames, + nCells = 1000, + secPath = "filtered_matrices_mex/hg19" +) } \arguments{ \item{basePath}{path} diff --git a/man/pca_to_tsne.Rd b/man/pca_to_tsne.Rd index e1a7163..bf7118a 100644 --- a/man/pca_to_tsne.Rd +++ b/man/pca_to_tsne.Rd @@ -4,8 +4,7 @@ \alias{pca_to_tsne} \title{make tsne from pca} \usage{ -pca_to_tsne(expDat, recRes, perplexity = 30, theta = 0.3, - weighted = TRUE) +pca_to_tsne(expDat, recRes, perplexity = 30, theta = 0.3, weighted = TRUE) } \arguments{ \item{expDat}{expDat} diff --git a/man/plotGeneComparison.Rd b/man/plotGeneComparison.Rd index 77417f7..4108de4 100644 --- a/man/plotGeneComparison.Rd +++ b/man/plotGeneComparison.Rd @@ -4,8 +4,15 @@ \alias{plotGeneComparison} \title{Gene expression plotting} \usage{ -plotGeneComparison(expDat, grps, fontsize_row = 6, cRows = FALSE, - cCols = FALSE, toScale = FALSE, ...) +plotGeneComparison( + expDat, + grps, + fontsize_row = 6, + cRows = FALSE, + cCols = FALSE, + toScale = FALSE, + ... +) } \arguments{ \item{expDat}{comparison expression matrix from \code{\link{makeGeneCompareTab}}} diff --git a/man/ptGetTop.Rd b/man/ptGetTop.Rd index 585f2a0..5ca2c09 100644 --- a/man/ptGetTop.Rd +++ b/man/ptGetTop.Rd @@ -4,8 +4,14 @@ \alias{ptGetTop} \title{Find the best gene pairs for training} \usage{ -ptGetTop(expDat, cell_labels, cgenes_list = NA, topX = 50, - sliceSize = 5000, quickPairs = TRUE) +ptGetTop( + expDat, + cell_labels, + cgenes_list = NA, + topX = 50, + sliceSize = 5000, + quickPairs = TRUE +) } \arguments{ \item{expDat}{expDat} diff --git a/man/sc_Accu.Rd b/man/sc_Accu.Rd index 07607bd..d1c0e5d 100644 --- a/man/sc_Accu.Rd +++ b/man/sc_Accu.Rd @@ -4,9 +4,14 @@ \alias{sc_Accu} \title{Assess classifiers based on validation data} \usage{ -sc_Accu(ct_scores, stVal, dLevel = "description1", - dLevelSID = "sample_name", threshs = seq(0, 1, by = 0.005), - nRand = 50) +sc_Accu( + ct_scores, + stVal, + dLevel = "description1", + dLevelSID = "sample_name", + threshs = seq(0, 1, by = 0.005), + nRand = 50 +) } \arguments{ \item{ct_scores}{matrix of classification scores, rows = classifiers, columns = samples, colnames=sampleids} diff --git a/man/sc_classAssess.Rd b/man/sc_classAssess.Rd index 37943cf..ae96a0c 100644 --- a/man/sc_classAssess.Rd +++ b/man/sc_classAssess.Rd @@ -4,9 +4,18 @@ \alias{sc_classAssess} \title{assess the classifiers performance based on validation data} \usage{ -sc_classAssess(stDat, washedDat, dLevel = "description1", - dLevelSID = "sample_name", minCells = 40, dThresh = 0, - propTrain = 0.25, nRand = 50, nTrees = 2000, resolution = 0.005) +sc_classAssess( + stDat, + washedDat, + dLevel = "description1", + dLevelSID = "sample_name", + minCells = 40, + dThresh = 0, + propTrain = 0.25, + nRand = 50, + nTrees = 2000, + resolution = 0.005 +) } \arguments{ \item{stDat}{sample table} diff --git a/man/sc_hmClass.Rd b/man/sc_hmClass.Rd index da1e1d0..d793981 100644 --- a/man/sc_hmClass.Rd +++ b/man/sc_hmClass.Rd @@ -4,8 +4,17 @@ \alias{sc_hmClass} \title{heatmap of the classification result} \usage{ -sc_hmClass(classMat, grps, isBig = FALSE, maxPerGrp = 100, - cRow = FALSE, cCol = FALSE, fontsize_row = 4, scale = FALSE) +sc_hmClass( + classMat, + grps, + isBig = FALSE, + maxPerGrp = 100, + cRow = FALSE, + cCol = FALSE, + fontsize_row = 8, + scale = FALSE, + label_reorder = TRUE +) } \arguments{ \item{classMat}{classMat} diff --git a/man/sc_makeClassifier.Rd b/man/sc_makeClassifier.Rd index b9b3710..e21591b 100644 --- a/man/sc_makeClassifier.Rd +++ b/man/sc_makeClassifier.Rd @@ -4,8 +4,15 @@ \alias{sc_makeClassifier} \title{Make Classifier} \usage{ -sc_makeClassifier(expTrain, genes, groups, nRand = 70, ntrees = 2000, - stratify = FALSE, sampsize = 40) +sc_makeClassifier( + expTrain, + genes, + groups, + nRand = 70, + ntrees = 2000, + stratify = FALSE, + sampsize = 40 +) } \arguments{ \item{expTrain}{transformed training data from \code{\link{query_transform}}} diff --git a/man/scn_extract_SN_DF.Rd b/man/scn_extract_SN_DF.Rd index d086032..779cd58 100644 --- a/man/scn_extract_SN_DF.Rd +++ b/man/scn_extract_SN_DF.Rd @@ -4,8 +4,7 @@ \alias{scn_extract_SN_DF} \title{returns a DF of: sample_id, description, ctt, subnet_name, score} \usage{ -scn_extract_SN_DF(scores, sampTab, dLevel, rnames = NULL, - sidCol = "sample_id") +scn_extract_SN_DF(scores, sampTab, dLevel, rnames = NULL, sidCol = "sample_id") } \arguments{ \item{scores}{a matrix of subNet scores} diff --git a/man/scn_netScores.Rd b/man/scn_netScores.Rd index e7eae55..c428027 100644 --- a/man/scn_netScores.Rd +++ b/man/scn_netScores.Rd @@ -4,8 +4,16 @@ \alias{scn_netScores} \title{GRN status} \usage{ -scn_netScores(expDat, genes, tVals, ctt, classList = NULL, - classWeight = FALSE, exprWeight = TRUE, xmax = 1000) +scn_netScores( + expDat, + genes, + tVals, + ctt, + classList = NULL, + classWeight = FALSE, + exprWeight = TRUE, + xmax = 1000 +) } \arguments{ \item{expDat}{query expression matrix} diff --git a/man/scn_score.Rd b/man/scn_score.Rd index a841769..3ddbbe0 100644 --- a/man/scn_score.Rd +++ b/man/scn_score.Rd @@ -4,8 +4,16 @@ \alias{scn_score} \title{GRN status} \usage{ -scn_score(expDat, subList, tVals, classList = NULL, minVals = NULL, - classWeight = FALSE, exprWeight = TRUE, xmax = 1000) +scn_score( + expDat, + subList, + tVals, + classList = NULL, + minVals = NULL, + classWeight = FALSE, + exprWeight = TRUE, + xmax = 1000 +) } \arguments{ \item{expDat}{query expression matrix} diff --git a/man/scn_train.Rd b/man/scn_train.Rd index f40fb38..0b3dfb1 100644 --- a/man/scn_train.Rd +++ b/man/scn_train.Rd @@ -4,10 +4,19 @@ \alias{scn_train} \title{Training} \usage{ -scn_train(stTrain, expTrain, dLevel, colName_samp = "row.names", - nTopGenes = 10, nTopGenePairs = 25, nRand = 70, nTrees = 1000, - stratify = FALSE, weightedDown_total = 1500, - weightedDown_dThresh = 0.25, transprop_xFact = 10000) +scn_train( + stTrain, + expTrain, + dLevel, + colName_samp = "row.names", + nTopGenes = 10, + nTopGenePairs = 25, + nRand = 70, + nTrees = 1000, + stratify = FALSE, + weightedDown_total = 10000, + weightedDown_dThresh = 0.25 +) } \arguments{ \item{stTrain}{a dataframe that matches the samples with category} @@ -28,9 +37,9 @@ scn_train(stTrain, expTrain, dLevel, colName_samp = "row.names", \item{weightedDown_dThresh}{the threshold at which anything lower than that is 0 for weighted_down function} -\item{transprop_xFact}{scaling factor for transprop} - \item{weightDown_total}{numeric post transformation sum of read counts for weighted_down function} + +\item{transprop_xFact}{scaling factor for transprop} } \value{ a list containing normalized expression data, classification gene list, cnPRoc diff --git a/man/scn_trainGRN.Rd b/man/scn_trainGRN.Rd index 621fcca..9196d95 100644 --- a/man/scn_trainGRN.Rd +++ b/man/scn_trainGRN.Rd @@ -4,10 +4,19 @@ \alias{scn_trainGRN} \title{Figure out normalization factors for GRNs, and norm training data} \usage{ -scn_trainGRN(expTrain, stTrain, subNets, classList = NULL, - dLevel = "description1", tVals = NULL, classWeight = FALSE, - exprWeight = FALSE, sidCol = "sample_id", xmax = 1000, - predSD = FALSE) +scn_trainGRN( + expTrain, + stTrain, + subNets, + classList = NULL, + dLevel = "description1", + tVals = NULL, + classWeight = FALSE, + exprWeight = FALSE, + sidCol = "sample_id", + xmax = 1000, + predSD = FALSE +) } \arguments{ \item{expTrain}{expression matrix} diff --git a/man/skylineClass.Rd b/man/skylineClass.Rd index 99d0b93..0a9d50d 100644 --- a/man/skylineClass.Rd +++ b/man/skylineClass.Rd @@ -4,8 +4,15 @@ \alias{skylineClass} \title{Skyline waterfall} \usage{ -skylineClass(classRes, cellType, sampTab, dLevel, yval, - cellIdLab = "cell_name", reorder = TRUE) +skylineClass( + classRes, + cellType, + sampTab, + dLevel, + yval, + cellIdLab = "cell_name", + reorder = TRUE +) } \arguments{ \item{yval}{} diff --git a/man/tsneMultsimp.Rd b/man/tsneMultsimp.Rd index 896a047..06c63f9 100644 --- a/man/tsneMultsimp.Rd +++ b/man/tsneMultsimp.Rd @@ -4,9 +4,16 @@ \alias{tsneMultsimp} \title{plot tsne and genes} \usage{ -tsneMultsimp(tsneDat, expDat, genesToPlot, colorPal = "BuPu", - revCol = TRUE, toScale = TRUE, limits = c(-3, 3), - themeWhite = TRUE) +tsneMultsimp( + tsneDat, + expDat, + genesToPlot, + colorPal = "BuPu", + revCol = TRUE, + toScale = TRUE, + limits = c(-3, 3), + themeWhite = TRUE +) } \arguments{ \item{tsneDat}{tsne matrix} From f0712e38cc1306993ad8cfb4130d52779d7371c4 Mon Sep 17 00:00:00 2001 From: Michael Geuenich Date: Sun, 20 Aug 2023 22:44:01 -0600 Subject: [PATCH 3/3] fix extractSCE --- R/utils.R | 62 +++++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/R/utils.R b/R/utils.R index 8efc54a..1143989 100644 --- a/R/utils.R +++ b/R/utils.R @@ -25,7 +25,7 @@ ctRename<-function(sampTab, annCol, oldName, newName){ xnot<-which(colnames(sampTab)!=annCol) ans<-sampTab[,xnot] cbind(ans, newAnn=newann) -} +} #' @title #' Split Sample Table @@ -41,13 +41,13 @@ ctRename<-function(sampTab, annCol, oldName, newName){ #' #' @export splitCommon<-function(sampTab, ncells = 50, dLevel="cell_ontology_class", cells_reserved = 3){ - + cts<-unique(as.vector(sampTab[,dLevel])) if(sum(is.na(cts)) > 0){ stop("There are NAs in your training labels, please remove them first!") } - + trainingids<-vector() for(ct in cts){ cat(ct,": ") @@ -102,7 +102,7 @@ loadLoomExpCluster<-function# load a loom object containing expression + cluste expMat<- t(lfile[["matrix"]][1:length(cellNames),]) rownames(expMat)<-geneNames colnames(expMat)<-cellNames - + cluster_old <- lfile[['col_attrs']][[xname]][] sampTab <- data.frame(cell_name=cellNames, cluster=cluster_old) @@ -117,7 +117,7 @@ loadLoomExpCluster<-function# load a loom object containing expression + cluste #' @export getGenesFromGO<-function# return the entrez gene ids of a given a GOID, for now assumes mouse (GOID, # GO id to find genes for - annList + annList ){ sort(as.vector(unlist(annList[['egSymbols']][annList[['goegs']][[GOID]]]))); } @@ -149,15 +149,15 @@ GEP_makeMean<-function groupings, type='mean' ){ - - + + ans<-data.frame(); grps<-unique(groupings); if(type=='mean'){ for(grp in grps){ gi<-which(groupings==grp); if(length(gi)==1){ - + if(nrow(ans)==0){ ans<-data.frame(exp[,gi]); }else{ @@ -187,7 +187,7 @@ GEP_makeMean<-function } } } - + colnames(ans)<-grps; ans; ### data.frame of mean or median-ed data based on given groupings @@ -215,8 +215,8 @@ library(GO.db) #' #' 1-PCC distance #' @param x numeric matrix -#' -#' @return distance matrix +#' +#' @return distance matrix #' #' @examples #' xdist<-utils_myDist(t(expDat)) @@ -254,7 +254,7 @@ utils_loadObject<-function #' #' @export utils_stripwhite<-function -### +### (string #### string ){ @@ -268,7 +268,7 @@ utils_stripwhite<-function #' #' @export utils_myDate<-function -### +### () { format(Sys.time(), "%b_%d_%Y"); @@ -299,11 +299,11 @@ zscore<-function ### compute zscore (x, ### numeric vector - meanVal, - ### mean of distribution to compute zscore of x against + meanVal, + ### mean of distribution to compute zscore of x against sdVal ### standard deviation of distribution to compute zscore of x agains - ){ + ){ (x-meanVal)/sdVal; ### zscore } @@ -363,7 +363,7 @@ cn_correctZmat<-function downSampleW<-function (vector, total=1e5, - dThresh=0){ + dThresh=0){ totalSignal<-sum(vector) wAve<-vector/totalSignal @@ -403,7 +403,7 @@ weighted_down<-function tmpAns <- expDat - t(props * rrids) tmpAns[which(tmpAns