Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Bypass "object 'Dim_validate' not found" error #691

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Version: 1.6.1
Author: Suoqin Jin
Maintainer: Suoqin Jin <[email protected]>
Description: an open source R tool that infers, visualizes and analyzes the cell-cell communication networks from scRNA-seq and spatial imaging data.
Depends: R (>= 3.6.0),dplyr,igraph,ggplot2
Depends: R (>= 4.1.0),dplyr,igraph,ggplot2
License: GPL-3
Encoding: UTF-8
LazyData: true
Expand All @@ -18,7 +18,7 @@ Imports:
ggalluvial,
stringr,
svglite,
Matrix,
Matrix (>= 1.5.4),
expm,
Rtsne,
ggrepel,
Expand Down Expand Up @@ -47,6 +47,6 @@ Imports:
BiocNeighbors
LinkingTo: Rcpp, RcppEigen
Suggests:
rmarkdown, knitr, roxygen2, Seurat (>= 4.0.0), SingleCellExperiment, SummarizedExperiment, purrr,uwot,gg.gap,wordcloud
rmarkdown, knitr, roxygen2, Seurat (>= 4.1.0), SingleCellExperiment, SummarizedExperiment, purrr,uwot,gg.gap,wordcloud
RoxygenNote: 7.1.2
VignetteBuilder: knitr
2 changes: 1 addition & 1 deletion R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ runUMAP <- function(

.error_if_no_Seurat <- function() {
if (!requireNamespace("Seurat", quietly = TRUE)) {
stop("Seurat installation required for working with Seurat objects")
stop("Seurat installation required for working with Seurat objects and functions")
}
}

Expand Down
18 changes: 12 additions & 6 deletions R/visualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -3861,9 +3861,9 @@ pieChart <- function(df, label.size = 2.5, color.use = NULL, title = "") {
#' @export
#'
#' @examples

plotGeneExpression <- function(object, features = NULL, signaling = NULL, enriched.only = TRUE, type = c("violin", "dot","bar"), color.use = NULL, group.by = NULL, ...) {
type <- match.arg(type)
.error_if_no_Seurat() # Check Seurat installation
meta <- object@meta
if (is.list(object@idents)) {
meta$group.cellchat <- object@idents$joint
Expand Down Expand Up @@ -3933,9 +3933,11 @@ plotGeneExpression <- function(object, features = NULL, signaling = NULL, enrich
#'
#' @examples
#' @import ggplot2
dotPlot <- function(object, features, rotation = TRUE, colormap = "OrRd", color.direction = 1, color.use = c("#F8766D","#00BFC4"), scale = TRUE, col.min = -2.5, col.max = 2.5, dot.scale = 6, assay = "RNA",
dotPlot <- function(object, features, rotation = TRUE, colormap = "OrRd", color.direction = 1, color.use = c("#F8766D","#00BFC4"),
scale = TRUE, col.min = -2.5, col.max = 2.5, dot.scale = 6, assay = "RNA",
idents = NULL, group.by = NULL, split.by = NULL, legend.width = 0.5,
angle.x = 45, hjust.x = 1, angle.y = 0, hjust.y = 0.5, show.legend = TRUE, ...) {
.error_if_no_Seurat() # Check Seurat installation

gg <- Seurat::DotPlot(object, features = features, assay = assay, cols = color.use,
scale = scale, col.min = col.min, col.max = col.max, dot.scale = dot.scale,
Expand Down Expand Up @@ -3989,14 +3991,16 @@ dotPlot <- function(object, features, rotation = TRUE, colormap = "OrRd", color.
#'
#' @examples
#' @import ggplot2
#' @importFrom patchwork wrap_plots
#' @importFrom patchwork wrap_plots
StackedVlnPlot<- function(object, features, idents = NULL, split.by = NULL,
color.use = NULL, colors.ggplot = FALSE,show.median = FALSE, median.size = 1,
angle.x = 90, vjust.x = NULL, hjust.x = NULL, show.text.y = TRUE, line.size = NULL,
pt.size = 0,
plot.margin = margin(0, 0, 0, 0, "cm"),
...) {
.error_if_no_Seurat() # Check Seurat installation
options(warn=-1)

if (is.null(color.use)) {
numCluster <- length(levels(Seurat::Idents(object)))
if (colors.ggplot) {
Expand Down Expand Up @@ -4047,7 +4051,6 @@ StackedVlnPlot<- function(object, features, idents = NULL, split.by = NULL,
#' @param plot.margin adjust the white space between each plot
#' @param ... pass any arguments to VlnPlot in Seurat
#' @import ggplot2
#'
modify_vlnplot<- function(object,
features,
idents = NULL,
Expand All @@ -4060,8 +4063,10 @@ modify_vlnplot<- function(object,
pt.size = 0,
plot.margin = margin(0, 0, 0, 0, "cm"),
...) {
.error_if_no_Seurat() # Check Seurat installation
options(warn=-1)
p<- Seurat::VlnPlot(object, features = features, cols = cols, pt.size = pt.size, idents = idents, split.by = split.by, ... ) +

p <- Seurat::VlnPlot(object, features = features, cols = cols, pt.size = pt.size, idents = idents, split.by = split.by, ... ) +
xlab("") + ylab(features) + ggtitle("")
if (show.median) {
p <- p + stat_summary(fun.y=median, geom="point", shape=3, size=median.size)
Expand Down Expand Up @@ -4118,8 +4123,9 @@ extract_max<- function(p){
barPlot <- function(object, features, group.by = NULL, split.by = NULL, color.use = NULL, method = c("truncatedMean", "triMean","median"),trim = 0.1, assay = "RNA",
x.lab.rot = FALSE, ncol = 1, ...) {
method <- match.arg(method)
.error_if_no_Seurat() # Check Seurat installation
if (is.null(group.by)) {
labels = Idents(object)
labels = Seurat::Idents(object)
} else {
labels = [email protected][,group.by]
}
Expand Down