-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added functions: plot_MST(), plot_exprDist()
- Loading branch information
1 parent
d9f0159
commit 088b1c2
Showing
13 changed files
with
145 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ Authors@R: c( | |
email = "[email protected]") | ||
) | ||
Description: FR-Match is a cell type cluster mapping algorithm for single cell RNA sequencing (scRNAseq) data. It is based on a statistical test called Friedman-Rafsky (FR) test, which is a multivariate generalization of nonparametric two-sample test. This package also provides visualization tools for the implemented method. | ||
Depends: R (>= 4.0.0), shiny (>= 1.2.0), SingleCellExperiment | ||
Depends: R (>= 4.0.0), shiny (>= 1.2.0), SingleCellExperiment, pbmcapply | ||
Imports: methods, S4Vectors, SummarizedExperiment, Seurat, scmap, lsa, igraph, ade4, tibble, dplyr, tidyr, forcats, magrittr, pheatmap, RColorBrewer, ggplot2, gridExtra, viridis | ||
Suggests: | ||
knitr, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
#' Plot minimum spanning tree (MST) | ||
#' | ||
#' This function is a wrapper function for plotting MST of two interested clusters. | ||
#' | ||
#' @param sce.query,sce.ref Query and reference data objects. | ||
#' @param query.cluster,ref.cluster Query and reference cluster names to plot. | ||
#' @param nsamp Number of randomly selected cells to plot for large cluster. Default: 30. | ||
#' @param ... Additional arguments passed to \code{\link[FRmatch]{FRtest}}. | ||
#' | ||
#' @return MST plot and FR-test result in console. | ||
#' | ||
#' @export | ||
|
||
plot_MST <- function(sce.query, sce.ref, query.cluster, ref.cluster, nsamp=30, ...){ | ||
ind.query <- sce.query@colData$cluster_membership==query.cluster | ||
ind.query.sub <- sample(1:sum(ind.query), min(nsamp,sum(ind.query))) | ||
samp1 <- assay(sce.query)[,ind.query][,ind.query.sub] | ||
|
||
ind.ref <- sce.ref@colData$cluster_membership==ref.cluster | ||
ind.ref.sub <- sample(1:sum(ind.ref), min(nsamp,sum(ind.ref))) | ||
samp2 <- assay(sce.ref)[,ind.ref][,ind.ref.sub] | ||
|
||
FRtest(samp1, samp2, plot.MST=T, label.names=c(query.cluster,ref.cluster)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
#' Gene expression data distribution plot | ||
#' | ||
#' This function plots the expression data distributions of the two single cell datasets (e.g. query and reference) to be compared. | ||
#' | ||
#' @param sce.E1,sce.E2 Data objects, namely E1 and E2. | ||
#' @param name.E1,name.E2 Customized names for E1 and E2. Default: \code{"E1"} and \code{"E2"}, respectively. | ||
#' @param breaks,xlim,ylim Plotting parameters passed to histogram plot. | ||
#' @param filename File name if to save the plot. Default: \code{NA}, not to save the plot. | ||
#' @param width,height Width and height for saved plot. | ||
#' | ||
#' @export | ||
|
||
plot_exprDist <- function(sce.E1, sce.E2, name.E1="E1", name.E2="E2", | ||
breaks=20, xlim=c(0,10), ylim=c(0,1.7), | ||
filename=NA, width=10, height=5){ | ||
## to save pdf | ||
if(!is.na(filename)){pdf(filename, width=width, height=height)} | ||
|
||
## plot | ||
par(mfrow=c(1,2), mar=c(3,4,3,2)) | ||
hist(logcounts(sce.E1), freq=F, xlab="", | ||
breaks=breaks, xlim=xlim, ylim=ylim, main=name.E1) | ||
ss <- summary(as.vector(logcounts(sce.E1))) | ||
legend("topright", paste(names(ss),"=", round(ss,3)), bty="n") | ||
hist(logcounts(sce.E2), freq=F, xlab="", | ||
breaks=breaks, xlim=xlim, ylim=ylim, main=name.E2) | ||
ss <- summary(as.vector(logcounts(sce.E2))) | ||
legend("topright", paste(names(ss),"=", round(ss,3)), bty="n") | ||
|
||
## to close pdf | ||
if(!is.na(filename)){dev.off()} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.