From 59d72ded0e8f85c83003f2e512da5001d57327b8 Mon Sep 17 00:00:00 2001 From: jfarrell Date: Tue, 6 Aug 2019 11:45:27 -0400 Subject: [PATCH 01/24] markersAUCPR calculates ratio --- DESCRIPTION | 2 +- R/diff-exp.R | 21 ++++++++++----------- man/markersAUCPR.Rd | 7 +++++-- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6893e15..3e87433 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: URD Title: URD -Version: 1.1.0 +Version: 1.1.0.9000 Authors@R: person("Jeffrey", "Farrell", email = "jfarrell@g.harvard.edu", role = c("aut", "cre")) Description: URD reconstructs transcriptional trajectories underlying specification or differentiation processes in the form of a branching tree from single-cell RNAseq data. Depends: diff --git a/R/diff-exp.R b/R/diff-exp.R index 7e59534..86f172c 100644 --- a/R/diff-exp.R +++ b/R/diff-exp.R @@ -104,12 +104,14 @@ markersBinom <- function(object, pseudotime, clust.1=NULL,clust.2=NULL,cells.1=N #' @param frac.must.express (Numeric) Gene must be expressed in at least this fraction of cells in one of the two clusters to be considered. #' @param exp.thresh (Numeric) Minimum expression value to consider 'expressed.' #' @param frac.min.diff (Numeric) Fraction of cells expressing the gene must be at least this different between two populations to be considered. +#' @param auc.factor (Numeric) The precision-recall AUC is determined for a random classifier is determined based on the size of populations. To be considered differential, genes must have an AUC that is \code{auc.factor} times the expected AUC for a random classifier. +#' @param max.auc.threshold (Numeric) This acts as an upper bound for how high the AUC must be for a gene to be considered differential (i.e. you can choose that no matter the expectation for a random classifier, any gene with an AUC > 0.9 is considered differential). #' @param genes.use (Character vector) Genes to compare, default is NULL (all genes) #' #' @return (data.frame) #' #' @export -markersAUCPR <- function(object, clust.1=NULL, clust.2=NULL, cells.1=NULL, cells.2=NULL, clustering=NULL, effect.size=0.25, frac.must.express=0.1, exp.thresh=0, frac.min.diff=0, genes.use=NULL) { +markersAUCPR <- function(object, clust.1=NULL, clust.2=NULL, cells.1=NULL, cells.2=NULL, clustering=NULL, effect.size=0.25, frac.must.express=0.1, exp.thresh=0, frac.min.diff=0, auc.factor=1, max.auc.threshold=1, genes.use=NULL) { if (is.null(genes.use)) genes.use <- rownames(object@logupx.data) if (is.null(clustering)) { @@ -156,8 +158,14 @@ markersAUCPR <- function(object, clust.1=NULL, clust.2=NULL, cells.1=NULL, cells genes.data$AUCPR <- unlist(lapply(genes.use, function(gene) differentialAUCPR(object@logupx.data[gene,cells.1], object@logupx.data[gene,cells.2]))) genes.data[is.na(genes.data$AUCPR),"AUCPR"] <- 0 + # Calculate ratio, compared to AUCPR for random classifier, + thresh <- aucprThreshold(cells.1=cells.1, cells.2=cells.2) + thresh.select <- min(thresh, max.auc.threshold) + genes.data$AUCPR.ratio <- genes.data$AUCPR / thresh + genes.data <- genes.data[genes.data$AUCPR >= thresh.select,] + # Order by AUC - genes.data <- genes.data[order(genes.data$AUCPR, decreasing=T),c("AUCPR", "exp.fc", "frac.1", "frac.2", "exp.1", "exp.2")] + genes.data <- genes.data[order(genes.data$AUCPR, decreasing=T),c("AUCPR", "AUCPR.ratio", "exp.fc", "frac.1", "frac.2", "exp.1", "exp.2")] names(genes.data)[3:6] <- paste(c("posFrac", "posFrac", "nTrans", "nTrans"), c(clust.1, clust.2, clust.1, clust.2), sep="_") # Return @@ -298,15 +306,6 @@ binomTestAlongTree <- function(object, pseudotime, tips, log.effect.size=log(2), markers.2 <- markers.2[1:keep.markers.until] tip.list <- tip.list[1:keep.markers.until] } - - # # Now, determine the remaining markers - # if (must.beat.all.sibs) { - # markers.remain <- unique(unlist(lapply(unique(tip.list), function(tip) { - # Reduce(intersect, lapply(markers.2[which(tip.list == tip)], function(m) rownames(m)[m$log.effect > 0])) - # }))) - # } else { - # markers.remain <- unique(unlist(lapply(markers.2, function(m) rownames(m)[m$log.effect > 0]))) - # } # Now, determine how many siblings each marker beats and curate them. markers.3 <- markers.2 diff --git a/man/markersAUCPR.Rd b/man/markersAUCPR.Rd index be5aa10..0106e91 100644 --- a/man/markersAUCPR.Rd +++ b/man/markersAUCPR.Rd @@ -7,7 +7,7 @@ markersAUCPR(object, clust.1 = NULL, clust.2 = NULL, cells.1 = NULL, cells.2 = NULL, clustering = NULL, effect.size = 0.25, frac.must.express = 0.1, exp.thresh = 0, frac.min.diff = 0, - genes.use = NULL) + auc.factor = 1, max.auc.threshold = 1, genes.use = NULL) } \arguments{ \item{object}{An URD object} @@ -28,7 +28,10 @@ markersAUCPR(object, clust.1 = NULL, clust.2 = NULL, cells.1 = NULL, \item{exp.thresh}{(Numeric) Minimum expression value to consider 'expressed.'} -\item{frac.min.diff}{(Numeric) Fraction of cells expressing the gene must be at least this different between two populations to be considered.} +\item{frac.min.diff}{(Numeric) Fraction of cells expressing the gene must be at least this different between two populations to be considered. +@param auc.factor (Numeric) The precision-recall AUC is determined for a random classifier is determined based on the size of populations. To be considered differential, genes must have an AUC that is \code{auc.factor} times the expected AUC for a random classifier.} + +\item{max.auc.threshold}{(Numeric) This acts as an upper bound for how high the AUC must be for a gene to be considered differential (i.e. you can choose that no matter the expectation for a random classifier, any gene with an AUC > 0.9 is considered differential).} \item{genes.use}{(Character vector) Genes to compare, default is NULL (all genes)} } From 157db9a4e0ce993a2d524b29ecaf4b4dd6223f69 Mon Sep 17 00:00:00 2001 From: jfarrell Date: Tue, 6 Aug 2019 19:04:53 -0400 Subject: [PATCH 02/24] Fix labeling markersAUCPR --- R/diff-exp.R | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/R/diff-exp.R b/R/diff-exp.R index 86f172c..1b8212e 100644 --- a/R/diff-exp.R +++ b/R/diff-exp.R @@ -125,15 +125,22 @@ markersAUCPR <- function(object, clust.1=NULL, clust.2=NULL, cells.1=NULL, cells if (is.null(cells.1)) { if (is.null(clust.1)) stop("Must provide either cells.1 or clust.1") cells.1 <- names(clust.use[which(clust.use%in%clust.1)]) + label.1 <- clust.1 + } else { + label.1 <- "1" } if (is.null(cells.2)) { if (is.null(clust.2)) { clust.2 <- "rest" cells.2 <- setdiff(names(clust.use), cells.1) + label.2 <- "rest" } else { cells.2 <- names(clust.use[which(clust.use%in%clust.2)]) + label.2 <- clust.2 } + } else { + label.2 <- "2" } # Figure out proportion expressing and mean expression @@ -166,7 +173,7 @@ markersAUCPR <- function(object, clust.1=NULL, clust.2=NULL, cells.1=NULL, cells # Order by AUC genes.data <- genes.data[order(genes.data$AUCPR, decreasing=T),c("AUCPR", "AUCPR.ratio", "exp.fc", "frac.1", "frac.2", "exp.1", "exp.2")] - names(genes.data)[3:6] <- paste(c("posFrac", "posFrac", "nTrans", "nTrans"), c(clust.1, clust.2, clust.1, clust.2), sep="_") + names(genes.data)[4:7] <- paste(c("posFrac", "posFrac", "nTrans", "nTrans"), c(label.1, label.2, label.1, label.2), sep="_") # Return return(genes.data) From cfca0a6a4254998fe96b724370d514b39bd4b857 Mon Sep 17 00:00:00 2001 From: jfarrell Date: Thu, 8 Aug 2019 16:46:10 -0400 Subject: [PATCH 03/24] markersAUCPR now objects auc.factor --- R/diff-exp.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/diff-exp.R b/R/diff-exp.R index 1b8212e..481df49 100644 --- a/R/diff-exp.R +++ b/R/diff-exp.R @@ -167,7 +167,7 @@ markersAUCPR <- function(object, clust.1=NULL, clust.2=NULL, cells.1=NULL, cells # Calculate ratio, compared to AUCPR for random classifier, thresh <- aucprThreshold(cells.1=cells.1, cells.2=cells.2) - thresh.select <- min(thresh, max.auc.threshold) + thresh.select <- min(thresh * auc.factor, max.auc.threshold) genes.data$AUCPR.ratio <- genes.data$AUCPR / thresh genes.data <- genes.data[genes.data$AUCPR >= thresh.select,] From a3a338df9af64a30ff366c7b8fb1a270b749a772 Mon Sep 17 00:00:00 2001 From: jfarrell Date: Fri, 16 Aug 2019 15:41:23 -0400 Subject: [PATCH 04/24] Added plotTreeHighlight and highlighting functions to plotTree --- DESCRIPTION | 2 +- R/tree-plots.R | 53 ++++++++++++++++++++++++++++++++++++++-- man/plotTree.Rd | 9 ++++++- man/plotTreeHighlight.Rd | 35 ++++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 4 deletions(-) create mode 100644 man/plotTreeHighlight.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 3e87433..d32d1a5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: URD Title: URD -Version: 1.1.0.9000 +Version: 1.1.0.9001 Authors@R: person("Jeffrey", "Farrell", email = "jfarrell@g.harvard.edu", role = c("aut", "cre")) Description: URD reconstructs transcriptional trajectories underlying specification or differentiation processes in the form of a branching tree from single-cell RNAseq data. Depends: diff --git a/R/tree-plots.R b/R/tree-plots.R index 59eaa59..ef16b9e 100644 --- a/R/tree-plots.R +++ b/R/tree-plots.R @@ -25,11 +25,14 @@ #' @param color.limits (Numeric vector, length 2) Minimum and maximum values for color scale. Default \code{NULL} auto-detects. #' @param symmetric.color.scale (Logical) Should the color scale be symmetric and centered around 0? (Default \code{NULL} is \code{FALSE} if all values are positive, and \code{TRUE} if both positive and negative values are present.) #' @param hide.y.ticks (Logical) Should the pseudotime values on the y-axis be hidden? +#' @param cells.highlight (Character vector) Group of cells to plot last, ensuring that they are highlighted on the tree. +#' @param cells.highlight.alpha (Numeric) Transparency of highlighted cells (0 is transparent, 1 is opaque) +#' @param cells.highlight.size (Numeric) Size of highlighted cells #' #' @return A ggplot2 object #' #' @export -plotTree <- function(object, label=NULL, label.type="search", title=label, legend=T, legend.title="", legend.point.size=6*cell.size, plot.tree=T, tree.alpha=1, tree.size=1, plot.cells=T, cell.alpha=0.25, cell.size=0.5, label.x=T, label.segments=F, discrete.ignore.na=F, color.tree=NULL, continuous.colors=NULL, discrete.colors=NULL, color.limits=NULL, symmetric.color.scale=NULL, hide.y.ticks=T) { +plotTree <- function(object, label=NULL, label.type="search", title=label, legend=T, legend.title="", legend.point.size=6*cell.size, plot.tree=T, tree.alpha=1, tree.size=1, plot.cells=T, cell.alpha=0.25, cell.size=0.5, label.x=T, label.segments=F, discrete.ignore.na=F, color.tree=NULL, continuous.colors=NULL, discrete.colors=NULL, color.limits=NULL, symmetric.color.scale=NULL, hide.y.ticks=T, cells.highlight=NULL, cells.highlight.alpha=1, cells.highlight.size=2) { # Validation of parameters if (class(object) != "URD") stop("Must provide an URD object as input to plotTree.") @@ -110,7 +113,15 @@ plotTree <- function(object, label=NULL, label.type="search", title=label, legen cell.layout$expression <- color.data[cell.layout$cell, "value"] } # With color - the.plot <- the.plot + geom_point(data=cell.layout, aes(x=x,y=y,color=expression), alpha=cell.alpha, size=cell.size) + if (is.null(cells.highlight)) { + # Plot all cells. + the.plot <- the.plot + geom_point(data=cell.layout, aes(x=x,y=y,color=expression), alpha=cell.alpha, size=cell.size) + } else { + # Plot non-highlighted cells + the.plot <- the.plot + geom_point(data=cell.layout[setdiff(rownames(cell.layout), cells.highlight),], aes(x=x,y=y,color=expression), alpha=cell.alpha, size=cell.size) + # Plot highlighted cells + the.plot <- the.plot + geom_point(data=cell.layout[cells.highlight,], aes(x=x,y=y,color=expression), alpha=cells.highlight.alpha, size=cells.highlight.size) + } } else { # Just plain black if no label the.plot <- the.plot + geom_point(data=cell.layout, aes(x=x,y=y), alpha=cell.alpha, size=cell.size) @@ -187,6 +198,44 @@ plotTree <- function(object, label=NULL, label.type="search", title=label, legen return(the.plot) } +#' Plot 2D Dendrogram of URD Tree (with cells that meet arbitrary criteria highlighted) +#' +#' This produces an URD dendrogram with cells that meet any group of arbitrary criteria highlighted on the tree. It uses the \code{highlight.cells}, \code{highlight.cells.alpha}, and \code{highlight.cells.size} parameters of \code{\link{plotTree}} which can alternatively be used to accomplish this. +#' +#' @param object An URD object +#' @param label.name (Character vector) Data to use for selecting cells, see \link{data.for.plot} +#' @param label.value (List of vectors) List of same length as \code{label.name}; Each entry is the acceptable values for the corresponding entry in \code{label.name} +#' @param color (Character) Color to use for highlighted cells +#' @param bg.color (Character) Color to use for non-highlighted cells +#' @param highlight.alpha (Numeric) Transparency of highlighted cells (0 is fully transparent, 1 is fully opaque) +#' @param highlight.size (Numeric) Size of points of highlighted cells +#' @param combine (Character) Should highlighted cells be the \code{intersect} (i.e. cells that meet ALL criteria) or the \code{union} (i.e. cells that meet any criteria) +#' @param ... all additional parameters are passed to \code{\link{plotTree}} +#' +#' @return A ggplot2 object +#' @export +plotTreeHighlight <- function(object, label.name, label.value, color="red", bg.color="#CCCCCC", highlight.alpha=0.6, highlight.size=1.5, combine=c("intersect", "union"), ...) { + # Parse input + if (length(label.name) != length(label.value)) stop("label.name must be a vector and label.value must be a list of the same length as label.name") + if (length(combine) > 1) combine <- combine[1] + + # Get cells that meet all criteria + cell.lists <- lapply(1:length(label.name), function(i) whichCells(object, label = label.name[i], value = label.value[[i]])) + if (tolower(combine) == "intersect") { + cells.highlight <- names(which(table(unlist(cell.lists)) == length(cell.lists))) + } else if (tolower(combine) == "union") { + cells.highlight <- unique(unlist(cell.lists)) + } else { + stop("combine must be 'intersect' or 'union'.") + } + # Make a fake group.id for them + object@group.ids$data.plot <- "NO" + object@group.ids[cells.highlight, "data.plot"] <- "YES" + + # Do the plot + return(plotTree(object, "data.plot", discrete.colors=c(bg.color, color), cells.highlight = cells.highlight, legend = F, cells.highlight.alpha = highlight.alpha, cells.highlight.size = highlight.size, ...)) +} + #' Plot 2D Dendrogram of URD Tree #' #' @import ggplot2 diff --git a/man/plotTree.Rd b/man/plotTree.Rd index 28b638b..d0b6086 100644 --- a/man/plotTree.Rd +++ b/man/plotTree.Rd @@ -10,7 +10,8 @@ plotTree(object, label = NULL, label.type = "search", title = label, cell.alpha = 0.25, cell.size = 0.5, label.x = T, label.segments = F, discrete.ignore.na = F, color.tree = NULL, continuous.colors = NULL, discrete.colors = NULL, color.limits = NULL, - symmetric.color.scale = NULL, hide.y.ticks = T) + symmetric.color.scale = NULL, hide.y.ticks = T, cells.highlight = NULL, + cells.highlight.alpha = 1, cells.highlight.size = 2) } \arguments{ \item{object}{An URD object} @@ -55,6 +56,12 @@ plotTree(object, label = NULL, label.type = "search", title = label, \item{hide.y.ticks}{(Logical) Should the pseudotime values on the y-axis be hidden?} +\item{cells.highlight}{(Character vector) Group of cells to plot last, ensuring that they are highlighted on the tree.} + +\item{cells.highlight.alpha}{(Numeric) Transparency of highlighted cells (0 is transparent, 1 is opaque)} + +\item{cells.highlight.size}{(Numeric) Size of highlighted cells} + \item{plot.tree}{(Logical) Whether cells should be plotted with the tree} } \value{ diff --git a/man/plotTreeHighlight.Rd b/man/plotTreeHighlight.Rd new file mode 100644 index 0000000..42d96e5 --- /dev/null +++ b/man/plotTreeHighlight.Rd @@ -0,0 +1,35 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/tree-plots.R +\name{plotTreeHighlight} +\alias{plotTreeHighlight} +\title{Plot 2D Dendrogram of URD Tree (with cells that meet arbitrary criteria highlighted)} +\usage{ +plotTreeHighlight(object, label.name, label.value, color = "red", + bg.color = "#CCCCCC", highlight.alpha = 0.6, highlight.size = 1.5, + combine = c("intersect", "union"), ...) +} +\arguments{ +\item{object}{An URD object} + +\item{label.name}{(Character vector) Data to use for selecting cells, see \link{data.for.plot}} + +\item{label.value}{(List of vectors) List of same length as \code{label.name}; Each entry is the acceptable values for the corresponding entry in \code{label.name}} + +\item{color}{(Character) Color to use for highlighted cells} + +\item{bg.color}{(Character) Color to use for non-highlighted cells} + +\item{highlight.alpha}{(Numeric) Transparency of highlighted cells (0 is fully transparent, 1 is fully opaque)} + +\item{highlight.size}{(Numeric) Size of points of highlighted cells} + +\item{combine}{(Character) Should highlighted cells be the \code{intersect} (i.e. cells that meet ALL criteria) or the \code{union} (i.e. cells that meet any criteria)} + +\item{...}{all additional parameters are passed to \code{\link{plotTree}}} +} +\value{ +A ggplot2 object +} +\description{ +This produces an URD dendrogram with cells that meet any group of arbitrary criteria highlighted on the tree. It uses the \code{highlight.cells}, \code{highlight.cells.alpha}, and \code{highlight.cells.size} parameters of \code{\link{plotTree}} which can alternatively be used to accomplish this. +} From 57e184d3b8f53265582f835b6367f8c41f31ee7a Mon Sep 17 00:00:00 2001 From: jfarrell Date: Fri, 16 Aug 2019 17:18:04 -0400 Subject: [PATCH 05/24] Added additional customizations to plotDot and plotViolin --- R/plot-genes.R | 29 ++++++++++++++++++++++++----- man/plotDot.Rd | 11 ++++++++++- man/plotViolin.Rd | 3 ++- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/R/plot-genes.R b/R/plot-genes.R index c2a4b1c..6e5b4ca 100644 --- a/R/plot-genes.R +++ b/R/plot-genes.R @@ -7,13 +7,27 @@ #' @param clustering (Character) Name of clustering to use (i.e. a column name of \code{@@group.ids}) #' @param clusters.use (Character vector) Names of specific clusters to plot (default: all clusters) #' @param min.exp (Numeric) Minimum proportion of expressing cells (0-1) to be shown on the plot +#' @param size.min (Numeric) Point size for clusters with no cells expressing +#' @param size.max (Numeric) Point size for clusters with all cells expressing +#' @param scale.by (Character) Should point size scale by \code{radius} or \code{area}? See \code{\link[ggplot2]{scale_radius}} and \code{\link[ggplot2]{scale_size}}. +#' @param colors (Character vector) Vector of colors to use for a palette. #' @param mean.expressing.only (Logical) Should mean expression value exclude cells with no expression #' @param title (Character) How should the plot be titled? (Default: no title) #' #' @return A ggplot2 object #' #' @export -plotDot <- function(object, genes, clustering, clusters.use=NULL, min.exp=.05, mean.expressing.only=F, title="") { +plotDot <- function(object, genes, clustering, clusters.use=NULL, min.exp=.05, size.min=0, size.max=5, scale.by=c("radius", "area"), colors=NULL, mean.expressing.only=F, title="") { + # Decide on scale function + if (length(scale.by) > 1) scale.by <- scale.by[1] + if (tolower(scale.by) == "radius") { + scale.by <- ggplot2::scale_radius + } else if (tolower(scale.by) == "area") { + scale.by <- ggplot2::scale_size + } else { + stop("scale.by must be 'radius' or 'area'.") + } + # Get data out that you want to plot cluster.ids <- object@group.ids[colnames(object@logupx.data), clustering] if (is.null(clusters.use)) clusters.use <- sort(unique(cluster.ids)) @@ -32,11 +46,16 @@ plotDot <- function(object, genes, clustering, clusters.use=NULL, min.exp=.05, m names(expr.melt) <- c("Cluster", "Gene", "Prop.Exp") gg.data <- merge(mean.melt, expr.melt) - # Remove values where proportion expressing is too small and should not be plotted. + # Remove values where proportion expressing is too small and should not be plotted gg.data <- gg.data[which(gg.data$Prop.Exp >= min.exp),] + # Turn proportion into % + gg.data$Prop.Exp <- 100 * gg.data$Prop.Exp + + if (is.null(colors)) colors <- defaultURDContinuousColors(evenly.spaced=T) + # Go ahead and ggplot - the.plot <- ggplot(data=gg.data, aes(x=Cluster, y=Gene, color=Mean, size=Prop.Exp)) + geom_point() + scale_color_gradientn(colours = defaultURDContinuousColors()) + ggtitle(title) + scale_y_discrete(limits=rev(genes)) + the.plot <- ggplot(data=gg.data, aes(x=Cluster, y=Gene, color=Mean, size=Prop.Exp)) + geom_point() + scale_color_gradientn(colours = colors) + ggtitle(title) + scale_y_discrete(limits=rev(genes)) + scale.by(range=c(size.min,size.max), name="% Exp", breaks=c(20,40,60,80,100), limits=c(0,100)) if (!is.null(clusters.use)) the.plot <- the.plot + scale_x_discrete(limits=clusters.use) return(the.plot) } @@ -55,7 +74,7 @@ plotDot <- function(object, genes, clustering, clusters.use=NULL, min.exp=.05, m #' @return A ggplot2 object #' #' @export -plotViolin <- function(object, labels.plot, clustering, clusters.use=NULL, legend=T, free.axes=F) { +plotViolin <- function(object, labels.plot, clustering, clusters.use=NULL, legend=T, free.axes=F, point.size=0.2, point.color='black', point.alpha=0.5) { # Get data.to.plot data.plot <- as.data.frame(lapply(labels.plot, function (label) { data.for.plot(object = object, label=label) @@ -72,7 +91,7 @@ plotViolin <- function(object, labels.plot, clustering, clusters.use=NULL, legen data.plot.melt <- reshape2::melt(data.plot, id.vars = c("Cell", "Cluster")) data.plot.melt$Cluster <- factor(data.plot.melt$Cluster, levels=cluster.names, ordered=T) if (free.axes) {free="free"} else {free="fixed"} - the.plot <- ggplot(data.plot.melt, aes(x=Cluster, y=value, fill=Cluster)) + geom_violin() + facet_wrap(~variable, scales=free) + geom_jitter(size=0.5) + ylab("Expression (log2)") + theme_bw() + the.plot <- ggplot(data.plot.melt, aes(x=Cluster, y=value, fill=Cluster)) + geom_violin() + facet_wrap(~variable, scales=free) + geom_jitter(size=point.size, color=point.color, alpha=point.alpha) + ylab("Expression (log2)") + theme_bw() if (!legend) the.plot <- the.plot + guides(fill=F) return(the.plot) } diff --git a/man/plotDot.Rd b/man/plotDot.Rd index 4fae28b..0f97558 100644 --- a/man/plotDot.Rd +++ b/man/plotDot.Rd @@ -5,7 +5,8 @@ \title{Dot Plot} \usage{ plotDot(object, genes, clustering, clusters.use = NULL, min.exp = 0.05, - mean.expressing.only = F, title = "") + size.min = 0, size.max = 5, scale.by = c("radius", "area"), + colors = NULL, mean.expressing.only = F, title = "") } \arguments{ \item{object}{An URD object} @@ -18,6 +19,14 @@ plotDot(object, genes, clustering, clusters.use = NULL, min.exp = 0.05, \item{min.exp}{(Numeric) Minimum proportion of expressing cells (0-1) to be shown on the plot} +\item{size.min}{(Numeric) Point size for clusters with no cells expressing} + +\item{size.max}{(Numeric) Point size for clusters with all cells expressing} + +\item{scale.by}{(Character) Should point size scale by \code{radius} or \code{area}? See \code{\link[ggplot2]{scale_radius}} and \code{\link[ggplot2]{scale_size}}.} + +\item{colors}{(Character vector) Vector of colors to use for a palette.} + \item{mean.expressing.only}{(Logical) Should mean expression value exclude cells with no expression} \item{title}{(Character) How should the plot be titled? (Default: no title)} diff --git a/man/plotViolin.Rd b/man/plotViolin.Rd index 7563eb2..92eed56 100644 --- a/man/plotViolin.Rd +++ b/man/plotViolin.Rd @@ -5,7 +5,8 @@ \title{Violin plot of gene expression} \usage{ plotViolin(object, labels.plot, clustering, clusters.use = NULL, legend = T, - free.axes = F) + free.axes = F, point.size = 0.2, point.color = "black", + point.alpha = 0.5) } \arguments{ \item{object}{An URD object} From d198d421dfcce860cddaea446bf9cf5e23ec6d3d Mon Sep 17 00:00:00 2001 From: jfarrell Date: Fri, 16 Aug 2019 17:18:28 -0400 Subject: [PATCH 06/24] Added a more evenly spaced color scale --- R/data-for-plot.R | 8 +++++++- man/defaultURDContinuousColors.Rd | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/R/data-for-plot.R b/R/data-for-plot.R index 919caab..826cd01 100644 --- a/R/data-for-plot.R +++ b/R/data-for-plot.R @@ -166,7 +166,7 @@ data.for.plot <- function(object, label, label.type=c("search", "meta", "group", #' @export #' #' @keywords internal -defaultURDContinuousColors <- function(with.grey=F, symmetric=F) { +defaultURDContinuousColors <- function(with.grey=F, symmetric=F, evenly.spaced=F) { if (symmetric) { return(c("#B3006B", "#C04981", "#CA7197", "#D396AE", "#D9B9C5", "#DDDDDD", "#BFD6B7", "#A0CE91", "#7FC66B", "#57BD43", "#0CB300")) @@ -176,6 +176,12 @@ defaultURDContinuousColors <- function(with.grey=F, symmetric=F) { "#00F2FF", "#27FFD7", "#8CFF71", "#F1FF0D", "#FFEE00", "#FFDB00", "#FFC900", "#FFB700", "#FFA500", "#FF9200", "#FF8000", "#FF6D00", "#FF5B00", "#FF4800", "#FF3600", "#FF2400", "#FF1200", "#FF0000")) + } else if (evenly.spaced) { + return(c("#0000FF", "#0023FF", "#0046FF", "#0069FF", "#008CFF", "#00AFFF", + "#00D2FF", "#00F6FF", "#1AFFE4", "#3DFFC1", "#60FF9D", "#83FF7A", + "#A6FF57", "#CAFF34", "#EDFF11", "#FFF800", "#FFEC00", "#FFDF00", + "#FFD300", "#FFC700", "#FFBA00", "#FFAE00", "#FF9F00", "#FF8800", + "#FF7100", "#FF5A00", "#FF4300", "#FF2D00", "#FF1600", "#FF0000")) } else { return(c("#0000FF", "#0013FF", "#0028FF", "#003CFF", "#0050FF", "#0065FF", "#0078FF", "#008DFF", "#00A1FF", "#00B5FF", "#00CAFF", "#00DEFF", diff --git a/man/defaultURDContinuousColors.Rd b/man/defaultURDContinuousColors.Rd index f58f4f5..4dd187f 100644 --- a/man/defaultURDContinuousColors.Rd +++ b/man/defaultURDContinuousColors.Rd @@ -4,7 +4,8 @@ \alias{defaultURDContinuousColors} \title{Default URD continuous colors} \usage{ -defaultURDContinuousColors(with.grey = F, symmetric = F) +defaultURDContinuousColors(with.grey = F, symmetric = F, + evenly.spaced = F) } \value{ Vector of default colors From b2c03d5acd699294c884ec10e599b6c364965d91 Mon Sep 17 00:00:00 2001 From: jfarrell Date: Fri, 16 Aug 2019 17:18:59 -0400 Subject: [PATCH 07/24] Corrected exp.fc which was not taking pseudocount of 1 into account when determining FC --- R/diff-exp.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/diff-exp.R b/R/diff-exp.R index 481df49..a10907f 100644 --- a/R/diff-exp.R +++ b/R/diff-exp.R @@ -150,7 +150,8 @@ markersAUCPR <- function(object, clust.1=NULL, clust.2=NULL, cells.1=NULL, cells exp.1=round(apply(object@logupx.data[genes.use, cells.1, drop=F], 1, mean.of.logs), digits=3), exp.2=round(apply(object@logupx.data[genes.use, cells.2, drop=F], 1, mean.of.logs), digits=3) ) - genes.data$exp.fc <- genes.data$exp.1 - genes.data$exp.2 + genes.data$exp.fc <- log2((2^genes.data$exp.1-1)/(2^genes.data$exp.2-1)) + #genes.data$exp.fc <- genes.data$exp.1 - genes.data$exp.2 # Throw out genes that don't mark either population or obviously change between the two # populations to reduce downstream computation. From eae1a5fd7b352480ec39136c3b07d85ea919bd0c Mon Sep 17 00:00:00 2001 From: jfarrell Date: Fri, 16 Aug 2019 17:19:41 -0400 Subject: [PATCH 08/24] Added combineSmoothFit --- R/gene-smooth.R | 44 +++++++++++++++++------------------------ man/combineSmoothFit.Rd | 11 ++++------- 2 files changed, 22 insertions(+), 33 deletions(-) diff --git a/R/gene-smooth.R b/R/gene-smooth.R index e998acf..fc2532c 100644 --- a/R/gene-smooth.R +++ b/R/gene-smooth.R @@ -278,42 +278,34 @@ cropSmoothFit <- function(smoothed.fit, pt.min=-Inf, pt.max=Inf) { #' Gene Smooth: Combine smoothed fits #' -#' ??? +#' This function takes a list of smoothed.fits (i.e. output from \code{\link{geneSmoothFit}}) and combines them in the order provided into a single smoothed fit. This is useful, for instance, for combining multiple pieces of fits together for plotting on a heatmap with several panels. #' -#' @param smoothed.fit (List) A list of smoothed.fits to combine -#' @param fits.use (Character) Names of smoothed.fits in the list to use -#' @return (List) -#' @keywords internal -combineSmoothFit <- function(smoothed.fit, fits.use) { - # Grab those smoothed fits that you want to use - if (!all(fits.use %in% names(smoothed.fit))) { - absent.names <- setdiff(fits.use, names(smoothed.fit)) - stop("The following fits.use are not present in smoothed.fit: ", paste(absent.names, collapse=" ")) - } - smoothed.fit <- smoothed.fit[fits.use] - +#' @param fit.list (List) A list of smoothed.fits to combine +#' @return (List) Akin to a single output from \code{\link{geneSmoothFit}}. +#' @export +#' +combineSmoothFit <- function(fit.list) { # Grab pseudotime names - pt.names.full <- unlist(lapply(smoothed.fit, function(x) colnames(x$mean.expression))) - pt.names.red <- unlist(lapply(smoothed.fit, function(x) colnames(x$mean.smooth))) + pt.names.full <- unlist(lapply(fit.list, function(x) colnames(x$mean.expression))) + pt.names.red <- unlist(lapply(fit.list, function(x) colnames(x$mean.smooth))) # Combine the many elements of each entry in the list - out.mean.expression <- do.call("cbind", lapply(smoothed.fit, function(x) x$mean.expression)) + out.mean.expression <- do.call("cbind", lapply(fit.list, function(x) x$mean.expression)) colnames(out.mean.expression) <- pt.names.full - out.scaled.expression <- do.call("cbind", lapply(smoothed.fit, function(x) x$scaled.expression)) - colnames(out.scaled.expression) <- pt.names.full - out.mean.smooth <- do.call("cbind", lapply(smoothed.fit, function(x) x$mean.smooth)) + out.mean.smooth <- do.call("cbind", lapply(fit.list, function(x) x$mean.smooth)) colnames(out.mean.smooth) <- pt.names.red - out.scaled.smooth <- do.call("cbind", lapply(smoothed.fit, function(x) x$scaled.smooth)) - colnames(out.scaled.smooth) <- pt.names.red - out.mean.expression.red <- do.call("cbind", lapply(smoothed.fit, function(x) x$mean.expression.red)) + out.mean.expression.red <- do.call("cbind", lapply(fit.list, function(x) x$mean.expression.red)) colnames(out.mean.expression.red) <- pt.names.red - out.scaled.expression.red <- do.call("cbind", lapply(smoothed.fit, function(x) x$scaled.expression.red)) - colnames(out.scaled.expression.red) <- pt.names.red - out.method <- unique(unlist(lapply(smoothed.fit, function(x) x$method))) + out.method <- unique(unlist(lapply(fit.list, function(x) x$method))) if (length(out.method) > 1) warning("Smoothing method of all inputs was not the same.") - out.pt.windows <- unlist(lapply(smoothed.fit, function(x) x$pt.windows), recursive = F) + out.pt.windows <- unlist(lapply(fit.list, function(x) x$pt.windows), recursive = F) names(out.pt.windows) <- pt.names.full + # Re-scale scaled values according to the max of any present + out.scaled.expression <- sweep(out.mean.expression, 1, apply(out.mean.expression, 1, max), "/") + out.scaled.smooth <- sweep(out.mean.smooth, 1, apply(out.mean.smooth, 1, max), "/") + out.scaled.expression.red <- sweep(out.mean.expression.red, 1, apply(out.mean.expression.red, 1, max), "/") + # Return a new list return(list( pt.windows=out.pt.windows, diff --git a/man/combineSmoothFit.Rd b/man/combineSmoothFit.Rd index 085cb07..7742288 100644 --- a/man/combineSmoothFit.Rd +++ b/man/combineSmoothFit.Rd @@ -4,17 +4,14 @@ \alias{combineSmoothFit} \title{Gene Smooth: Combine smoothed fits} \usage{ -combineSmoothFit(smoothed.fit, fits.use) +combineSmoothFit(fit.list) } \arguments{ -\item{smoothed.fit}{(List) A list of smoothed.fits to combine} - -\item{fits.use}{(Character) Names of smoothed.fits in the list to use} +\item{fit.list}{(List) A list of smoothed.fits to combine} } \value{ -(List) +(List) Akin to a single output from \code{\link{geneSmoothFit}}. } \description{ -??? +This function takes a list of smoothed.fits (i.e. output from \code{\link{geneSmoothFit}}) and combines them in the order provided into a single smoothed fit. This is useful, for instance, for combining multiple pieces of fits together for plotting on a heatmap with several panels. } -\keyword{internal} From a5bbd279701dc49c7bee66604ca7e6e664506a2f Mon Sep 17 00:00:00 2001 From: jfarrell Date: Fri, 16 Aug 2019 17:20:41 -0400 Subject: [PATCH 09/24] pseudotimeMovingWindow has option to have min pseudotime and cells simultaneously --- R/gene-cascade.R | 55 +++++++++++++++++++++++++++++++++-- man/pseudotimeMovingWindow.Rd | 2 +- 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/R/gene-cascade.R b/R/gene-cascade.R index f21f330..81f50bb 100644 --- a/R/gene-cascade.R +++ b/R/gene-cascade.R @@ -1,6 +1,6 @@ #' Moving window through pseudotime #' -#' Generates lists of cells using a moving window. Size of windows is either determined by pseudotime (if \code{pseudotime.per.window} is set) or by number of cells (if \code{cells.per.window} is set). +#' Generates lists of cells using a moving window. Size of windows is either determined by pseudotime (if \code{pseudotime.per.window} is set) or by number of cells (if \code{cells.per.window} is set). If both are set, windows are determined by number of cells, but then windows whose pseudotime differ by less than \code{pseudotime.per.window} are collapsed. #' #' @param object A URD object #' @param pseudotime (Character) Name of column in \code{@@pseudotime} to use for pseudotime @@ -34,7 +34,6 @@ pseudotimeMovingWindow <- function(object, pseudotime, cells, moving.window, cel pt.cut <- cut(pt, n.windows, labels = FALSE) c.windows <- lapply(1:n.windows, function(x) return(cells[which(pt.cut==x)])) - } else { n.windows <- round(length(cells) / cells.per.window) c.windows.end <- round((1:n.windows) * (length(cells) / n.windows)) @@ -59,6 +58,58 @@ pseudotimeMovingWindow <- function(object, pseudotime, cells, moving.window, cel return(pt.windows) } +pseudotimeMovingWindow <- function(object, pseudotime, cells, moving.window, cells.per.window=NULL, pseudotime.per.window=NULL, name.by=c("mean","min","max")) { + # Configure function to work based on mode + # This is a hacky patch... + if (!is.null(pseudotime.per.window) && is.null(cells.per.window)) { + moving.pt.window <- T + } else if (!is.null(cells.per.window)) { + moving.pt.window <- F + } else stop("Define either cells.per.window or pseudotime.per.window.") + + # Figure out pseudotime of cells + pt <- object@pseudotime[cells,pseudotime] + pt.order <- order(pt) + + # Figure out window size + if (moving.pt.window) { + n.windows <- round((max(pt,na.rm=T)-min(pt,na.rm=T)) / pseudotime.per.window) + pt.cut <- cut(pt, n.windows, labels = FALSE) + c.windows <- lapply(1:n.windows, function(x) return(cells[which(pt.cut==x)])) + } else { + n.windows <- round(length(cells) / cells.per.window) + c.windows.end <- round((1:n.windows) * (length(cells) / n.windows)) + c.windows.start <- c(0,head(c.windows.end, -1))+1 + c.windows <- lapply(1:n.windows, function(window) return(cells[pt.order[c.windows.start[window]:c.windows.end[window]]])) + } + + # Assign cells to windows + i.windows <- embed(x=1:n.windows, dimension=moving.window) + pt.windows <- lapply(1:dim(i.windows)[1], function(window) unlist(c.windows[i.windows[window,]])) + + # Remove any empty window (can occur in pseudotime.per.window mode) + if (moving.pt.window) { + pt.windows <- pt.windows[which(unlist(lapply(pt.windows, length))>0)] + } + + # Figure out min/mean/max pseudotime of each window and name list. + if (length(name.by) > 1) name.by <- name.by[1] + namefunc <- get(name.by) + names(pt.windows) <- round(unlist(lapply(pt.windows, function(window.cells) namefunc(object@pseudotime[window.cells,pseudotime]))), digits=3) + + # If both cells.per.window & pseudotime.per.window, collapse windows with not enough pseudotime diff + if (!is.null(cells.per.window) && !is.null(pseudotime.per.window)) { + window.pt.int <- floor(as.numeric(names(pt.windows)) / pseudotime.per.window) + pt.windows.new <- lapply(unique(window.pt.int), function(i) { + unique(unlist(pt.windows[which(window.pt.int == i)])) + }) + names(pt.windows.new) <- round(unlist(lapply(pt.windows.new, function(window.cells) namefunc(object@pseudotime[window.cells,pseudotime]))), digits=3) + pt.windows <- pt.windows.new + } + + return(pt.windows) +} + #' Gene Cascade: Fit expression of genes #' #' This takes a group of genes and cells, averages gene expression in groups of cells (determined using a moving window through pseudotime), and then fits either a linear, single sigmoid, or double sigmoid ("impulse") model to describe the expression of each gene. The results are returned for use in \code{\link{geneCascadeImpulsePlots}} to visualize the fits or \code{\link{geneCascadeHeatmap}} to plot gene expression cascades in heatmap format. diff --git a/man/pseudotimeMovingWindow.Rd b/man/pseudotimeMovingWindow.Rd index 8568dc7..7cdb86d 100644 --- a/man/pseudotimeMovingWindow.Rd +++ b/man/pseudotimeMovingWindow.Rd @@ -27,6 +27,6 @@ pseudotimeMovingWindow(object, pseudotime, cells, moving.window, List of windows of cells, named by either the mean, min, or max pseudotime of those cells (depending on \code{name.by}). } \description{ -Generates lists of cells using a moving window. Size of windows is either determined by pseudotime (if \code{pseudotime.per.window} is set) or by number of cells (if \code{cells.per.window} is set). +Generates lists of cells using a moving window. Size of windows is either determined by pseudotime (if \code{pseudotime.per.window} is set) or by number of cells (if \code{cells.per.window} is set). If both are set, windows are determined by number of cells, but then windows whose pseudotime differ by less than \code{pseudotime.per.window} are collapsed. } \keyword{internal} From 44e34520cbcd24819de951f25236a719711fc0db Mon Sep 17 00:00:00 2001 From: jfarrell Date: Fri, 16 Aug 2019 17:21:04 -0400 Subject: [PATCH 10/24] Bump 1.1.0.9002 --- DESCRIPTION | 2 +- NAMESPACE | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index d32d1a5..76748b5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: URD Title: URD -Version: 1.1.0.9001 +Version: 1.1.0.9002 Authors@R: person("Jeffrey", "Farrell", email = "jfarrell@g.harvard.edu", role = c("aut", "cre")) Description: URD reconstructs transcriptional trajectories underlying specification or differentiation processes in the form of a branching tree from single-cell RNAseq data. Depends: diff --git a/NAMESPACE b/NAMESPACE index 7e02354..07d3a5d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -25,6 +25,7 @@ export(cellsInCluster) export(clusterCentroids) export(clusterDE) export(clusterTipPotential) +export(combineSmoothFit) export(combineTipVisitation) export(corner) export(createURD) @@ -93,6 +94,7 @@ export(plotTreeForce) export(plotTreeForce2D) export(plotTreeForceDual) export(plotTreeForceStore3DView) +export(plotTreeHighlight) export(plotViolin) export(pmax.abs) export(preference) From 3e22ec73d3aa73183edec33546ec017a39eee18f Mon Sep 17 00:00:00 2001 From: jfarrell Date: Mon, 16 Sep 2019 15:13:37 -0400 Subject: [PATCH 11/24] Fix bug introduced in aucprTestAlongTree introduced by updates to markersAUCPR --- DESCRIPTION | 2 +- R/diff-exp.R | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 76748b5..b017821 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: URD Title: URD -Version: 1.1.0.9002 +Version: 1.1.0.9003 Authors@R: person("Jeffrey", "Farrell", email = "jfarrell@g.harvard.edu", role = c("aut", "cre")) Description: URD reconstructs transcriptional trajectories underlying specification or differentiation processes in the form of a branching tree from single-cell RNAseq data. Depends: diff --git a/R/diff-exp.R b/R/diff-exp.R index a10907f..5ff8062 100644 --- a/R/diff-exp.R +++ b/R/diff-exp.R @@ -448,13 +448,12 @@ aucprTestAlongTree <- function(object, pseudotime, tips, log.effect.size=0.25, a stats <- rbind(stats, c(n.1, n.2, pt.1.mean, pt.2.mean, pt.1.median, pt.2.median, genes.1.mean, genes.2.mean, genes.1.median, genes.2.median, trans.1.mean, trans.2.mean, trans.1.median, trans.2.median)) } # Test for markers of these cells with AUCPR test - these.markers <- markersAUCPR(object=object, cells.1=cells.1, cells.2=cells.2, genes.use=genes.use, effect.size=log.effect.size, frac.must.express=frac.must.express, frac.min.diff=frac.min.diff) - these.markers$AUCPR.ratio <- these.markers$AUCPR / aucprThreshold(cells.1, cells.2, factor=1, max.auc=Inf) + these.markers <- markersAUCPR(object=object, cells.1=cells.1, cells.2=cells.2, genes.use=genes.use, effect.size=log.effect.size, frac.must.express=frac.must.express, frac.min.diff=frac.min.diff, auc.factor = auc.factor, max.auc.threshold = max.auc.threshold) # Since AUCPR is not symmetric, must test explicitly for markers of the other branch ("anti-marker") - these.anti.markers <- markersAUCPR(object=object, cells.1=cells.2, cells.2=cells.1, genes.use=genes.use, effect.size=log.effect.size, frac.must.express=frac.must.express, frac.min.diff=frac.min.diff) + these.anti.markers <- markersAUCPR(object=object, cells.1=cells.2, cells.2=cells.1, genes.use=genes.use, effect.size=log.effect.size, frac.must.express=frac.must.express, frac.min.diff=frac.min.diff, auc.factor = auc.factor, max.auc.threshold = max.auc.threshold) # Limit markers to those that pass the minimum AUC and are positive markers of their respective branch - markers[[(length(markers)+1)]] <- these.markers[these.markers$AUCPR >= aucprThreshold(cells.1, cells.2, factor = auc.factor, max.auc = max.auc.threshold) & these.markers$exp.fc > 0,] - anti.markers[[(length(anti.markers)+1)]] <- these.anti.markers[these.anti.markers$AUCPR >= aucprThreshold(cells.2, cells.1, factor = auc.factor, max.auc = max.auc.threshold) & these.anti.markers$exp.fc > 0,] + markers[[(length(markers)+1)]] <- these.markers[these.markers$exp.fc > 0,] + anti.markers[[(length(anti.markers)+1)]] <- these.anti.markers[these.anti.markers$exp.fc > 0,] names(markers)[length(markers)] <- paste0(current.tip, "-", opposing.tip) names(anti.markers)[length(anti.markers)] <- paste0(current.tip, "-", opposing.tip) } @@ -507,19 +506,17 @@ aucprTestAlongTree <- function(object, pseudotime, tips, log.effect.size=0.25, a # Summarize data by calculating across _all_ cells considered, and also max and min passing (by AUCPR.ratio) in any branch. if (only.return.global) { - markers.summary <- markersAUCPR(object=object, cells.1=cells.1.all, cells.2=cells.2.all, genes.use=markers.remain, frac.must.express = frac.must.express, effect.size=log.effect.size, frac.min.diff=frac.min.diff) - markers.summary <- markers.summary[markers.summary$AUCPR >= aucprThreshold(cells.1.all, cells.2.all, factor = auc.factor, max.auc = max.auc.threshold),] + markers.summary <- markersAUCPR(object=object, cells.1=cells.1.all, cells.2=cells.2.all, genes.use=markers.remain, frac.must.express = frac.must.express, effect.size=log.effect.size, frac.min.diff=frac.min.diff, auc.factor = auc.factor, max.auc.threshold = max.auc.threshold) } else { markers.summary <- markersAUCPR(object=object, cells.1=cells.1.all, cells.2=cells.2.all, genes.use=markers.remain, frac.must.express = 0, effect.size=0, frac.min.diff=0) } - markers.summary$AUCPR.ratio <- markers.summary$AUCPR / aucprThreshold(cells.1.all, cells.2.all, factor=auc.factor, max.auc=Inf) - names(markers.summary) <- c("AUCPR.all", "expfc.all", "posFrac_lineage", "posFrac_rest", "nTrans_lineage", "nTrans_rest", "AUCPR.ratio.all") + names(markers.summary) <- c("AUCPR.all", "AUCPR.ratio.all", "expfc.all", "posFrac_lineage", "posFrac_rest", "nTrans_lineage", "nTrans_rest") markers.max.segment <- c() markers.max <- lapply(rownames(markers.summary), function(marker) { id <- which.max(unlist(lapply(markers.3, function(x) x[marker,"AUCPR.ratio"]))) to.return <- markers.3[[id]][marker,] markers.max.segment <<- c(markers.max.segment, names(markers.3)[id]) - names(to.return) <- c("AUCPR_maxBranch", "expfc.maxBranch", "posFrac_maxBranch", "posFrac_opposingMaxBranch", "nTrans_maxBranch", "nTrans_opposingMaxBranch", "AUCPR.ratio.maxBranch") + names(to.return) <- c("AUCPR_maxBranch", "AUCPR.ratio.maxBranch", "expfc.maxBranch", "posFrac_maxBranch", "posFrac_opposingMaxBranch", "nTrans_maxBranch", "nTrans_opposingMaxBranch") return(to.return) }) markers.max <- do.call(what = "rbind", markers.max) @@ -528,7 +525,7 @@ aucprTestAlongTree <- function(object, pseudotime, tips, log.effect.size=0.25, a id <- which.min(unlist(lapply(markers.3, function(x) x[marker,"AUCPR.ratio"]))) to.return <- markers.3[[id]][marker,] markers.min.segment <<- c(markers.min.segment, names(markers.3)[id]) - names(to.return) <- c("AUCPR_minBranch", "expfc.minBranch", "posFrac_minBranch", "posFrac_opposingMinBranch", "nTrans_minBranch", "nTrans_opposingMinBranch", "AUCPR.ratio.minBranch") + names(to.return) <- c("AUCPR_minBranch", "AUCPR.ratio.minBranch", "expfc.minBranch", "posFrac_minBranch", "posFrac_opposingMinBranch", "nTrans_minBranch", "nTrans_opposingMinBranch") return(to.return) }) markers.min <- do.call(what = "rbind", markers.min) From f73010e8a13a1b70df580a17e3ebe1a167cfa931 Mon Sep 17 00:00:00 2001 From: jfarrell Date: Tue, 17 Sep 2019 16:02:33 -0400 Subject: [PATCH 12/24] Fixed log.effect.size filtering in markersAUCPR --- R/diff-exp.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/diff-exp.R b/R/diff-exp.R index 5ff8062..bbf3dc7 100644 --- a/R/diff-exp.R +++ b/R/diff-exp.R @@ -158,7 +158,7 @@ markersAUCPR <- function(object, clust.1=NULL, clust.2=NULL, cells.1=NULL, cells genes.use <- names(which( (apply(genes.data[,c("frac.1", "frac.2")], 1, max) > frac.must.express) & (apply(genes.data[,c("frac.1", "frac.2")], 1, function(x) abs(diff(x))) > frac.min.diff) & - (apply(genes.data[,c("exp.1", "exp.2")], 1, function(x) abs(diff(x))) > effect.size) + (genes.data$exp.fc > effect.size) )) genes.data <- genes.data[genes.use,] From 277a8e0696abab037efc415710028cb3ef180126 Mon Sep 17 00:00:00 2001 From: jfarrell Date: Tue, 24 Sep 2019 19:39:29 -0400 Subject: [PATCH 13/24] Added cells.min.walked to treeForceDirectedLayout --- DESCRIPTION | 2 +- R/tree-force-layout.R | 15 ++++++++++++--- man/treeForceDirectedLayout.Rd | 17 ++++++++++------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b017821..b6438db 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: URD Title: URD -Version: 1.1.0.9003 +Version: 1.1.0.9004 Authors@R: person("Jeffrey", "Farrell", email = "jfarrell@g.harvard.edu", role = c("aut", "cre")) Description: URD reconstructs transcriptional trajectories underlying specification or differentiation processes in the form of a branching tree from single-cell RNAseq data. Depends: diff --git a/R/tree-force-layout.R b/R/tree-force-layout.R index 967a226..9c1d74e 100644 --- a/R/tree-force-layout.R +++ b/R/tree-force-layout.R @@ -27,7 +27,7 @@ #' into place and to increase the angular distance at the first branchpoint in the blastoderm #' so that the more fine-grained branches from the different germ layers didn't overlap.) #' -#' Thanks for Dorde Relic for debugging and creating the \code{remove.duplicate.cells} parameter. +#' Thanks for Dorde Relic for debugging and creating the \code{remove.duplicate.cells} parameter and Simon Cai for debugging that led to the \code{cell.minimum.walks} parameter. #' #' @importFrom RANN nn2 #' @importFrom stats quantile @@ -38,6 +38,7 @@ #' @param num.nn (Numeric) Number of nearest neighbors to use. (\code{NULL} will use the square root of the number of cells as default.) #' @param method (Character: "fr", "drl", or "kk") Which force-directed layout algorithm to use (\link[igraph:layout_with_fr]{Fruchterman-Reingold}, \link[igraph:layout_with_drl]{DrL}, or \link[igraph:layout_with_kk]{Kamada-Kawai}) #' @param cells.to.do (Character vector) Cells to use in the layout (default \code{NULL} is all cells in the tree.) +#' @param cell.minimum.walks (Numeric) Minimum number of times a cell must have been visited by random walks in order to be included in the force-directed layout (Cells that have been visited only a few times are more likely to be assigned incorrectly or poorly.) #' @param cut.outlier.cells (Numeric) If desired, omit cells with unusual second nearest neighbor distances (i.e. those that are likely outliers only well connected to one other cell). Parameter is given as a factor of the interquartile range calculated across all cells' distance to their second nearest neighbor. (Default is not to omit any cells.) #' @param cut.outlier.edges (Numeric) If desired, cut edges in the nearest neighbor graph with unusually long distances. Parameters is given as a factor of the interquartile range calculated across all edges in the graph. (Default is not to cut any edges based on their length.) #' @param max.pseudotime.diff (Numeric) If desired, cut edges in the nearest neighbor graph between cells with longer difference in pseudotime. (Default is not to cut any edges based on their pseudotime.) @@ -64,7 +65,7 @@ #' #' @export -treeForceDirectedLayout <- function(object, num.nn=NULL, method=c("fr", "drl", "kk"), cells.to.do=NULL, cut.outlier.cells=NULL, cut.outlier.edges=NULL, max.pseudotime.diff=NULL, cut.unconnected.segments=2, min.final.neighbors=2, remove.duplicate.cells=T, tips=object@tree$tips, coords="auto", start.temp=NULL, n.iter=NULL, density.neighbors=10, plot.outlier.cuts=F, verbose=F) { +treeForceDirectedLayout <- function(object, num.nn=NULL, method=c("fr", "drl", "kk"), cells.to.do=NULL, cell.minimum.walks=1, cut.outlier.cells=NULL, cut.outlier.edges=NULL, max.pseudotime.diff=NULL, cut.unconnected.segments=2, min.final.neighbors=2, remove.duplicate.cells=T, tips=object@tree$tips, coords="auto", start.temp=NULL, n.iter=NULL, density.neighbors=10, plot.outlier.cuts=F, verbose=F) { # Params if (length(method) > 1) method <- method[1] if (is.null(cells.to.do)) cells.to.do <- rownames(object@diff.data) @@ -94,9 +95,17 @@ treeForceDirectedLayout <- function(object, num.nn=NULL, method=c("fr", "drl", " # Get and normalize walk data, then add pseudotime (unless NULL in which case don't use) if (verbose) print(paste0(Sys.time(), ": Preparing walk data.")) walk.data <- object@diff.data[cells.to.do,paste0("visitfreq.raw.", object@tree$tips)] + walk.data$pseudotime <- object@tree$pseudotime[cells.to.do] walk.total <- apply(walk.data, 1, sum) + # If some cells weren't walked enough + if (any(walk.total < cell.minimum.walks)) { + if (verbose) print(paste0("Removing ", length(which(walk.total < cell.minimum.walks)), " cells that were visited fewer than ", cell.minimum.walks, " times by random walks.")) + # Remove those cells + walk.data <- walk.data[which(walk.total >= cell.minimum.walks),] + # And recalculate walk totals + walk.total <- apply(walk.data, 1, sum) + } walk.data <- sweep(walk.data, 1, walk.total, "/") - walk.data$pseudotime <- object@tree$pseudotime[cells.to.do] walk.data <- as.matrix(walk.data) duped <- which(duplicated(walk.data)) diff --git a/man/treeForceDirectedLayout.Rd b/man/treeForceDirectedLayout.Rd index f425aba..5e94cc8 100644 --- a/man/treeForceDirectedLayout.Rd +++ b/man/treeForceDirectedLayout.Rd @@ -5,12 +5,13 @@ \title{Generate force-directed layout using tip-walk data.} \usage{ treeForceDirectedLayout(object, num.nn = NULL, method = c("fr", "drl", - "kk"), cells.to.do = NULL, cut.outlier.cells = NULL, - cut.outlier.edges = NULL, max.pseudotime.diff = NULL, - cut.unconnected.segments = 2, min.final.neighbors = 2, - remove.duplicate.cells = T, tips = object@tree$tips, coords = "auto", - start.temp = NULL, n.iter = NULL, density.neighbors = 10, - plot.outlier.cuts = F, verbose = F) + "kk"), cells.to.do = NULL, cell.minimum.walks = 1, + cut.outlier.cells = NULL, cut.outlier.edges = NULL, + max.pseudotime.diff = NULL, cut.unconnected.segments = 2, + min.final.neighbors = 2, remove.duplicate.cells = T, + tips = object@tree$tips, coords = "auto", start.temp = NULL, + n.iter = NULL, density.neighbors = 10, plot.outlier.cuts = F, + verbose = F) } \arguments{ \item{object}{An URD object} @@ -21,6 +22,8 @@ treeForceDirectedLayout(object, num.nn = NULL, method = c("fr", "drl", \item{cells.to.do}{(Character vector) Cells to use in the layout (default \code{NULL} is all cells in the tree.)} +\item{cell.minimum.walks}{(Numeric) Minimum number of times a cell must have been visited by random walks in order to be included in the force-directed layout (Cells that have been visited only a few times are more likely to be assigned incorrectly or poorly.)} + \item{cut.outlier.cells}{(Numeric) If desired, omit cells with unusual second nearest neighbor distances (i.e. those that are likely outliers only well connected to one other cell). Parameter is given as a factor of the interquartile range calculated across all cells' distance to their second nearest neighbor. (Default is not to omit any cells.)} \item{cut.outlier.edges}{(Numeric) If desired, cut edges in the nearest neighbor graph with unusually long distances. Parameters is given as a factor of the interquartile range calculated across all edges in the graph. (Default is not to cut any edges based on their length.)} @@ -83,7 +86,7 @@ layout, we used these functions to move the completely disconnected EVL and PGC into place and to increase the angular distance at the first branchpoint in the blastoderm so that the more fine-grained branches from the different germ layers didn't overlap.) -Thanks for Dorde Relic for debugging and creating the \code{remove.duplicate.cells} parameter. +Thanks for Dorde Relic for debugging and creating the \code{remove.duplicate.cells} parameter and Simon Cai for debugging that led to the \code{cell.minimum.walks} parameter. } \examples{ object.built <- treeForceDirectedLayout(object.built, num.nn=120, pseudotime="pseudotime", method = "fr", dim = 2, cells.to.do = robustly.visited.cells, tips=final.tips, cut.unconnected.segments = 2, min.final.neighbors=4, verbose=T) From d9f898374b6a022a259e7eb0cd29b74fac7cbebb Mon Sep 17 00:00:00 2001 From: jfarrell Date: Thu, 10 Oct 2019 23:12:57 -0400 Subject: [PATCH 14/24] Change symbol in NMFDoublets.R to facilitate installation. --- DESCRIPTION | 2 +- R/NMFDoublets.R | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b6438db..ec77eaf 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: URD Title: URD -Version: 1.1.0.9004 +Version: 1.1.0.9005 Authors@R: person("Jeffrey", "Farrell", email = "jfarrell@g.harvard.edu", role = c("aut", "cre")) Description: URD reconstructs transcriptional trajectories underlying specification or differentiation processes in the form of a branching tree from single-cell RNAseq data. Depends: diff --git a/R/NMFDoublets.R b/R/NMFDoublets.R index f0e856b..44626eb 100644 --- a/R/NMFDoublets.R +++ b/R/NMFDoublets.R @@ -294,7 +294,7 @@ NMFDoubletsPlotModuleCombos <- function(object, path, module.combos, module.expr # Actually loop through and generate the plots for (i in 1:n.plots) { - p1.title <- paste0(module.combos.to.plot[i, "Mod1"], " + ", module.combos.to.plot[i, "Mod2"], " (Overlap: ", 100*module.combos.to.plot[i, "frac.overlap.high"], "%; Δ Overlap: ", 100*module.combos.to.plot[i, "frac.overlap.diff"], "%)") + p1.title <- paste0(module.combos.to.plot[i, "Mod1"], " + ", module.combos.to.plot[i, "Mod2"], " (Overlap: ", 100*module.combos.to.plot[i, "frac.overlap.high"], "%; Overlap Diff: ", 100*module.combos.to.plot[i, "frac.overlap.diff"], "%)") p1 <- plotDimDual(object, module.combos.to.plot[i,"Mod1"], module.combos.to.plot[i,"Mod2"], plot.title = p1.title, ...) overlap.cells <- intersect(intersect(cells.express.mod.crop[[module.combos.to.plot[i,"Mod1"]]],cells.express.mod.crop[[module.combos.to.plot[i,"Mod2"]]]), colnames(object@logupx.data)) object <- groupFromCells(object, "overlap.cells", overlap.cells) @@ -305,4 +305,4 @@ NMFDoubletsPlotModuleCombos <- function(object, path, module.combos, module.expr gridExtra::grid.arrange(grobs=list(p1,p2), ncol=2) dev.off() } -} \ No newline at end of file +} From 265200ad8b4899c9d0aca9bc94b569cc058a79cf Mon Sep 17 00:00:00 2001 From: farrellja Date: Wed, 15 Jan 2020 16:27:15 -0500 Subject: [PATCH 15/24] Use BiocManager for R >= 3.5 --- URD-Install.R | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/URD-Install.R b/URD-Install.R index 6797580..6591e4d 100644 --- a/URD-Install.R +++ b/URD-Install.R @@ -1,10 +1,21 @@ -# Load Bioconductor -message("Loading Bioconductor to install required packages.") -source("https://bioconductor.org/biocLite.R") - # Install Bioconductor requirements: Biobase, S4Vectors, AnnotationDbi, destiny -message("Installing required packages from Bioconductor.") -biocLite(c('Biobase', 'S4Vectors', 'AnnotationDbi', 'destiny'), suppressUpdates=T) +# Needs to check R version because installation method changed between R 3.4 and 3.5 + +if (as.numeric(R.version$major) <= 3 && as.numeric(R.version$minor) < 5) { + # R < 3.5 + message("Loading Bioconductor (biocLite) to install required packages.") + source("https://bioconductor.org/biocLite.R") + message("Installing required packages from Bioconductor.") + biocLite(c('Biobase', 'S4Vectors', 'AnnotationDbi', 'destiny'), suppressUpdates=T) +} else { + # R >= 3.5 + if (!requireNamespace("BiocManager", quietly = TRUE)) { + message("Installing biocManager to install required Bioconductor packages.") + install.packages("BiocManager") + } + message("Installing required packages from Bioconductor (BiocManager).") + BiocManager::install(c('Biobase', 'S4Vectors', 'AnnotationDbi', 'destiny'), suppressUpdates=T) +} # Check that Bioconductor installation went smoothly. if (!requireNamespace("Biobase", quietly = TRUE)) {stop("Failed to install required package 'Biobase' from Bioconductor.")} From 6bfe044499b1d1cea34ffee7187fa945cd3f3d36 Mon Sep 17 00:00:00 2001 From: farrellja Date: Tue, 7 Apr 2020 17:24:42 -0400 Subject: [PATCH 16/24] Explicitly call dip.test from diptest package. --- R/tree-structure.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tree-structure.R b/R/tree-structure.R index d7c6a2e..2d8b121 100644 --- a/R/tree-structure.R +++ b/R/tree-structure.R @@ -252,7 +252,7 @@ divergencePreferenceDip <- function(visit.data, cells.in.windows, cells.segment. cells.seg1.pt.group <- length(intersect(cells.segment.1, cells.in.pt.group)) cells.seg2.pt.group <- length(intersect(cells.segment.2, cells.in.pt.group)) # Test for unimodality with Hartigan's diptest - dip <- dip.test(visit.data[cells.in.pt.group,"preference"]) + dip <- diptest::dip.test(visit.data[cells.in.pt.group,"preference"]) p <- dip$p.value # Determine mean of preference mean.pref <- mean(abs(visit.data[cells.in.pt.group,"preference"]), na.rm=T) From f76016f3d2e4ce678976b319a7378f4f8ba5d14d Mon Sep 17 00:00:00 2001 From: farrellja Date: Tue, 7 Apr 2020 17:25:10 -0400 Subject: [PATCH 17/24] Check no tips are specified without cells from loadTipCells. --- R/tree.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/tree.R b/R/tree.R index d500418..99bd682 100644 --- a/R/tree.R +++ b/R/tree.R @@ -88,6 +88,10 @@ buildTree <- function(object, pseudotime, tips.use=NULL, divergence.method=c("ks if (weighted.fusion) { tip.size <- unlist(lapply(object@tree$cells.in.tip, length)) if (length(tip.size)==0) stop("Either weighted.fusion must be false, or loadTipCells must be run prior.") + tip.size <- tip.size[tip.size > 0] + if !all(tips.use %in% names(tip.size)) { + stop(paste0("tips.use included tips (", paste0(setdiff(tips.use, names(tip.size)), collapse=", "), ") for which no cells were defined by loadTipCells. Does that tip exist in your tip clustering?")) + } } # Load the pseudotime used into the tree object for use later with plotting object@tree$pseudotime <- object@pseudotime[,pseudotime] @@ -217,4 +221,4 @@ buildTree <- function(object, pseudotime, tips.use=NULL, divergence.method=c("ks # Return the finished object return(object) -} \ No newline at end of file +} From 6bdc52c56362dc3dbe58b969e3e1c7cad98db6cf Mon Sep 17 00:00:00 2001 From: farrellja Date: Tue, 7 Apr 2020 17:34:09 -0400 Subject: [PATCH 18/24] If tips.use = NULL, extract them from @diff.data --- R/tree.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/tree.R b/R/tree.R index 99bd682..91711da 100644 --- a/R/tree.R +++ b/R/tree.R @@ -80,6 +80,11 @@ buildTree <- function(object, pseudotime, tips.use=NULL, divergence.method=c("ks # Check divergence.method parameter if (length(divergence.method) > 1) divergence.method <- divergence.method[1] if (!(divergence.method %in% c("ks", "preference"))) stop("Divergence method must be 'ks' or 'preference'.") + # If tips were not specified, define them. + if (is.null(tips.use)) { + tips.use <- suppressWarnings(as.character(setdiff(as.numeric(gsub("visitfreq.raw.", "", grep("visitfreq.raw.", colnames(object@diff.data), value=T))), NA))) + if (verbose) message(paste0("Tips not provided, so using: ", paste0(tips.use, collapse=", "))) + } # Make sure tips is a character vector tips <- as.character(tips.use) # Record tips for posterity From 2d1c9edaf05ae5407ac6ae890ee992a492dcb029 Mon Sep 17 00:00:00 2001 From: farrellja Date: Tue, 7 Apr 2020 19:00:19 -0400 Subject: [PATCH 19/24] Add parentheses --- R/tree.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tree.R b/R/tree.R index 91711da..1758fcc 100644 --- a/R/tree.R +++ b/R/tree.R @@ -94,7 +94,7 @@ buildTree <- function(object, pseudotime, tips.use=NULL, divergence.method=c("ks tip.size <- unlist(lapply(object@tree$cells.in.tip, length)) if (length(tip.size)==0) stop("Either weighted.fusion must be false, or loadTipCells must be run prior.") tip.size <- tip.size[tip.size > 0] - if !all(tips.use %in% names(tip.size)) { + if (!all(tips.use %in% names(tip.size))) { stop(paste0("tips.use included tips (", paste0(setdiff(tips.use, names(tip.size)), collapse=", "), ") for which no cells were defined by loadTipCells. Does that tip exist in your tip clustering?")) } } From 3d982d42235de44455ba4084cf13f96876822e81 Mon Sep 17 00:00:00 2001 From: farrellja Date: Wed, 8 Apr 2020 09:48:56 -0400 Subject: [PATCH 20/24] Limit ggraph to <2.0 until incompatibility is resolved. --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index ec77eaf..aa878b3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -13,7 +13,7 @@ Imports: destiny, diptest, gdata, - ggraph, + ggraph (< 2.0.0), gmodels, gplots, gridExtra, From 3168d0106b8e7f6233388ce15f70ae857429f7de Mon Sep 17 00:00:00 2001 From: farrellja Date: Tue, 28 Apr 2020 14:10:29 -0400 Subject: [PATCH 21/24] Fix bug in treeLayout --- DESCRIPTION | 8 ++++---- R/tree-layout.R | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index aa878b3..c15fbf5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: URD Title: URD -Version: 1.1.0.9005 -Authors@R: person("Jeffrey", "Farrell", email = "jfarrell@g.harvard.edu", role = c("aut", "cre")) +Version: 1.1.1 +Authors@R: person("Jeffrey", "Farrell", email = "jeffrey.farrell@nih.gov", role = c("aut", "cre")) Description: URD reconstructs transcriptional trajectories underlying specification or differentiation processes in the form of a branching tree from single-cell RNAseq data. Depends: R (>= 3.3.0), @@ -13,7 +13,7 @@ Imports: destiny, diptest, gdata, - ggraph (< 2.0.0), + ggraph, gmodels, gplots, gridExtra, @@ -38,4 +38,4 @@ Suggests: License: GPL-3 Encoding: UTF-8 LazyData: true -RoxygenNote: 6.0.1 +RoxygenNote: 7.0.2 diff --git a/R/tree-layout.R b/R/tree-layout.R index 43c7db7..b2b40dd 100644 --- a/R/tree-layout.R +++ b/R/tree-layout.R @@ -19,6 +19,7 @@ treeLayoutDendrogram <- function(object) { igraph.layout <- create_layout(object@tree$tree.igraph, layout="dendrogram") # Label segments in layout igraph.layout$segment <- as.character(igraph.layout$name) + rownames(igraph.layout) <- igraph.layout$segment # Add it to the object object@tree$segment.layout <- igraph.layout From 258efb9f5953e6a1cc15503c1d85f522f54853b6 Mon Sep 17 00:00:00 2001 From: farrellja Date: Tue, 28 Apr 2020 14:11:09 -0400 Subject: [PATCH 22/24] ROxygen 6 > 7 --- man/NMFDoubletsDefineModules.Rd | 8 +++-- man/NMFDoubletsDetermineCells.Rd | 9 ++++-- man/NMFDoubletsPlotModuleCombos.Rd | 20 +++++++++---- man/NMFDoubletsPlotModuleThresholds.Rd | 8 +++-- man/NMFDoubletsPlotModulesInCell.Rd | 8 +++-- man/URD.Rd | 1 - man/allSegmentDivergenceByPseudotime.Rd | 20 +++++++++---- man/aucprTestAlongTree.Rd | 21 +++++++++---- man/aucprTestByFactor.Rd | 20 ++++++++++--- man/batchComBat.Rd | 17 ++++++++--- man/binomTestAlongTree.Rd | 17 ++++++++--- man/branchpointDetailsPreferenceDist.Rd | 10 +++++-- man/branchpointDetailsVisitDist.Rd | 10 +++++-- man/branchpointDetailsVisitTsne.Rd | 10 +++++-- man/branchpointPreferenceLayout.Rd | 11 +++++-- man/buildTree.Rd | 29 +++++++++++++----- man/calcDM.Rd | 15 ++++++++-- man/calcPCA.Rd | 11 +++++-- man/calcTsne.Rd | 12 ++++++-- man/cellDistByExpression.Rd | 7 +++-- man/clusterDE.Rd | 13 +++++++-- man/clusterTipPotential.Rd | 8 +++-- man/collapseShortSegments.Rd | 8 +++-- man/createURD.Rd | 13 +++++++-- man/data.for.plot.Rd | 18 ++++++++---- man/defaultURDContinuousColors.Rd | 3 +- man/divergenceKSVisitation.Rd | 8 +++-- man/divergencePreferenceDip.Rd | 8 +++-- man/dsMetaTrim.Rd | 14 +++++++-- man/dsReadStats.Rd | 8 +++-- man/edgesFromDM.Rd | 8 +++-- man/findVariableGenes.Rd | 13 +++++++-- man/floodPseudotime.Rd | 13 +++++++-- man/floodPseudotimeCalc.Rd | 9 ++++-- man/floodPseudotimeProcess.Rd | 10 +++++-- man/geneCascadeHeatmap.Rd | 13 +++++++-- man/geneCascadeProcess.Rd | 20 ++++++++++--- man/geneSmoothFit.Rd | 16 ++++++++-- man/graphClustering.Rd | 13 +++++++-- man/impulse.start.double.Rd | 3 +- man/impulse.start.single.Rd | 3 +- man/impulseFit.Rd | 3 +- man/interpolate.points.Rd | 15 +++++++--- man/knnOutliers.Rd | 14 +++++++-- man/markersAUCPR.Rd | 19 +++++++++--- man/markersBinom.Rd | 17 ++++++++--- man/moduleTestAlongTree.Rd | 16 ++++++++-- man/plotBranchpoint.Rd | 24 +++++++++++---- man/plotDim.Rd | 33 ++++++++++++++++----- man/plotDim3D.Rd | 33 ++++++++++++++++----- man/plotDim3DStoreView.Rd | 14 +++++++-- man/plotDimArray.Rd | 13 +++++++-- man/plotDimDiscretized.Rd | 22 ++++++++++---- man/plotDimDual.Rd | 27 +++++++++++++---- man/plotDists.Rd | 11 +++++-- man/plotDot.Rd | 16 ++++++++-- man/plotScatter.Rd | 31 +++++++++++++++----- man/plotSmoothFit.Rd | 14 +++++++-- man/plotSmoothFitMultiCascade.Rd | 14 +++++++-- man/plotTree.Rd | 39 ++++++++++++++++++------- man/plotTreeDiscretized.Rd | 23 +++++++++++---- man/plotTreeDual.Rd | 32 ++++++++++++++------ man/plotTreeForce.Rd | 31 +++++++++++++++----- man/plotTreeForce2D.Rd | 15 ++++++++-- man/plotTreeForceDual.Rd | 31 +++++++++++++++----- man/plotTreeHighlight.Rd | 14 +++++++-- man/plotViolin.Rd | 14 +++++++-- man/processRandomWalks.Rd | 10 +++++-- man/processRandomWalksFromTips.Rd | 9 ++++-- man/pseudotimeBreakpointByStretch.Rd | 10 +++++-- man/pseudotimeBreakpointByStretchV1.Rd | 10 +++++-- man/pseudotimeDetermineLogistic.Rd | 12 ++++++-- man/pseudotimeMovingWindow.Rd | 12 ++++++-- man/pseudotimeWeightTransitionMatrix.Rd | 13 +++++++-- man/segChildrenAll.Rd | 9 ++++-- man/simulateRandomWalk.Rd | 11 +++++-- man/simulateRandomWalksFromTips.Rd | 13 +++++++-- man/tipPotential.Rd | 12 ++++++-- man/treeForceDirectedLayout.Rd | 28 +++++++++++++----- man/treeForceRotateCoords.Rd | 13 +++++++-- man/treeForceStretchCoords.Rd | 11 +++++-- man/txCutoffPlot.Rd | 9 ++++-- man/txReadDGE.Rd | 9 ++++-- man/visitDivergenceByPseudotime.Rd | 23 +++++++++++---- 84 files changed, 943 insertions(+), 292 deletions(-) diff --git a/man/NMFDoubletsDefineModules.Rd b/man/NMFDoubletsDefineModules.Rd index 2ab2b37..66b41f4 100644 --- a/man/NMFDoubletsDefineModules.Rd +++ b/man/NMFDoubletsDefineModules.Rd @@ -4,8 +4,12 @@ \alias{NMFDoubletsDefineModules} \title{NMF Doublets: Calculate module pair overlap} \usage{ -NMFDoubletsDefineModules(object, modules.use, module.thresh.high = 0.3, - module.thresh.low = 0.15) +NMFDoubletsDefineModules( + object, + modules.use, + module.thresh.high = 0.3, + module.thresh.low = 0.15 +) } \arguments{ \item{object}{An URD object} diff --git a/man/NMFDoubletsDetermineCells.Rd b/man/NMFDoubletsDetermineCells.Rd index 1566833..cafd397 100644 --- a/man/NMFDoubletsDetermineCells.Rd +++ b/man/NMFDoubletsDetermineCells.Rd @@ -4,8 +4,13 @@ \alias{NMFDoubletsDetermineCells} \title{NMF Doublets: Identify cells that express non-overlapping NMF modules} \usage{ -NMFDoubletsDetermineCells(object, module.combos, module.expressed.thresh, - frac.overlap.max, frac.overlap.diff.max) +NMFDoubletsDetermineCells( + object, + module.combos, + module.expressed.thresh, + frac.overlap.max, + frac.overlap.diff.max +) } \arguments{ \item{object}{An URD object} diff --git a/man/NMFDoubletsPlotModuleCombos.Rd b/man/NMFDoubletsPlotModuleCombos.Rd index ca2f68e..0b28970 100644 --- a/man/NMFDoubletsPlotModuleCombos.Rd +++ b/man/NMFDoubletsPlotModuleCombos.Rd @@ -4,11 +4,21 @@ \alias{NMFDoubletsPlotModuleCombos} \title{Plot NMF module combinations and dual-expressing cells} \usage{ -NMFDoubletsPlotModuleCombos(object, path, module.combos, - module.expressed.thresh, frac.overlap.max, frac.overlap.diff.max, - boundary = c("pass", "discarded"), sort = c("near", "random"), - only.combos.with.doublets = T, n.plots = 50, width = 1400, - height = 600, ...) +NMFDoubletsPlotModuleCombos( + object, + path, + module.combos, + module.expressed.thresh, + frac.overlap.max, + frac.overlap.diff.max, + boundary = c("pass", "discarded"), + sort = c("near", "random"), + only.combos.with.doublets = T, + n.plots = 50, + width = 1400, + height = 600, + ... +) } \arguments{ \item{object}{An URD object} diff --git a/man/NMFDoubletsPlotModuleThresholds.Rd b/man/NMFDoubletsPlotModuleThresholds.Rd index 835c901..6f20a33 100644 --- a/man/NMFDoubletsPlotModuleThresholds.Rd +++ b/man/NMFDoubletsPlotModuleThresholds.Rd @@ -4,8 +4,12 @@ \alias{NMFDoubletsPlotModuleThresholds} \title{NMF Doublets: Plot module overlaps} \usage{ -NMFDoubletsPlotModuleThresholds(module.combos, frac.overlap.max, - frac.overlap.diff.max, modules.highlight = NULL) +NMFDoubletsPlotModuleThresholds( + module.combos, + frac.overlap.max, + frac.overlap.diff.max, + modules.highlight = NULL +) } \arguments{ \item{module.combos}{(List) Output from \code{\link{NMFDoubletsDefineModules}}} diff --git a/man/NMFDoubletsPlotModulesInCell.Rd b/man/NMFDoubletsPlotModulesInCell.Rd index a3183f1..b6e6ec7 100644 --- a/man/NMFDoubletsPlotModulesInCell.Rd +++ b/man/NMFDoubletsPlotModulesInCell.Rd @@ -4,8 +4,12 @@ \alias{NMFDoubletsPlotModulesInCell} \title{Plot cells' expression of modules} \usage{ -NMFDoubletsPlotModulesInCell(object, modules, cells, - module.expressed.thresh = Inf) +NMFDoubletsPlotModulesInCell( + object, + modules, + cells, + module.expressed.thresh = Inf +) } \arguments{ \item{object}{An URD object} diff --git a/man/URD.Rd b/man/URD.Rd index dee3c43..d9d1bf1 100644 --- a/man/URD.Rd +++ b/man/URD.Rd @@ -4,7 +4,6 @@ \name{URD} \alias{URD} \alias{URD-package} -\alias{URD-package} \title{URD - Reconstruction of Branching Developmental Trajectories} \description{ URD reconstructs transcriptional trajectories underlying specification or differentiation diff --git a/man/allSegmentDivergenceByPseudotime.Rd b/man/allSegmentDivergenceByPseudotime.Rd index 948fcfc..1a8c40d 100644 --- a/man/allSegmentDivergenceByPseudotime.Rd +++ b/man/allSegmentDivergenceByPseudotime.Rd @@ -4,11 +4,21 @@ \alias{allSegmentDivergenceByPseudotime} \title{All Segment Divergence By Pseudotime} \usage{ -allSegmentDivergenceByPseudotime(object, pseudotime, segments, - divergence.method = c("ks", "preference"), pseudotime.cuts = 80, - window.size = 5, minimum.visits = 10, visit.threshold = 0.7, - p.thresh = 0.01, pref.thresh = 0.5, breakpoint.decision.plots = NULL, - cache = T, verbose = F) +allSegmentDivergenceByPseudotime( + object, + pseudotime, + segments, + divergence.method = c("ks", "preference"), + pseudotime.cuts = 80, + window.size = 5, + minimum.visits = 10, + visit.threshold = 0.7, + p.thresh = 0.01, + pref.thresh = 0.5, + breakpoint.decision.plots = NULL, + cache = T, + verbose = F +) } \arguments{ \item{object}{An URD object} diff --git a/man/aucprTestAlongTree.Rd b/man/aucprTestAlongTree.Rd index bcf0f93..7c8f682 100644 --- a/man/aucprTestAlongTree.Rd +++ b/man/aucprTestAlongTree.Rd @@ -4,11 +4,22 @@ \alias{aucprTestAlongTree} \title{Test for differential gene expression along tree using precision-recall test} \usage{ -aucprTestAlongTree(object, pseudotime, tips, log.effect.size = 0.25, - auc.factor = 1, max.auc.threshold = 1, frac.must.express = 0.1, - frac.min.diff = 0.1, genes.use = NULL, root = NULL, - segs.to.skip = NULL, only.return.global = F, must.beat.sibs = 0.5, - report.debug = F) +aucprTestAlongTree( + object, + pseudotime, + tips, + log.effect.size = 0.25, + auc.factor = 1, + max.auc.threshold = 1, + frac.must.express = 0.1, + frac.min.diff = 0.1, + genes.use = NULL, + root = NULL, + segs.to.skip = NULL, + only.return.global = F, + must.beat.sibs = 0.5, + report.debug = F +) } \arguments{ \item{object}{An URD object} diff --git a/man/aucprTestByFactor.Rd b/man/aucprTestByFactor.Rd index 987c3de..b351d1e 100644 --- a/man/aucprTestByFactor.Rd +++ b/man/aucprTestByFactor.Rd @@ -4,10 +4,22 @@ \alias{aucprTestByFactor} \title{Test for differential gene expression along tree using binomial test} \usage{ -aucprTestByFactor(object, cells.1, cells.2, label, groups, - log.effect.size = 0.25, auc.factor = 1, min.auc.thresh = 0.1, - max.auc.thresh = Inf, frac.must.express = 0.1, frac.min.diff = 0, - genes.use = NULL, min.groups.to.mark = 1, report.debug = F) +aucprTestByFactor( + object, + cells.1, + cells.2, + label, + groups, + log.effect.size = 0.25, + auc.factor = 1, + min.auc.thresh = 0.1, + max.auc.thresh = Inf, + frac.must.express = 0.1, + frac.min.diff = 0, + genes.use = NULL, + min.groups.to.mark = 1, + report.debug = F +) } \arguments{ \item{object}{An URD object} diff --git a/man/batchComBat.Rd b/man/batchComBat.Rd index ade8f3a..33cd591 100644 --- a/man/batchComBat.Rd +++ b/man/batchComBat.Rd @@ -4,10 +4,19 @@ \alias{batchComBat} \title{Batch correct data using ComBat} \usage{ -batchComBat(object, batch.column, adjustment.columns = NULL, - reference.batch = NULL, genes.correct = NULL, thresh.out = 0.05, - min.out = 0, max.out = (ceiling(max(object@logupx.data)) + 1), - parametric.prior = T, prior.plots = F, verbose = F) +batchComBat( + object, + batch.column, + adjustment.columns = NULL, + reference.batch = NULL, + genes.correct = NULL, + thresh.out = 0.05, + min.out = 0, + max.out = (ceiling(max(object@logupx.data)) + 1), + parametric.prior = T, + prior.plots = F, + verbose = F +) } \arguments{ \item{object}{An URD object} diff --git a/man/binomTestAlongTree.Rd b/man/binomTestAlongTree.Rd index 6689b6d..dd0dedd 100644 --- a/man/binomTestAlongTree.Rd +++ b/man/binomTestAlongTree.Rd @@ -4,10 +4,19 @@ \alias{binomTestAlongTree} \title{Test for differential gene expression along tree using binomial test} \usage{ -binomTestAlongTree(object, pseudotime, tips, log.effect.size = log(2), - p.thresh = 0.01, frac.must.express = 0.1, genes.use = NULL, - root = NULL, only.return.global = F, must.beat.sibs = 0.5, - report.stats = F) +binomTestAlongTree( + object, + pseudotime, + tips, + log.effect.size = log(2), + p.thresh = 0.01, + frac.must.express = 0.1, + genes.use = NULL, + root = NULL, + only.return.global = F, + must.beat.sibs = 0.5, + report.stats = F +) } \arguments{ \item{object}{An URD object} diff --git a/man/branchpointDetailsPreferenceDist.Rd b/man/branchpointDetailsPreferenceDist.Rd index ee22193..a4fef39 100644 --- a/man/branchpointDetailsPreferenceDist.Rd +++ b/man/branchpointDetailsPreferenceDist.Rd @@ -4,8 +4,14 @@ \alias{branchpointDetailsPreferenceDist} \title{Investigate Branchpoint - Visit Preference Distributions} \usage{ -branchpointDetailsPreferenceDist(object, seg.1, seg.2, file = NULL, - file.width = 375, file.height = 300) +branchpointDetailsPreferenceDist( + object, + seg.1, + seg.2, + file = NULL, + file.width = 375, + file.height = 300 +) } \arguments{ \item{object}{An URD object} diff --git a/man/branchpointDetailsVisitDist.Rd b/man/branchpointDetailsVisitDist.Rd index 9c7acac..5c63657 100644 --- a/man/branchpointDetailsVisitDist.Rd +++ b/man/branchpointDetailsVisitDist.Rd @@ -4,8 +4,14 @@ \alias{branchpointDetailsVisitDist} \title{Investigate Branchpoint - Visit Frequency Distributions} \usage{ -branchpointDetailsVisitDist(object, seg.1, seg.2, file = NULL, - file.width = 375, file.height = 300) +branchpointDetailsVisitDist( + object, + seg.1, + seg.2, + file = NULL, + file.width = 375, + file.height = 300 +) } \arguments{ \item{object}{An URD object} diff --git a/man/branchpointDetailsVisitTsne.Rd b/man/branchpointDetailsVisitTsne.Rd index a8d585e..ceb6314 100644 --- a/man/branchpointDetailsVisitTsne.Rd +++ b/man/branchpointDetailsVisitTsne.Rd @@ -4,8 +4,14 @@ \alias{branchpointDetailsVisitTsne} \title{Investigate Branchpoint - tSNE Visitation Groups} \usage{ -branchpointDetailsVisitTsne(object, seg.1, seg.2, file = NULL, - file.width = 750, file.height = 600) +branchpointDetailsVisitTsne( + object, + seg.1, + seg.2, + file = NULL, + file.width = 750, + file.height = 600 +) } \arguments{ \item{object}{An URD object} diff --git a/man/branchpointPreferenceLayout.Rd b/man/branchpointPreferenceLayout.Rd index 9d62b0a..b8bed1a 100644 --- a/man/branchpointPreferenceLayout.Rd +++ b/man/branchpointPreferenceLayout.Rd @@ -4,8 +4,15 @@ \alias{branchpointPreferenceLayout} \title{Generate Branchpoint Preference Layout} \usage{ -branchpointPreferenceLayout(object, pseudotime, lineages.1, lineages.2, - parent.of.lineages, opposite.parent, min.visit = 0) +branchpointPreferenceLayout( + object, + pseudotime, + lineages.1, + lineages.2, + parent.of.lineages, + opposite.parent, + min.visit = 0 +) } \arguments{ \item{object}{An URD object} diff --git a/man/buildTree.Rd b/man/buildTree.Rd index 2d18a4f..21b61fa 100644 --- a/man/buildTree.Rd +++ b/man/buildTree.Rd @@ -4,14 +4,27 @@ \alias{buildTree} \title{Build Tree} \usage{ -buildTree(object, pseudotime, tips.use = NULL, divergence.method = c("ks", - "preference"), weighted.fusion = T, use.only.original.tips = T, - cells.per.pseudotime.bin = 80, bins.per.pseudotime.window = 5, - minimum.visits = 10, visit.threshold = 0.7, - save.breakpoint.plots = NULL, save.all.breakpoint.info = F, - p.thresh = 0.01, min.cells.per.segment = 1, - min.pseudotime.per.segment = 0.01, dendro.node.size = 100, - dendro.cell.jitter = 0.15, dendro.cell.dist.to.tree = 0.05, verbose = T) +buildTree( + object, + pseudotime, + tips.use = NULL, + divergence.method = c("ks", "preference"), + weighted.fusion = T, + use.only.original.tips = T, + cells.per.pseudotime.bin = 80, + bins.per.pseudotime.window = 5, + minimum.visits = 10, + visit.threshold = 0.7, + save.breakpoint.plots = NULL, + save.all.breakpoint.info = F, + p.thresh = 0.01, + min.cells.per.segment = 1, + min.pseudotime.per.segment = 0.01, + dendro.node.size = 100, + dendro.cell.jitter = 0.15, + dendro.cell.dist.to.tree = 0.05, + verbose = T +) } \arguments{ \item{object}{An URD object} diff --git a/man/calcDM.Rd b/man/calcDM.Rd index 729d782..7cf95a9 100644 --- a/man/calcDM.Rd +++ b/man/calcDM.Rd @@ -4,9 +4,18 @@ \alias{calcDM} \title{Calculate a diffusion map} \usage{ -calcDM(object, genes.use = object@var.genes, cells.use = NULL, knn = NULL, - sigma.use = NULL, n_local = 5:7, distance = c("euclidean", "cosine", - "rankcor"), density.norm = T, dcs.store = 200, verbose = T) +calcDM( + object, + genes.use = object@var.genes, + cells.use = NULL, + knn = NULL, + sigma.use = NULL, + n_local = 5:7, + distance = c("euclidean", "cosine", "rankcor"), + density.norm = T, + dcs.store = 200, + verbose = T +) } \arguments{ \item{object}{An URD object} diff --git a/man/calcPCA.Rd b/man/calcPCA.Rd index 2984fbd..09658b0 100644 --- a/man/calcPCA.Rd +++ b/man/calcPCA.Rd @@ -4,8 +4,15 @@ \alias{calcPCA} \title{Calculate principal components} \usage{ -calcPCA(object, genes.use = object@var.genes, pcs.store = NULL, - store.thresh = 2, mp.factor = 1, do.print = T, verbose = T) +calcPCA( + object, + genes.use = object@var.genes, + pcs.store = NULL, + store.thresh = 2, + mp.factor = 1, + do.print = T, + verbose = T +) } \arguments{ \item{object}{URD object} diff --git a/man/calcTsne.Rd b/man/calcTsne.Rd index f052675..a44c872 100644 --- a/man/calcTsne.Rd +++ b/man/calcTsne.Rd @@ -4,9 +4,15 @@ \alias{calcTsne} \title{Calculate tSNE projection of data} \usage{ -calcTsne(object, dim.use = c("pca", "dm"), - which.dims = which(object@pca.sig), perplexity = 30, theta = 0.5, - max_iter = 1000, verbose = FALSE) +calcTsne( + object, + dim.use = c("pca", "dm"), + which.dims = which(object@pca.sig), + perplexity = 30, + theta = 0.5, + max_iter = 1000, + verbose = FALSE +) } \arguments{ \item{object}{An URD object} diff --git a/man/cellDistByExpression.Rd b/man/cellDistByExpression.Rd index d5d2c12..5020341 100644 --- a/man/cellDistByExpression.Rd +++ b/man/cellDistByExpression.Rd @@ -4,8 +4,11 @@ \alias{cellDistByExpression} \title{Calculates the distance matrix between cells given their gene expression} \usage{ -cellDistByExpression(object, genes.use = object@var.genes, - return.as.matrix = T) +cellDistByExpression( + object, + genes.use = object@var.genes, + return.as.matrix = T +) } \arguments{ \item{object}{An URD object} diff --git a/man/clusterDE.Rd b/man/clusterDE.Rd index f1f2f36..7ebb269 100644 --- a/man/clusterDE.Rd +++ b/man/clusterDE.Rd @@ -4,9 +4,16 @@ \alias{clusterDE} \title{Cluster Differential Expression} \usage{ -clusterDE(object, clustering, genes.dist = object@var.genes, - effect.size = log(2), p.thresh = 0.01, frac.must.express = 0.1, - genes.de = NULL, verbose = T) +clusterDE( + object, + clustering, + genes.dist = object@var.genes, + effect.size = log(2), + p.thresh = 0.01, + frac.must.express = 0.1, + genes.de = NULL, + verbose = T +) } \arguments{ \item{object}{An URD object} diff --git a/man/clusterTipPotential.Rd b/man/clusterTipPotential.Rd index 16d26a3..a7c5c34 100644 --- a/man/clusterTipPotential.Rd +++ b/man/clusterTipPotential.Rd @@ -4,8 +4,12 @@ \alias{clusterTipPotential} \title{Tip Potential of Clusters} \usage{ -clusterTipPotential(object, pseudotime, clustering, - name.store = "tip.potential") +clusterTipPotential( + object, + pseudotime, + clustering, + name.store = "tip.potential" +) } \arguments{ \item{object}{An URD object} diff --git a/man/collapseShortSegments.Rd b/man/collapseShortSegments.Rd index 1c7086f..e80b9e0 100644 --- a/man/collapseShortSegments.Rd +++ b/man/collapseShortSegments.Rd @@ -4,8 +4,12 @@ \alias{collapseShortSegments} \title{Collapse Short Segments} \usage{ -collapseShortSegments(object, min.cells.per.segment = 1, - min.pseudotime.per.segment = 0.01, collapse.root = F) +collapseShortSegments( + object, + min.cells.per.segment = 1, + min.pseudotime.per.segment = 0.01, + collapse.root = F +) } \arguments{ \item{object}{An URD object} diff --git a/man/createURD.Rd b/man/createURD.Rd index 7ad85cc..e6158f6 100644 --- a/man/createURD.Rd +++ b/man/createURD.Rd @@ -4,9 +4,16 @@ \alias{createURD} \title{Create a new URD object} \usage{ -createURD(count.data, meta = NULL, min.cells = 3, min.genes = 500, - min.counts = 10, gene.max.cut = 5000, max.genes.in.ram = 5000, - verbose = T) +createURD( + count.data, + meta = NULL, + min.cells = 3, + min.genes = 500, + min.counts = 10, + gene.max.cut = 5000, + max.genes.in.ram = 5000, + verbose = T +) } \arguments{ \item{count.data}{(Matrix or dgCMatrix) UMI expression data, with rows as genes and columns as cells} diff --git a/man/data.for.plot.Rd b/man/data.for.plot.Rd index 91c484d..e0d483e 100644 --- a/man/data.for.plot.Rd +++ b/man/data.for.plot.Rd @@ -4,11 +4,19 @@ \alias{data.for.plot} \title{Retrieve data for plotting} \usage{ -data.for.plot(object, label, label.type = c("search", "meta", "group", "sig", - "gene", "counts", "pseudotime", "nmf", "pca", "diff.data"), - cells.use = NULL, as.color = F, as.single.color = F, - as.discrete.list = F, continuous.colors = NULL, - continuous.color.limits = NULL, colors.use = NULL) +data.for.plot( + object, + label, + label.type = c("search", "meta", "group", "sig", "gene", "counts", "pseudotime", + "nmf", "pca", "diff.data"), + cells.use = NULL, + as.color = F, + as.single.color = F, + as.discrete.list = F, + continuous.colors = NULL, + continuous.color.limits = NULL, + colors.use = NULL +) } \arguments{ \item{object}{An URD object} diff --git a/man/defaultURDContinuousColors.Rd b/man/defaultURDContinuousColors.Rd index 4dd187f..c91af8d 100644 --- a/man/defaultURDContinuousColors.Rd +++ b/man/defaultURDContinuousColors.Rd @@ -4,8 +4,7 @@ \alias{defaultURDContinuousColors} \title{Default URD continuous colors} \usage{ -defaultURDContinuousColors(with.grey = F, symmetric = F, - evenly.spaced = F) +defaultURDContinuousColors(with.grey = F, symmetric = F, evenly.spaced = F) } \value{ Vector of default colors diff --git a/man/divergenceKSVisitation.Rd b/man/divergenceKSVisitation.Rd index 0435777..7dfc584 100644 --- a/man/divergenceKSVisitation.Rd +++ b/man/divergenceKSVisitation.Rd @@ -4,8 +4,12 @@ \alias{divergenceKSVisitation} \title{Calculate visitation divergence using KS-test} \usage{ -divergenceKSVisitation(visit.data, pseudotime.windows, cells.segment.1, - cells.segment.2) +divergenceKSVisitation( + visit.data, + pseudotime.windows, + cells.segment.1, + cells.segment.2 +) } \arguments{ \item{visit.data}{(data.frame) Rows are cells, columns are: "segment.1" and "segment.2" (visitation frequency from random walks diff --git a/man/divergencePreferenceDip.Rd b/man/divergencePreferenceDip.Rd index c1532e1..276314a 100644 --- a/man/divergencePreferenceDip.Rd +++ b/man/divergencePreferenceDip.Rd @@ -4,8 +4,12 @@ \alias{divergencePreferenceDip} \title{Calculate visitation divergence based on bimodality of visitation preference} \usage{ -divergencePreferenceDip(visit.data, cells.in.windows, cells.segment.1, - cells.segment.2) +divergencePreferenceDip( + visit.data, + cells.in.windows, + cells.segment.1, + cells.segment.2 +) } \arguments{ \item{visit.data}{(data.frame) Rows are cells, columns are: "segment.1" and "segment.2" (visitation frequency from random walks diff --git a/man/dsMetaTrim.Rd b/man/dsMetaTrim.Rd index 4f15db8..47c9d0e 100644 --- a/man/dsMetaTrim.Rd +++ b/man/dsMetaTrim.Rd @@ -4,9 +4,17 @@ \alias{dsMetaTrim} \title{Plot and trim Dropseq DGE tables by metadata} \usage{ -dsMetaTrim(dge.table, ds.meta, cell.name = "CELL", meta.name, - meta.min = NULL, meta.max = NULL, title = "UMIs per cell", - x.lim = NULL, breaks = 150) +dsMetaTrim( + dge.table, + ds.meta, + cell.name = "CELL", + meta.name, + meta.min = NULL, + meta.max = NULL, + title = "UMIs per cell", + x.lim = NULL, + breaks = 150 +) } \arguments{ \item{dge.table}{(Matrix or data.frame) Gene expression table} diff --git a/man/dsReadStats.Rd b/man/dsReadStats.Rd index 86f8121..ad88583 100644 --- a/man/dsReadStats.Rd +++ b/man/dsReadStats.Rd @@ -4,8 +4,12 @@ \alias{dsReadStats} \title{Read cell barcode statistics produced by Dropseq pipeline} \usage{ -dsReadStats(dge.summary.reports, cell.readcount.reports = NULL, sample.names, - name.cells.with.sample = T) +dsReadStats( + dge.summary.reports, + cell.readcount.reports = NULL, + sample.names, + name.cells.with.sample = T +) } \arguments{ \item{dge.summary.reports}{(Character vector) Paths of DGE report files. (These files typically end with the suffix ".report_dge.summary.txt")} diff --git a/man/edgesFromDM.Rd b/man/edgesFromDM.Rd index 548b533..13bf1b5 100644 --- a/man/edgesFromDM.Rd +++ b/man/edgesFromDM.Rd @@ -4,8 +4,12 @@ \alias{edgesFromDM} \title{Create an edge list from the transition matrix of the diffusion map} \usage{ -edgesFromDM(object, cells = NULL, include.connected.cells = F, - edges.return = NULL) +edgesFromDM( + object, + cells = NULL, + include.connected.cells = F, + edges.return = NULL +) } \arguments{ \item{object}{An URD object} diff --git a/man/findVariableGenes.Rd b/man/findVariableGenes.Rd index a85c43e..ca3f95d 100644 --- a/man/findVariableGenes.Rd +++ b/man/findVariableGenes.Rd @@ -4,9 +4,16 @@ \alias{findVariableGenes} \title{Find variable genes} \usage{ -findVariableGenes(object, cells.fit = NULL, set.object.var.genes = T, - diffCV.cutoff = 0.5, mean.min = 0.005, mean.max = 100, main.use = "", - do.plot = T) +findVariableGenes( + object, + cells.fit = NULL, + set.object.var.genes = T, + diffCV.cutoff = 0.5, + mean.min = 0.005, + mean.max = 100, + main.use = "", + do.plot = T +) } \arguments{ \item{object}{An URD object} diff --git a/man/floodPseudotime.Rd b/man/floodPseudotime.Rd index 02a133d..ea0dfc7 100644 --- a/man/floodPseudotime.Rd +++ b/man/floodPseudotime.Rd @@ -4,8 +4,15 @@ \alias{floodPseudotime} \title{Calculate pseudotime by 'flooding'} \usage{ -floodPseudotime(object, root.cells, n = 20, minimum.cells.flooded = 2, - tm.flood = NULL, verbose = F, verbose.freq = 10) +floodPseudotime( + object, + root.cells, + n = 20, + minimum.cells.flooded = 2, + tm.flood = NULL, + verbose = F, + verbose.freq = 10 +) } \arguments{ \item{object}{An URD object} @@ -37,7 +44,7 @@ of the graph is performed. The probability that a cell is newly visited is the cumulative transition probability from all cells that have previously been visited in the graph. The process continues until either the entire graph is visited, or fewer than \code{minimum.cells.flooded} new cells are visited in -a given iteration. +a given iteration. On a computing cluster, this step can be parallelized by running a smaller number of simulations on many computers and combining the resulting data.frames with \code{\link{cbind}}. diff --git a/man/floodPseudotimeCalc.Rd b/man/floodPseudotimeCalc.Rd index 3c42b65..eaaf8f8 100644 --- a/man/floodPseudotimeCalc.Rd +++ b/man/floodPseudotimeCalc.Rd @@ -4,8 +4,13 @@ \alias{floodPseudotimeCalc} \title{A single iteration of flood pseudotime calculation.} \usage{ -floodPseudotimeCalc(object, start.cells, minimum.cells.flooded = 2, - tm.flood = NULL, verbose.freq = 0) +floodPseudotimeCalc( + object, + start.cells, + minimum.cells.flooded = 2, + tm.flood = NULL, + verbose.freq = 0 +) } \arguments{ \item{object}{An URD object} diff --git a/man/floodPseudotimeProcess.Rd b/man/floodPseudotimeProcess.Rd index 126eb7e..3b4b0de 100644 --- a/man/floodPseudotimeProcess.Rd +++ b/man/floodPseudotimeProcess.Rd @@ -4,8 +4,14 @@ \alias{floodPseudotimeProcess} \title{Process Flood Pseudotime} \usage{ -floodPseudotimeProcess(object, floods, floods.name = "pseudotime", - max.frac.NA = 0.4, pseudotime.fun = mean, stability.div = 10) +floodPseudotimeProcess( + object, + floods, + floods.name = "pseudotime", + max.frac.NA = 0.4, + pseudotime.fun = mean, + stability.div = 10 +) } \arguments{ \item{object}{An URD object} diff --git a/man/geneCascadeHeatmap.Rd b/man/geneCascadeHeatmap.Rd index cfc861f..40c9636 100644 --- a/man/geneCascadeHeatmap.Rd +++ b/man/geneCascadeHeatmap.Rd @@ -4,9 +4,16 @@ \alias{geneCascadeHeatmap} \title{Plot Gene Cascade Heatmap} \usage{ -geneCascadeHeatmap(cascade, color.scale = RColorBrewer::brewer.pal(9, - "YlOrRd"), add.time = NULL, times.annotate = seq(0, 1, 0.1), title = "", - annotation.list = NULL, row.font.size = 1, max.font.size = 0.9) +geneCascadeHeatmap( + cascade, + color.scale = RColorBrewer::brewer.pal(9, "YlOrRd"), + add.time = NULL, + times.annotate = seq(0, 1, 0.1), + title = "", + annotation.list = NULL, + row.font.size = 1, + max.font.size = 0.9 +) } \arguments{ \item{cascade}{(list) A processed gene cascade from \code{\link{geneCascadeProcess}}} diff --git a/man/geneCascadeProcess.Rd b/man/geneCascadeProcess.Rd index c1907d0..73bd7c3 100644 --- a/man/geneCascadeProcess.Rd +++ b/man/geneCascadeProcess.Rd @@ -4,10 +4,22 @@ \alias{geneCascadeProcess} \title{Gene Cascade: Fit expression of genes} \usage{ -geneCascadeProcess(object, pseudotime, cells, genes, moving.window = 3, - cells.per.window = NULL, pseudotime.per.window = NULL, scale.data = T, - k = 50, pt.windows = NULL, interpolate = NULL, pulse.only = T, - verbose = T, verbose.genes = F) +geneCascadeProcess( + object, + pseudotime, + cells, + genes, + moving.window = 3, + cells.per.window = NULL, + pseudotime.per.window = NULL, + scale.data = T, + k = 50, + pt.windows = NULL, + interpolate = NULL, + pulse.only = T, + verbose = T, + verbose.genes = F +) } \arguments{ \item{object}{An URD object} diff --git a/man/geneSmoothFit.Rd b/man/geneSmoothFit.Rd index f095b22..8047bf6 100644 --- a/man/geneSmoothFit.Rd +++ b/man/geneSmoothFit.Rd @@ -4,9 +4,19 @@ \alias{geneSmoothFit} \title{Gene Smooth: Fit expression of genes} \usage{ -geneSmoothFit(object, pseudotime, cells, genes, method = c("lowess", - "spline"), moving.window = 3, cells.per.window = NULL, - pseudotime.per.window = NULL, verbose = T, verbose.genes = F, ...) +geneSmoothFit( + object, + pseudotime, + cells, + genes, + method = c("lowess", "spline"), + moving.window = 3, + cells.per.window = NULL, + pseudotime.per.window = NULL, + verbose = T, + verbose.genes = F, + ... +) } \arguments{ \item{object}{An URD object} diff --git a/man/graphClustering.Rd b/man/graphClustering.Rd index d6b9e45..af8a76d 100644 --- a/man/graphClustering.Rd +++ b/man/graphClustering.Rd @@ -4,9 +4,16 @@ \alias{graphClustering} \title{Spectral Graph Clustering} \usage{ -graphClustering(object, dim.use = c("pca", "dm"), cells.use = NULL, - which.dims = which(object@pca.sig), num.nn = 30, do.jaccard = TRUE, - method = c("Louvain", "Infomap"), group.id = method) +graphClustering( + object, + dim.use = c("pca", "dm"), + cells.use = NULL, + which.dims = which(object@pca.sig), + num.nn = 30, + do.jaccard = TRUE, + method = c("Louvain", "Infomap"), + group.id = method +) } \arguments{ \item{object}{An URD object} diff --git a/man/impulse.start.double.Rd b/man/impulse.start.double.Rd index ce81d0b..9177ffb 100644 --- a/man/impulse.start.double.Rd +++ b/man/impulse.start.double.Rd @@ -4,8 +4,7 @@ \alias{impulse.start.double} \title{Starting Conditions for Impulse Model (double sigmoid)} \usage{ -impulse.start.double(x, y, k, h0.frac = 0.2, h2.frac = 0.2, - interpolate = NULL) +impulse.start.double(x, y, k, h0.frac = 0.2, h2.frac = 0.2, interpolate = NULL) } \arguments{ \item{x}{(Numeric vector) Expression data to fit (x)} diff --git a/man/impulse.start.single.Rd b/man/impulse.start.single.Rd index 51631da..4212616 100644 --- a/man/impulse.start.single.Rd +++ b/man/impulse.start.single.Rd @@ -4,8 +4,7 @@ \alias{impulse.start.single} \title{Starting conditions for single sigmoid model} \usage{ -impulse.start.single(x, y, k, h.frac = 0.2, l.frac = 0.2, - interpolate = NULL) +impulse.start.single(x, y, k, h.frac = 0.2, l.frac = 0.2, interpolate = NULL) } \arguments{ \item{x}{(Numeric vector) Expression data to fit (x)} diff --git a/man/impulseFit.Rd b/man/impulseFit.Rd index 34f25a7..22e666a 100644 --- a/man/impulseFit.Rd +++ b/man/impulseFit.Rd @@ -4,8 +4,7 @@ \alias{impulseFit} \title{Fit gene expression data with an impulse model} \usage{ -impulseFit(x, y, k = 50, interpolate = NULL, pulse.only = T, - min.slope = 0.1) +impulseFit(x, y, k = 50, interpolate = NULL, pulse.only = T, min.slope = 0.1) } \arguments{ \item{x}{(Numeric) Expression data to fit (e.g. pseudotime)} diff --git a/man/interpolate.points.Rd b/man/interpolate.points.Rd index 20c6374..7f6a4f4 100644 --- a/man/interpolate.points.Rd +++ b/man/interpolate.points.Rd @@ -4,10 +4,17 @@ \alias{interpolate.points} \title{Interpolate dimensionality reduction dimensions} \usage{ -interpolate.points(raw.coordinates, coord.prefix = "DC", dim.1, dim.2, dim.3, - w.1 = rep(1/length(dim.1), length(dim.1)), w.2 = rep(1/length(dim.2), - length(dim.2)), w.3 = rep(1/length(dim.3), length(dim.3)), - rows.subset = NULL) +interpolate.points( + raw.coordinates, + coord.prefix = "DC", + dim.1, + dim.2, + dim.3, + w.1 = rep(1/length(dim.1), length(dim.1)), + w.2 = rep(1/length(dim.2), length(dim.2)), + w.3 = rep(1/length(dim.3), length(dim.3)), + rows.subset = NULL +) } \arguments{ \item{raw.coordinates}{(data.frame) Rows are cells, and columns are dimensions to use for interpolation.} diff --git a/man/knnOutliers.Rd b/man/knnOutliers.Rd index 2a97eb1..341f569 100644 --- a/man/knnOutliers.Rd +++ b/man/knnOutliers.Rd @@ -4,8 +4,18 @@ \alias{knnOutliers} \title{Find outliers in terms of their distance in the k-nearest neighbor network} \usage{ -knnOutliers(object, nn.1 = 1, nn.2 = 20, x.max, slope.r, int.r, slope.b, - int.b, title = "", invert = F) +knnOutliers( + object, + nn.1 = 1, + nn.2 = 20, + x.max, + slope.r, + int.r, + slope.b, + int.b, + title = "", + invert = F +) } \arguments{ \item{object}{An URD object} diff --git a/man/markersAUCPR.Rd b/man/markersAUCPR.Rd index 0106e91..c9ee02f 100644 --- a/man/markersAUCPR.Rd +++ b/man/markersAUCPR.Rd @@ -4,10 +4,21 @@ \alias{markersAUCPR} \title{Test for markers of a population using a precision-recall curve} \usage{ -markersAUCPR(object, clust.1 = NULL, clust.2 = NULL, cells.1 = NULL, - cells.2 = NULL, clustering = NULL, effect.size = 0.25, - frac.must.express = 0.1, exp.thresh = 0, frac.min.diff = 0, - auc.factor = 1, max.auc.threshold = 1, genes.use = NULL) +markersAUCPR( + object, + clust.1 = NULL, + clust.2 = NULL, + cells.1 = NULL, + cells.2 = NULL, + clustering = NULL, + effect.size = 0.25, + frac.must.express = 0.1, + exp.thresh = 0, + frac.min.diff = 0, + auc.factor = 1, + max.auc.threshold = 1, + genes.use = NULL +) } \arguments{ \item{object}{An URD object} diff --git a/man/markersBinom.Rd b/man/markersBinom.Rd index f42866b..44a67d9 100644 --- a/man/markersBinom.Rd +++ b/man/markersBinom.Rd @@ -4,10 +4,19 @@ \alias{markersBinom} \title{Test for differential gene expression in two populations using a binomial test} \usage{ -markersBinom(object, pseudotime, clust.1 = NULL, clust.2 = NULL, - cells.1 = NULL, cells.2 = NULL, clustering = NULL, - effect.size = log(2), p.thresh = 0.01, frac.must.express = 0.1, - genes.use = NULL) +markersBinom( + object, + pseudotime, + clust.1 = NULL, + clust.2 = NULL, + cells.1 = NULL, + cells.2 = NULL, + clustering = NULL, + effect.size = log(2), + p.thresh = 0.01, + frac.must.express = 0.1, + genes.use = NULL +) } \arguments{ \item{object}{An URD object} diff --git a/man/moduleTestAlongTree.Rd b/man/moduleTestAlongTree.Rd index 690e811..1ac7697 100644 --- a/man/moduleTestAlongTree.Rd +++ b/man/moduleTestAlongTree.Rd @@ -4,9 +4,19 @@ \alias{moduleTestAlongTree} \title{Differential NMF module expression testing along tree} \usage{ -moduleTestAlongTree(object, tips, data, genelist, pseudotime, - exclude.upstream = F, effect.size = log(2), p.thresh = 0.01, - min.expression = 0.1, root = NULL, must.beat.all.sibs = T) +moduleTestAlongTree( + object, + tips, + data, + genelist, + pseudotime, + exclude.upstream = F, + effect.size = log(2), + p.thresh = 0.01, + min.expression = 0.1, + root = NULL, + must.beat.all.sibs = T +) } \arguments{ \item{object}{An URD object} diff --git a/man/plotBranchpoint.Rd b/man/plotBranchpoint.Rd index ba06035..c22cf80 100644 --- a/man/plotBranchpoint.Rd +++ b/man/plotBranchpoint.Rd @@ -4,11 +4,25 @@ \alias{plotBranchpoint} \title{Plot Data On Branchpoint Layout} \usage{ -plotBranchpoint(object, branchpoint.layout, label, label.2 = NULL, - label.type = "search", populations = NULL, visited.size = T, - point.alpha = 0.2, pt.lim = NULL, color.scale = NULL, - discrete.colors = NULL, ylab = "Pseudotime", xlab = "Preference", - title = label, axis.lines = T, legend = T, fade.low = 0.5) +plotBranchpoint( + object, + branchpoint.layout, + label, + label.2 = NULL, + label.type = "search", + populations = NULL, + visited.size = T, + point.alpha = 0.2, + pt.lim = NULL, + color.scale = NULL, + discrete.colors = NULL, + ylab = "Pseudotime", + xlab = "Preference", + title = label, + axis.lines = T, + legend = T, + fade.low = 0.5 +) } \arguments{ \item{object}{An URD object} diff --git a/man/plotDim.Rd b/man/plotDim.Rd index a60fe33..305b2db 100644 --- a/man/plotDim.Rd +++ b/man/plotDim.Rd @@ -4,13 +4,32 @@ \alias{plotDim} \title{Dimensionality Reduction Plot} \usage{ -plotDim(object, label, label.type = "search", reduction.use = c("tsne", - "pca", "dm"), dim.x = 1, dim.y = 2, colors = NULL, - discrete.colors = NULL, point.size = 1, alpha = 1, point.shapes = F, - plot.title = label, legend = T, legend.title = "", - legend.point.size = 3 * point.size, label.clusters = F, cells = NULL, - x.lim = NULL, y.lim = NULL, color.lim = NULL, na.rm = F, - transitions.plot = 0, transitions.alpha = 0.5, transitions.df = NULL) +plotDim( + object, + label, + label.type = "search", + reduction.use = c("tsne", "pca", "dm"), + dim.x = 1, + dim.y = 2, + colors = NULL, + discrete.colors = NULL, + point.size = 1, + alpha = 1, + point.shapes = F, + plot.title = label, + legend = T, + legend.title = "", + legend.point.size = 3 * point.size, + label.clusters = F, + cells = NULL, + x.lim = NULL, + y.lim = NULL, + color.lim = NULL, + na.rm = F, + transitions.plot = 0, + transitions.alpha = 0.5, + transitions.df = NULL +) } \arguments{ \item{object}{An URD object} diff --git a/man/plotDim3D.Rd b/man/plotDim3D.Rd index b39713f..b7fbd29 100644 --- a/man/plotDim3D.Rd +++ b/man/plotDim3D.Rd @@ -4,13 +4,32 @@ \alias{plotDim3D} \title{Dimensionality reduction plot in 3D.} \usage{ -plotDim3D(object, label, label.type = "search", reduction.use = c("dm", - "pca"), view = NULL, dim.1 = NULL, dim.2 = NULL, dim.3 = NULL, - w.1 = NULL, w.2 = NULL, w.3 = NULL, cells = NULL, alpha = 0.2, - size = 4, title = NULL, title.cex = 3, title.line = 0, - bounding.box = T, xlab = NULL, ylab = NULL, zlab = NULL, - continuous.colors = NULL, continuous.color.limits = NULL, - discrete.colors = NULL) +plotDim3D( + object, + label, + label.type = "search", + reduction.use = c("dm", "pca"), + view = NULL, + dim.1 = NULL, + dim.2 = NULL, + dim.3 = NULL, + w.1 = NULL, + w.2 = NULL, + w.3 = NULL, + cells = NULL, + alpha = 0.2, + size = 4, + title = NULL, + title.cex = 3, + title.line = 0, + bounding.box = T, + xlab = NULL, + ylab = NULL, + zlab = NULL, + continuous.colors = NULL, + continuous.color.limits = NULL, + discrete.colors = NULL +) } \arguments{ \item{object}{An URD object} diff --git a/man/plotDim3DStoreView.Rd b/man/plotDim3DStoreView.Rd index 6f64aff..bc4e5be 100644 --- a/man/plotDim3DStoreView.Rd +++ b/man/plotDim3DStoreView.Rd @@ -4,9 +4,17 @@ \alias{plotDim3DStoreView} \title{Store a 3D view for plotDim3D} \usage{ -plotDim3DStoreView(object, view.name, reduction.use = c("dm", "pca"), - dim.1 = 1, dim.2 = 2, dim.3 = 3, w.1 = NULL, w.2 = NULL, - w.3 = NULL) +plotDim3DStoreView( + object, + view.name, + reduction.use = c("dm", "pca"), + dim.1 = 1, + dim.2 = 2, + dim.3 = 3, + w.1 = NULL, + w.2 = NULL, + w.3 = NULL +) } \arguments{ \item{object}{An URD object} diff --git a/man/plotDimArray.Rd b/man/plotDimArray.Rd index 7484eb0..0ece2ef 100644 --- a/man/plotDimArray.Rd +++ b/man/plotDimArray.Rd @@ -4,9 +4,16 @@ \alias{plotDimArray} \title{Dimensionality Reduction Plot Array} \usage{ -plotDimArray(object, reduction.use = c("dm", "pca"), dims.to.plot, - outer.title = NULL, file = NULL, file.width = 750, file.height = 600, - ...) +plotDimArray( + object, + reduction.use = c("dm", "pca"), + dims.to.plot, + outer.title = NULL, + file = NULL, + file.width = 750, + file.height = 600, + ... +) } \arguments{ \item{object}{An URD object} diff --git a/man/plotDimDiscretized.Rd b/man/plotDimDiscretized.Rd index 397cd64..d5e94f8 100644 --- a/man/plotDimDiscretized.Rd +++ b/man/plotDimDiscretized.Rd @@ -4,12 +4,22 @@ \alias{plotDimDiscretized} \title{Dimensionality Reduction Plot (Multi-Color, Discretized)} \usage{ -plotDimDiscretized(object, labels, label.types = rep("search", - length(labels)), label.min = rep(0, length(labels)), label.max = rep(Inf, - length(labels)), colors = c("grey", "blue", "green", "red", "cyan", - "magenta", "yellow", "black"), reduction.use = c("tsne", "pca", "dm"), - dim.x = 1, dim.y = 2, point.size = 1, alpha = 1, plot.title = NULL, - x.lim = NULL, y.lim = NULL) +plotDimDiscretized( + object, + labels, + label.types = rep("search", length(labels)), + label.min = rep(0, length(labels)), + label.max = rep(Inf, length(labels)), + colors = c("grey", "blue", "green", "red", "cyan", "magenta", "yellow", "black"), + reduction.use = c("tsne", "pca", "dm"), + dim.x = 1, + dim.y = 2, + point.size = 1, + alpha = 1, + plot.title = NULL, + x.lim = NULL, + y.lim = NULL +) } \arguments{ \item{object}{An URD object} diff --git a/man/plotDimDual.Rd b/man/plotDimDual.Rd index 0a9577b..1d0db8d 100644 --- a/man/plotDimDual.Rd +++ b/man/plotDimDual.Rd @@ -4,12 +4,27 @@ \alias{plotDimDual} \title{Dimensionality Reduction Plot (Dual Color)} \usage{ -plotDimDual(object, label.red, label.green, label.red.type = "search", - label.green.type = "search", reduction.use = c("tsne", "pca", "dm"), - dim.x = 1, dim.y = 2, point.size = 1, alpha = 1, plot.title = "", - legend = T, legend.size = 1/5.5, legend.offset.x = 0, - legend.offset.y = 0, x.lim = NULL, y.lim = NULL, na.rm = F, - na.alpha = 0.4 * alpha) +plotDimDual( + object, + label.red, + label.green, + label.red.type = "search", + label.green.type = "search", + reduction.use = c("tsne", "pca", "dm"), + dim.x = 1, + dim.y = 2, + point.size = 1, + alpha = 1, + plot.title = "", + legend = T, + legend.size = 1/5.5, + legend.offset.x = 0, + legend.offset.y = 0, + x.lim = NULL, + y.lim = NULL, + na.rm = F, + na.alpha = 0.4 * alpha +) } \arguments{ \item{object}{An URD object} diff --git a/man/plotDists.Rd b/man/plotDists.Rd index 71b07f0..a9b4729 100644 --- a/man/plotDists.Rd +++ b/man/plotDists.Rd @@ -4,8 +4,15 @@ \alias{plotDists} \title{Plot distributions} \usage{ -plotDists(object, label, category.label, label.type = "search", - category.label.type = "search", legend = T, plot.title = "") +plotDists( + object, + label, + category.label, + label.type = "search", + category.label.type = "search", + legend = T, + plot.title = "" +) } \arguments{ \item{object}{An URD object} diff --git a/man/plotDot.Rd b/man/plotDot.Rd index 0f97558..f431382 100644 --- a/man/plotDot.Rd +++ b/man/plotDot.Rd @@ -4,9 +4,19 @@ \alias{plotDot} \title{Dot Plot} \usage{ -plotDot(object, genes, clustering, clusters.use = NULL, min.exp = 0.05, - size.min = 0, size.max = 5, scale.by = c("radius", "area"), - colors = NULL, mean.expressing.only = F, title = "") +plotDot( + object, + genes, + clustering, + clusters.use = NULL, + min.exp = 0.05, + size.min = 0, + size.max = 5, + scale.by = c("radius", "area"), + colors = NULL, + mean.expressing.only = F, + title = "" +) } \arguments{ \item{object}{An URD object} diff --git a/man/plotScatter.Rd b/man/plotScatter.Rd index 861a56d..bb49c68 100644 --- a/man/plotScatter.Rd +++ b/man/plotScatter.Rd @@ -4,13 +4,30 @@ \alias{plotScatter} \title{Gene Expression Scatterplot} \usage{ -plotScatter(object, label.x, label.y, label.color = NULL, - label.x.type = "search", label.y.type = "search", - label.color.type = "search", cells = NULL, point.size = 1, - point.alpha = 1, xlim = NULL, ylim = NULL, density.background = T, - density.color = "#888888", density.bandwidth = 1, density.bins = 128, - density.exclude.origin = T, xlab = label.x, ylab = label.y, - colorlab = label.color, title = "", legend = T) +plotScatter( + object, + label.x, + label.y, + label.color = NULL, + label.x.type = "search", + label.y.type = "search", + label.color.type = "search", + cells = NULL, + point.size = 1, + point.alpha = 1, + xlim = NULL, + ylim = NULL, + density.background = T, + density.color = "#888888", + density.bandwidth = 1, + density.bins = 128, + density.exclude.origin = T, + xlab = label.x, + ylab = label.y, + colorlab = label.color, + title = "", + legend = T +) } \arguments{ \item{object}{An URD object} diff --git a/man/plotSmoothFit.Rd b/man/plotSmoothFit.Rd index 48015f2..a605e96 100644 --- a/man/plotSmoothFit.Rd +++ b/man/plotSmoothFit.Rd @@ -4,9 +4,17 @@ \alias{plotSmoothFit} \title{Gene Smooth: Plot a single fit} \usage{ -plotSmoothFit(smoothed.fit, genes, scaled = T, multiplot = F, - plot.data = T, alpha.data = 0.2, alpha.smooth = 1, lwd.smooth = 1, - plot.title = NULL) +plotSmoothFit( + smoothed.fit, + genes, + scaled = T, + multiplot = F, + plot.data = T, + alpha.data = 0.2, + alpha.smooth = 1, + lwd.smooth = 1, + plot.title = NULL +) } \arguments{ \item{smoothed.fit}{(List) Output from either \code{\link{geneSmoothFit}} or \code{\link{geneCascadeProcess}}} diff --git a/man/plotSmoothFitMultiCascade.Rd b/man/plotSmoothFitMultiCascade.Rd index 4dde2cb..c766ca4 100644 --- a/man/plotSmoothFitMultiCascade.Rd +++ b/man/plotSmoothFitMultiCascade.Rd @@ -4,9 +4,17 @@ \alias{plotSmoothFitMultiCascade} \title{Gene Smooth: Plot multiple fits} \usage{ -plotSmoothFitMultiCascade(smoothed.fits, genes, colors = NULL, scaled = T, - plot.data = T, alpha.data = 0.2, alpha.smooth = 1, lwd.smooth = 1, - ncol = NULL) +plotSmoothFitMultiCascade( + smoothed.fits, + genes, + colors = NULL, + scaled = T, + plot.data = T, + alpha.data = 0.2, + alpha.smooth = 1, + lwd.smooth = 1, + ncol = NULL +) } \arguments{ \item{genes}{(Character vector) Genes to include in the plot(s)} diff --git a/man/plotTree.Rd b/man/plotTree.Rd index d0b6086..03ccf98 100644 --- a/man/plotTree.Rd +++ b/man/plotTree.Rd @@ -4,14 +4,33 @@ \alias{plotTree} \title{Plot 2D Dendrogram of URD Tree} \usage{ -plotTree(object, label = NULL, label.type = "search", title = label, - legend = T, legend.title = "", legend.point.size = 6 * cell.size, - plot.tree = T, tree.alpha = 1, tree.size = 1, plot.cells = T, - cell.alpha = 0.25, cell.size = 0.5, label.x = T, label.segments = F, - discrete.ignore.na = F, color.tree = NULL, continuous.colors = NULL, - discrete.colors = NULL, color.limits = NULL, - symmetric.color.scale = NULL, hide.y.ticks = T, cells.highlight = NULL, - cells.highlight.alpha = 1, cells.highlight.size = 2) +plotTree( + object, + label = NULL, + label.type = "search", + title = label, + legend = T, + legend.title = "", + legend.point.size = 6 * cell.size, + plot.tree = T, + tree.alpha = 1, + tree.size = 1, + plot.cells = T, + cell.alpha = 0.25, + cell.size = 0.5, + label.x = T, + label.segments = F, + discrete.ignore.na = F, + color.tree = NULL, + continuous.colors = NULL, + discrete.colors = NULL, + color.limits = NULL, + symmetric.color.scale = NULL, + hide.y.ticks = T, + cells.highlight = NULL, + cells.highlight.alpha = 1, + cells.highlight.size = 2 +) } \arguments{ \item{object}{An URD object} @@ -28,7 +47,7 @@ plotTree(object, label = NULL, label.type = "search", title = label, \item{legend.point.size}{(Numeric) How big should points be in the legend?} -\item{plot.tree}{(Logical) Whether to plot the dendrogram} +\item{plot.tree}{(Logical) Whether cells should be plotted with the tree} \item{tree.alpha}{(Numeric) Transparency of dendrogram (0 is transparent, 1 is opaque)} @@ -61,8 +80,6 @@ plotTree(object, label = NULL, label.type = "search", title = label, \item{cells.highlight.alpha}{(Numeric) Transparency of highlighted cells (0 is transparent, 1 is opaque)} \item{cells.highlight.size}{(Numeric) Size of highlighted cells} - -\item{plot.tree}{(Logical) Whether cells should be plotted with the tree} } \value{ A ggplot2 object diff --git a/man/plotTreeDiscretized.Rd b/man/plotTreeDiscretized.Rd index deb5eae..6447593 100644 --- a/man/plotTreeDiscretized.Rd +++ b/man/plotTreeDiscretized.Rd @@ -4,12 +4,23 @@ \alias{plotTreeDiscretized} \title{Plot 2D Dendrogram of URD Tree, Discretized} \usage{ -plotTreeDiscretized(object, labels, label.types = rep("search", - length(labels)), label.min = rep(0, length(labels)), label.max = rep(Inf, - length(labels)), colors = c("grey", "blue", "green", "red", "cyan", - "magenta", "yellow", "black"), title = NULL, tree.alpha = 1, - tree.size = 1, tree.color = "grey", cell.alpha = 0.5, cell.size = 0.3, - label.x = T, label.segments = F, hide.y.ticks = T) +plotTreeDiscretized( + object, + labels, + label.types = rep("search", length(labels)), + label.min = rep(0, length(labels)), + label.max = rep(Inf, length(labels)), + colors = c("grey", "blue", "green", "red", "cyan", "magenta", "yellow", "black"), + title = NULL, + tree.alpha = 1, + tree.size = 1, + tree.color = "grey", + cell.alpha = 0.5, + cell.size = 0.3, + label.x = T, + label.segments = F, + hide.y.ticks = T +) } \arguments{ \item{object}{An URD object} diff --git a/man/plotTreeDual.Rd b/man/plotTreeDual.Rd index 2c82ee5..9663ea9 100644 --- a/man/plotTreeDual.Rd +++ b/man/plotTreeDual.Rd @@ -4,12 +4,28 @@ \alias{plotTreeDual} \title{Plot 2D Dendrogram of URD Tree} \usage{ -plotTreeDual(object, label.red, label.green, label.type.red = "search", - label.type.green = "search", title = NULL, legend = T, - legend.title = "", plot.tree = T, tree.alpha = 1, tree.size = 1, - plot.cells = T, cell.alpha = 0.25, cell.size = 0.5, label.x = T, - label.segments = F, color.tree = T, color.limits.red = NULL, - color.limits.green = NULL, hide.y.ticks = T) +plotTreeDual( + object, + label.red, + label.green, + label.type.red = "search", + label.type.green = "search", + title = NULL, + legend = T, + legend.title = "", + plot.tree = T, + tree.alpha = 1, + tree.size = 1, + plot.cells = T, + cell.alpha = 0.25, + cell.size = 0.5, + label.x = T, + label.segments = F, + color.tree = T, + color.limits.red = NULL, + color.limits.green = NULL, + hide.y.ticks = T +) } \arguments{ \item{object}{An URD object} @@ -28,7 +44,7 @@ plotTreeDual(object, label.red, label.green, label.type.red = "search", \item{legend.title}{(Character) Title to display on the legend} -\item{plot.tree}{(Logical) Whether to plot the dendrogram} +\item{plot.tree}{(Logical) Whether cells should be plotted with the tree} \item{tree.alpha}{(Numeric) Transparency of dendrogram (0 is transparent, 1 is opaque)} @@ -49,8 +65,6 @@ plotTreeDual(object, label.red, label.green, label.type.red = "search", \item{color.limits.green}{(Numeric vector, length 2) Minimum and maximum values for color scale. Default \code{NULL} auto-detects.} \item{hide.y.ticks}{(Logical) Should the pseudotime values on the y-axis be hidden?} - -\item{plot.tree}{(Logical) Whether cells should be plotted with the tree} } \value{ A ggplot2 object diff --git a/man/plotTreeForce.Rd b/man/plotTreeForce.Rd index a868b14..2ec3bca 100644 --- a/man/plotTreeForce.Rd +++ b/man/plotTreeForce.Rd @@ -4,16 +4,31 @@ \alias{plotTreeForce} \title{Plot force-directed layout of tree} \usage{ -plotTreeForce(object, label, label.type = "search", view = "default", - alpha = 0.8, alpha.fade = 0.1, size = 5, title = NULL, - title.cex = 3, title.line = 0, +plotTreeForce( + object, + label, + label.type = "search", + view = "default", + alpha = 0.8, + alpha.fade = 0.1, + size = 5, + title = NULL, + title.cex = 3, + title.line = 0, label.tips = (!is.null(object@tree$segment.names) | - !is.null(object@tree$segment.names.short)), + !is.null(object@tree$segment.names.short)), use.short.names = !is.null(object@tree$segment.names.short), - seg.show = NULL, cells.show = NULL, fade.below = (2/9), - density.alpha = T, label.spacing = 5, text.cex = 0.8, colors = NULL, - discrete.colors = NULL, color.limits = NULL, - symmetric.color.scale = NULL) + seg.show = NULL, + cells.show = NULL, + fade.below = (2/9), + density.alpha = T, + label.spacing = 5, + text.cex = 0.8, + colors = NULL, + discrete.colors = NULL, + color.limits = NULL, + symmetric.color.scale = NULL +) } \arguments{ \item{object}{An URD object} diff --git a/man/plotTreeForce2D.Rd b/man/plotTreeForce2D.Rd index 24665c8..43b2bec 100644 --- a/man/plotTreeForce2D.Rd +++ b/man/plotTreeForce2D.Rd @@ -4,9 +4,18 @@ \alias{plotTreeForce2D} \title{Plot tree force-directed layout in 2D} \usage{ -plotTreeForce2D(object, label = NULL, label.type = "search", - title = label, show.points = T, point.alpha = 1, point.size = 1, - show.neighbors = F, neighbors.max = 10000, colors = NULL) +plotTreeForce2D( + object, + label = NULL, + label.type = "search", + title = label, + show.points = T, + point.alpha = 1, + point.size = 1, + show.neighbors = F, + neighbors.max = 10000, + colors = NULL +) } \arguments{ \item{object}{An URD object} diff --git a/man/plotTreeForceDual.Rd b/man/plotTreeForceDual.Rd index d8214ea..e162be7 100644 --- a/man/plotTreeForceDual.Rd +++ b/man/plotTreeForceDual.Rd @@ -4,15 +4,30 @@ \alias{plotTreeForceDual} \title{Plot force-directed layout of tree} \usage{ -plotTreeForceDual(object, label.red, label.green, label.red.type = "search", - label.green.type = "search", view = "default", alpha = 0.8, - alpha.fade = 0.025, size = 5, title = NULL, title.cex = 3, - title.line = 0, label.tips = (!is.null(object@tree$segment.names) | - !is.null(object@tree$segment.names.short)), +plotTreeForceDual( + object, + label.red, + label.green, + label.red.type = "search", + label.green.type = "search", + view = "default", + alpha = 0.8, + alpha.fade = 0.025, + size = 5, + title = NULL, + title.cex = 3, + title.line = 0, + label.tips = (!is.null(object@tree$segment.names) | + !is.null(object@tree$segment.names.short)), use.short.names = !is.null(object@tree$segment.names.short), - seg.show = NULL, cells.show = NULL, fade.below = (1/3), - fade.method = c("max", "min", "mean"), density.alpha = T, - label.spacing = 5, text.cex = 0.8) + seg.show = NULL, + cells.show = NULL, + fade.below = (1/3), + fade.method = c("max", "min", "mean"), + density.alpha = T, + label.spacing = 5, + text.cex = 0.8 +) } \arguments{ \item{object}{An URD object} diff --git a/man/plotTreeHighlight.Rd b/man/plotTreeHighlight.Rd index 42d96e5..322c9e9 100644 --- a/man/plotTreeHighlight.Rd +++ b/man/plotTreeHighlight.Rd @@ -4,9 +4,17 @@ \alias{plotTreeHighlight} \title{Plot 2D Dendrogram of URD Tree (with cells that meet arbitrary criteria highlighted)} \usage{ -plotTreeHighlight(object, label.name, label.value, color = "red", - bg.color = "#CCCCCC", highlight.alpha = 0.6, highlight.size = 1.5, - combine = c("intersect", "union"), ...) +plotTreeHighlight( + object, + label.name, + label.value, + color = "red", + bg.color = "#CCCCCC", + highlight.alpha = 0.6, + highlight.size = 1.5, + combine = c("intersect", "union"), + ... +) } \arguments{ \item{object}{An URD object} diff --git a/man/plotViolin.Rd b/man/plotViolin.Rd index 92eed56..ed55b20 100644 --- a/man/plotViolin.Rd +++ b/man/plotViolin.Rd @@ -4,9 +4,17 @@ \alias{plotViolin} \title{Violin plot of gene expression} \usage{ -plotViolin(object, labels.plot, clustering, clusters.use = NULL, legend = T, - free.axes = F, point.size = 0.2, point.color = "black", - point.alpha = 0.5) +plotViolin( + object, + labels.plot, + clustering, + clusters.use = NULL, + legend = T, + free.axes = F, + point.size = 0.2, + point.color = "black", + point.alpha = 0.5 +) } \arguments{ \item{object}{An URD object} diff --git a/man/processRandomWalks.Rd b/man/processRandomWalks.Rd index 6bc835d..78af653 100644 --- a/man/processRandomWalks.Rd +++ b/man/processRandomWalks.Rd @@ -4,8 +4,14 @@ \alias{processRandomWalks} \title{Process random walks into visitation frequency} \usage{ -processRandomWalks(object, walks, walks.name, aggregate.fun = mean, - n.subsample = 10, verbose = T) +processRandomWalks( + object, + walks, + walks.name, + aggregate.fun = mean, + n.subsample = 10, + verbose = T +) } \arguments{ \item{object}{An URD object} diff --git a/man/processRandomWalksFromTips.Rd b/man/processRandomWalksFromTips.Rd index b1bb0ff..2633328 100644 --- a/man/processRandomWalksFromTips.Rd +++ b/man/processRandomWalksFromTips.Rd @@ -4,8 +4,13 @@ \alias{processRandomWalksFromTips} \title{Process random walks from all tips} \usage{ -processRandomWalksFromTips(object, walks.list, aggregate.fun = mean, - n.subsample = 10, verbose = T) +processRandomWalksFromTips( + object, + walks.list, + aggregate.fun = mean, + n.subsample = 10, + verbose = T +) } \arguments{ \item{object}{An URD object} diff --git a/man/pseudotimeBreakpointByStretch.Rd b/man/pseudotimeBreakpointByStretch.Rd index b7285f8..ad91621 100644 --- a/man/pseudotimeBreakpointByStretch.Rd +++ b/man/pseudotimeBreakpointByStretch.Rd @@ -4,8 +4,14 @@ \alias{pseudotimeBreakpointByStretch} \title{Pseudotime Breakpoint By Stretch} \usage{ -pseudotimeBreakpointByStretch(div.pseudotime, segment.1, segment.2, visit.data, - pseudotime.windows, verbose = T) +pseudotimeBreakpointByStretch( + div.pseudotime, + segment.1, + segment.2, + visit.data, + pseudotime.windows, + verbose = T +) } \description{ Pseudotime Breakpoint By Stretch diff --git a/man/pseudotimeBreakpointByStretchV1.Rd b/man/pseudotimeBreakpointByStretchV1.Rd index 7e7cc4f..ab95713 100644 --- a/man/pseudotimeBreakpointByStretchV1.Rd +++ b/man/pseudotimeBreakpointByStretchV1.Rd @@ -4,8 +4,14 @@ \alias{pseudotimeBreakpointByStretchV1} \title{Find Pseudotime Breakpoint} \usage{ -pseudotimeBreakpointByStretchV1(div.pseudotime, segment.1, segment.2, - visit.data, pseudotime.windows, verbose = T) +pseudotimeBreakpointByStretchV1( + div.pseudotime, + segment.1, + segment.2, + visit.data, + pseudotime.windows, + verbose = T +) } \description{ Find Pseudotime Breakpoint diff --git a/man/pseudotimeDetermineLogistic.Rd b/man/pseudotimeDetermineLogistic.Rd index 08062ef..d981622 100644 --- a/man/pseudotimeDetermineLogistic.Rd +++ b/man/pseudotimeDetermineLogistic.Rd @@ -4,9 +4,15 @@ \alias{pseudotimeDetermineLogistic} \title{Determine logistic parameters for biasing transition matrix} \usage{ -pseudotimeDetermineLogistic(object, pseudotime, optimal.cells.forward, - max.cells.back, pseudotime.direction = "<", do.plot = T, - print.values = T) +pseudotimeDetermineLogistic( + object, + pseudotime, + optimal.cells.forward, + max.cells.back, + pseudotime.direction = "<", + do.plot = T, + print.values = T +) } \arguments{ \item{object}{An URD object} diff --git a/man/pseudotimeMovingWindow.Rd b/man/pseudotimeMovingWindow.Rd index 7cdb86d..62044a8 100644 --- a/man/pseudotimeMovingWindow.Rd +++ b/man/pseudotimeMovingWindow.Rd @@ -4,9 +4,15 @@ \alias{pseudotimeMovingWindow} \title{Moving window through pseudotime} \usage{ -pseudotimeMovingWindow(object, pseudotime, cells, moving.window, - cells.per.window = NULL, pseudotime.per.window = NULL, - name.by = c("mean", "min", "max")) +pseudotimeMovingWindow( + object, + pseudotime, + cells, + moving.window, + cells.per.window = NULL, + pseudotime.per.window = NULL, + name.by = c("mean", "min", "max") +) } \arguments{ \item{object}{A URD object} diff --git a/man/pseudotimeWeightTransitionMatrix.Rd b/man/pseudotimeWeightTransitionMatrix.Rd index b3d9cc1..5d0ee48 100644 --- a/man/pseudotimeWeightTransitionMatrix.Rd +++ b/man/pseudotimeWeightTransitionMatrix.Rd @@ -4,9 +4,16 @@ \alias{pseudotimeWeightTransitionMatrix} \title{Weight transition matrix by pseudotime} \usage{ -pseudotimeWeightTransitionMatrix(object, pseudotime, x0 = NULL, k = NULL, - logistic.params = NULL, pseudotime.direction = "<", - max.records = 2.25e+08, verbose = F) +pseudotimeWeightTransitionMatrix( + object, + pseudotime, + x0 = NULL, + k = NULL, + logistic.params = NULL, + pseudotime.direction = "<", + max.records = 2.25e+08, + verbose = F +) } \arguments{ \item{object}{An URD object} diff --git a/man/segChildrenAll.Rd b/man/segChildrenAll.Rd index 934132a..be19287 100644 --- a/man/segChildrenAll.Rd +++ b/man/segChildrenAll.Rd @@ -4,8 +4,13 @@ \alias{segChildrenAll} \title{All children of segment} \usage{ -segChildrenAll(object, segment, include.self = F, original.joins = F, - format = c("unary", "binary")) +segChildrenAll( + object, + segment, + include.self = F, + original.joins = F, + format = c("unary", "binary") +) } \arguments{ \item{object}{An URD object} diff --git a/man/simulateRandomWalk.Rd b/man/simulateRandomWalk.Rd index 20c63e6..1d57e03 100644 --- a/man/simulateRandomWalk.Rd +++ b/man/simulateRandomWalk.Rd @@ -4,8 +4,15 @@ \alias{simulateRandomWalk} \title{Simulate random walks} \usage{ -simulateRandomWalk(start.cells, transition.matrix, end.cells, n = 10000, - end.visits = 1, verbose.freq = 0, max.steps = 5000) +simulateRandomWalk( + start.cells, + transition.matrix, + end.cells, + n = 10000, + end.visits = 1, + verbose.freq = 0, + max.steps = 5000 +) } \arguments{ \item{start.cells}{(Character vector) Cells to use as a starting pool. One cell is chosen at random each simulation.} diff --git a/man/simulateRandomWalksFromTips.Rd b/man/simulateRandomWalksFromTips.Rd index 234d226..dfac544 100644 --- a/man/simulateRandomWalksFromTips.Rd +++ b/man/simulateRandomWalksFromTips.Rd @@ -4,9 +4,16 @@ \alias{simulateRandomWalksFromTips} \title{Simulate Random Walks From All Tips} \usage{ -simulateRandomWalksFromTips(object, tip.group.id, root.cells, transition.matrix, - n.per.tip = 10000, root.visits = 1, - max.steps = ncol(object@logupx.data), verbose = T) +simulateRandomWalksFromTips( + object, + tip.group.id, + root.cells, + transition.matrix, + n.per.tip = 10000, + root.visits = 1, + max.steps = ncol(object@logupx.data), + verbose = T +) } \arguments{ \item{object}{An URD object} diff --git a/man/tipPotential.Rd b/man/tipPotential.Rd index 57d4edc..c55cd6f 100644 --- a/man/tipPotential.Rd +++ b/man/tipPotential.Rd @@ -4,9 +4,15 @@ \alias{tipPotential} \title{Find tip potential} \usage{ -tipPotential(object, pseudotime, range.function = prop.nonexp, - genes.use = object@var.genes, nn.dist.range = c(20, 22), - pseudotime.name = "tip.potential", cell.dist = NULL) +tipPotential( + object, + pseudotime, + range.function = prop.nonexp, + genes.use = object@var.genes, + nn.dist.range = c(20, 22), + pseudotime.name = "tip.potential", + cell.dist = NULL +) } \arguments{ \item{object}{An URD object} diff --git a/man/treeForceDirectedLayout.Rd b/man/treeForceDirectedLayout.Rd index 5e94cc8..1ed4848 100644 --- a/man/treeForceDirectedLayout.Rd +++ b/man/treeForceDirectedLayout.Rd @@ -4,14 +4,26 @@ \alias{treeForceDirectedLayout} \title{Generate force-directed layout using tip-walk data.} \usage{ -treeForceDirectedLayout(object, num.nn = NULL, method = c("fr", "drl", - "kk"), cells.to.do = NULL, cell.minimum.walks = 1, - cut.outlier.cells = NULL, cut.outlier.edges = NULL, - max.pseudotime.diff = NULL, cut.unconnected.segments = 2, - min.final.neighbors = 2, remove.duplicate.cells = T, - tips = object@tree$tips, coords = "auto", start.temp = NULL, - n.iter = NULL, density.neighbors = 10, plot.outlier.cuts = F, - verbose = F) +treeForceDirectedLayout( + object, + num.nn = NULL, + method = c("fr", "drl", "kk"), + cells.to.do = NULL, + cell.minimum.walks = 1, + cut.outlier.cells = NULL, + cut.outlier.edges = NULL, + max.pseudotime.diff = NULL, + cut.unconnected.segments = 2, + min.final.neighbors = 2, + remove.duplicate.cells = T, + tips = object@tree$tips, + coords = "auto", + start.temp = NULL, + n.iter = NULL, + density.neighbors = 10, + plot.outlier.cuts = F, + verbose = F +) } \arguments{ \item{object}{An URD object} diff --git a/man/treeForceRotateCoords.Rd b/man/treeForceRotateCoords.Rd index 067a3d9..b0c22e2 100644 --- a/man/treeForceRotateCoords.Rd +++ b/man/treeForceRotateCoords.Rd @@ -4,9 +4,16 @@ \alias{treeForceRotateCoords} \title{Rotate points in force-directed layout} \usage{ -treeForceRotateCoords(object, cells = NULL, seg = NULL, angle, - axis = c("x", "y", "z"), around.cell = NULL, throw.out.cells = 0, - pseudotime = NULL) +treeForceRotateCoords( + object, + cells = NULL, + seg = NULL, + angle, + axis = c("x", "y", "z"), + around.cell = NULL, + throw.out.cells = 0, + pseudotime = NULL +) } \arguments{ \item{object}{An URD object} diff --git a/man/treeForceStretchCoords.Rd b/man/treeForceStretchCoords.Rd index 58270df..c01a6a5 100644 --- a/man/treeForceStretchCoords.Rd +++ b/man/treeForceStretchCoords.Rd @@ -4,8 +4,15 @@ \alias{treeForceStretchCoords} \title{Stretch points in force-directed layout} \usage{ -treeForceStretchCoords(object, factor, cells = NULL, seg = NULL, - stretch.from = 20, throw.out.cells = 0, ramp = 0.1) +treeForceStretchCoords( + object, + factor, + cells = NULL, + seg = NULL, + stretch.from = 20, + throw.out.cells = 0, + ramp = 0.1 +) } \arguments{ \item{object}{An URD object} diff --git a/man/txCutoffPlot.Rd b/man/txCutoffPlot.Rd index c230274..d610b0a 100644 --- a/man/txCutoffPlot.Rd +++ b/man/txCutoffPlot.Rd @@ -4,8 +4,13 @@ \alias{txCutoffPlot} \title{Plot Cumulative Distribution of Reads per Cell Barcode} \usage{ -txCutoffPlot(tx.reads.per.cell = NULL, molecule.info.path = NULL, - n.cells = NULL, main = "", xmax = 5000) +txCutoffPlot( + tx.reads.per.cell = NULL, + molecule.info.path = NULL, + n.cells = NULL, + main = "", + xmax = 5000 +) } \arguments{ \item{n.cells}{(Numeric) Draw a line at putative number of cells to use downstream} diff --git a/man/txReadDGE.Rd b/man/txReadDGE.Rd index 93b9da8..c5c4f10 100644 --- a/man/txReadDGE.Rd +++ b/man/txReadDGE.Rd @@ -4,8 +4,13 @@ \alias{txReadDGE} \title{Read in Digital Gene Expression Matrix from 10X Cellranger} \usage{ -txReadDGE(output.path, dge.name = NULL, cells.read = NULL, - name.by = c("gene", "id"), strip.num = T) +txReadDGE( + output.path, + dge.name = NULL, + cells.read = NULL, + name.by = c("gene", "id"), + strip.num = T +) } \arguments{ \item{output.path}{(Character) Path that contains barcodes.tsv, genes.tsv, and matrix.mtx from Cellranger} diff --git a/man/visitDivergenceByPseudotime.Rd b/man/visitDivergenceByPseudotime.Rd index fc16091..6b6d909 100644 --- a/man/visitDivergenceByPseudotime.Rd +++ b/man/visitDivergenceByPseudotime.Rd @@ -4,12 +4,23 @@ \alias{visitDivergenceByPseudotime} \title{Visitation Divergence for Pseudotime Windows} \usage{ -visitDivergenceByPseudotime(object, pseudotime, segment.1, segment.2, - cells.in.segments = NULL, cells.segment.1 = NULL, - cells.segment.2 = NULL, divergence.method = c("ks", "preference"), - pseudotime.cuts = 80, window.size = 5, pseudotime.min = NULL, - pseudotime.max = NULL, p.thresh = 0.01, pref.thresh = 0.5, - verbose = T) +visitDivergenceByPseudotime( + object, + pseudotime, + segment.1, + segment.2, + cells.in.segments = NULL, + cells.segment.1 = NULL, + cells.segment.2 = NULL, + divergence.method = c("ks", "preference"), + pseudotime.cuts = 80, + window.size = 5, + pseudotime.min = NULL, + pseudotime.max = NULL, + p.thresh = 0.01, + pref.thresh = 0.5, + verbose = T +) } \arguments{ \item{object}{An URD object} From 1ca1b3c74a2ca226dcf14f45ebfc117d90a8ed24 Mon Sep 17 00:00:00 2001 From: farrellja Date: Tue, 28 Apr 2020 14:18:22 -0400 Subject: [PATCH 23/24] Now tested with R 3.5 and R 3.6 --- INSTALL.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 6b68e2a..ccb81ee 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -8,8 +8,6 @@ R can be obtained and installed from [https://cran.rstudio.com](https://cran.rstudio.com). -URD has only been tested under R 3.4.x and may fail to install under R 3.5.x until some of its dependencies are updated. - Following installation of R, Rstudio can be obtained and installed from [https://www.rstudio.com/products/rstudio/download/](https://www.rstudio.com/products/rstudio/download/). The free version of RStudio Desktop is sufficient. ### 2. Install an X11 window client (Mac only) From 125c8296efceeb6d7738bea87fa3816d56553182 Mon Sep 17 00:00:00 2001 From: farrellja Date: Tue, 28 Apr 2020 14:18:39 -0400 Subject: [PATCH 24/24] Updated for version 1.1.1 --- NEWS.md | 22 ++++++++++++++++++++++ README.md | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 5705239..a84e2f5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,27 @@ # News +## 1.1.1 - April 28, 2020 +This release incorporates fixes to many bugs uncovered by users over the last several months. + +### Added +- `plotTreeHighlight` can be used to plot an URD dendrogram-style plot where particular cells on the tree are highlighted for visualizing their location. +- A more evenly spaced color scale is now accessible by using the `evenly.spaced = T` parameter to `defaultURDContinuousColors`. +- `combineSmoothFit` function can be used to put multiple spline curves together into a single spline curve. +- Additional visualization options for `plotDot`, including minimum and maximum point sizes, choice of scaling by area or radius, and customizable color scale. +- Additional visualization options for `plotViolin`, allowing customization of point size, color, and transparency. +- `treeForceDirectedLayout`: `cells.minimum.walks` parameter can automatically exclude poorly visited cells from the force-directed layout calculation. +- Calculations that use moving windows in pseudotime (including `geneSmoothFit` and its related functions) can now support minimum pseudotime and minimum cell numbers simultaneously. If both are set, windows are determined by number of cells, but then windows whose pseudotime is too small are collapsed. + +### Changed +- Fixed installation failures for R > 3.4 due to changes in BioConductor's package management (i.e. to use BiocManager for R >= 3.5). +- `markersAUCPR` now calculates AUC ratio compared to random classifier and correctly reports cluster labels. `auc.factor` parameter allows selecting only results that are some factor better than a random classifier. +- `markersAUCPR` now correctly takes pseudocount of 1 into account when determining expression fold-change. +- `plotDot` now uses a more evenly spaced color scale by default. +- Removed delta symbol from NMF doublets plots to prevent Unicode failures during installation. +- `buildTree`: If `tips.use` is not specified, will attempt to auto-detect. +- `buildTree`: Fixed error where function would fail if a tip was specified that had no member cells as defined by `loadTipCells` function. +- `buildTree` / `treeLayoutDendrogram`: Fixed bug in related to changes in ggraph 2.0.0 that was creating crazy dendrograms. + ## 1.1.0 - July 25, 2019 This release accompanies the release of our manuscript **[Stem cell differentiation trajectories in Hydra resolved at single-cell resolution](https://science.sciencemag.org/content/365/6451/eaav9314)** and includes new functions developed during the analysis presented in that work. diff --git a/README.md b/README.md index f0c2982..4395d28 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Science 26 Apr 2018. doi: 10.1126/science.aar3131 Detailed changes and minor versions are listed in [NEWS.md](NEWS.md) -#### Most recent bugfix: 1.1.0 (July 25, 2019) +#### Most recent bugfix: 1.1.1 (April 28, 2020) #### 2019/07/25: Version 1.1 released! This includes new functions for using NMF module analysis to detect and remove doublets, new functions for looking at gene expression relative to pseudotime, and new plotting functions for inspecting data. It accompanies the publication [Stem cell differentiation trajectories in Hydra resolved at single-cell resolution.](https://science.sciencemag.org/content/365/6451/eaav9314)