Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #149

Merged
merged 5 commits into from
Aug 29, 2023
Merged
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: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: SCP
Type: Package
Title: Single Cell Pipeline
Version: 0.4.8
Version: 0.5.1
Author: Hao Zhang
Maintainer: Hao Zhang <[email protected]>
Description: SCP provides a comprehensive set of tools for single cell data processing and downstream analysis.
Expand All @@ -11,7 +11,7 @@ LazyData: True
LazyDataCompression: xz
Depends:
R (>= 4.1.0)
biocViews: SingleCell, Visualization
biocViews: SingleCell, GeneExpression, SingleCellWorkflow, Visualization, ShinyApps
Imports:
AnnotationDbi,
BiocParallel,
Expand All @@ -25,6 +25,7 @@ Imports:
ggplot2 (>= 3.4.0),
ggtree (>= 3.6.1),
ggrepel,
ggforce,
GO.db,
GOSemSim,
grDevices,
Expand Down Expand Up @@ -63,6 +64,7 @@ Remotes:
YuLab-SMU/ggtree
Suggests:
AUCell,
concaveman,
covr,
destiny,
devtools,
Expand Down
36 changes: 35 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Generated by roxygen2: do not edit by hand

S3method(RunDM,Neighbor)
S3method(RunDM,Seurat)
S3method(RunDM,dist)
S3method(RunDM,matrix)
S3method(RunFR,Seurat)
S3method(RunFR,default)
S3method(RunGLMPCA,Assay)
S3method(RunGLMPCA,Seurat)
S3method(RunGLMPCA,default)
Expand Down Expand Up @@ -80,6 +82,7 @@ export(RunDoubletCalling)
export(RunDynamicEnrichment)
export(RunDynamicFeatures)
export(RunEnrichment)
export(RunFR)
export(RunGLMPCA)
export(RunGSEA)
export(RunHarmony2)
Expand Down Expand Up @@ -298,6 +301,7 @@ importFrom(dplyr,across)
importFrom(dplyr,all_of)
importFrom(dplyr,arrange)
importFrom(dplyr,arrange_at)
importFrom(dplyr,bind_rows)
importFrom(dplyr,case_when)
importFrom(dplyr,desc)
importFrom(dplyr,distinct)
Expand All @@ -308,12 +312,16 @@ importFrom(dplyr,mutate)
importFrom(dplyr,n)
importFrom(dplyr,pull)
importFrom(dplyr,reframe)
importFrom(dplyr,slice_head)
importFrom(dplyr,summarise)
importFrom(dplyr,summarise_at)
importFrom(ggforce,geom_mark_ellipse)
importFrom(ggforce,geom_mark_hull)
importFrom(ggnewscale,new_scale)
importFrom(ggnewscale,new_scale_color)
importFrom(ggnewscale,new_scale_fill)
importFrom(ggplot2,"%+replace%")
importFrom(ggplot2,.pt)
importFrom(ggplot2,aes)
importFrom(ggplot2,after_stat)
importFrom(ggplot2,alpha)
Expand All @@ -322,6 +330,7 @@ importFrom(ggplot2,annotation_custom)
importFrom(ggplot2,coord_cartesian)
importFrom(ggplot2,coord_flip)
importFrom(ggplot2,coord_polar)
importFrom(ggplot2,draw_key_point)
importFrom(ggplot2,element_blank)
importFrom(ggplot2,element_line)
importFrom(ggplot2,element_rect)
Expand All @@ -341,6 +350,7 @@ importFrom(ggplot2,geom_curve)
importFrom(ggplot2,geom_density_2d)
importFrom(ggplot2,geom_hex)
importFrom(ggplot2,geom_hline)
importFrom(ggplot2,geom_label)
importFrom(ggplot2,geom_line)
importFrom(ggplot2,geom_linerange)
importFrom(ggplot2,geom_path)
Expand Down Expand Up @@ -391,6 +401,7 @@ importFrom(ggplot2,scale_fill_gradient)
importFrom(ggplot2,scale_fill_gradientn)
importFrom(ggplot2,scale_fill_identity)
importFrom(ggplot2,scale_fill_manual)
importFrom(ggplot2,scale_linewidth)
importFrom(ggplot2,scale_linewidth_continuous)
importFrom(ggplot2,scale_shape_identity)
importFrom(ggplot2,scale_size)
Expand Down Expand Up @@ -455,8 +466,31 @@ importFrom(gtable,gtable_add_padding)
importFrom(gtable,gtable_add_rows)
importFrom(gtable,gtable_col)
importFrom(gtable,is.gtable)
importFrom(igraph,V)
importFrom(igraph,as_adjacency_matrix)
importFrom(igraph,as_data_frame)
importFrom(igraph,cluster_fast_greedy)
importFrom(igraph,cluster_fluid_communities)
importFrom(igraph,cluster_infomap)
importFrom(igraph,cluster_leiden)
importFrom(igraph,cluster_louvain)
importFrom(igraph,cluster_spinglass)
importFrom(igraph,cluster_walktrap)
importFrom(igraph,degree)
importFrom(igraph,graph_from_adjacency_matrix)
importFrom(igraph,graph_from_data_frame)
importFrom(igraph,layout_as_tree)
importFrom(igraph,layout_in_circle)
importFrom(igraph,layout_on_grid)
importFrom(igraph,layout_with_dh)
importFrom(igraph,layout_with_drl)
importFrom(igraph,layout_with_fr)
importFrom(igraph,layout_with_gem)
importFrom(igraph,layout_with_graphopt)
importFrom(igraph,layout_with_kk)
importFrom(igraph,layout_with_lgl)
importFrom(igraph,layout_with_mds)
importFrom(igraph,neighbors)
importFrom(methods,"slot<-")
importFrom(methods,as)
importFrom(methods,getFunction)
Expand Down
791 changes: 614 additions & 177 deletions R/SCP-analysis.R

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions R/SCP-app.R
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@ server <- function(input, output, session) {
# print(">>> plot:")
# print(system.time(
p2_dim <- SCP::FeatureDimPlot(
srt = srt_tmp, features = features2, split.by = split2, reduction = reduction2, slot = slots2, raster = raster2,
srt = srt_tmp, features = features2, split.by = split2, reduction = reduction2, slot = "data", raster = raster2,
calculate_coexp = ifelse(coExp2 == "Yes", TRUE, FALSE), palette = palette2, theme_use = theme2,
ncol = ncol2, byrow = ifelse(arrange2 == "Row", TRUE, FALSE), force = TRUE
)
Expand Down Expand Up @@ -1647,7 +1647,7 @@ server <- function(input, output, session) {
# print(">>> plot:")
# print(system.time(
p4 <- SCP::FeatureStatPlot(
srt = srt_tmp, stat.by = features4, group.by = group4, split.by = split4, plot_type = plottype4,
srt = srt_tmp, stat.by = features4, group.by = group4, split.by = split4, slot = "data", plot_type = plottype4,
calculate_coexp = ifelse(coExp4 == "Yes", TRUE, FALSE), palette = palette4,
aspect.ratio = 6 / max(length(unique(srt_tmp[[group4, drop = TRUE]])), 1),
ncol = ncol4, byrow = ifelse(arrange4 == "Row", TRUE, FALSE), force = TRUE
Expand Down
10 changes: 5 additions & 5 deletions R/SCP-cell_annotation.R
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ RunKNNPredict <- function(srt_query, srt_ref = NULL, bulk_ref = NULL,
features <- features_query
}
features_common <- intersect(features, rownames(bulk_ref))
message("Use ", length(features_common), " common features to calculate distance.")
message("Use ", length(features_common), " features to calculate distance.")
ref <- t(bulk_ref[features_common, , drop = FALSE])
} else if (!is.null(srt_ref)) {
ref_assay <- ref_assay %||% DefaultAssay(srt_ref)
Expand Down Expand Up @@ -262,7 +262,7 @@ RunKNNPredict <- function(srt_query, srt_ref = NULL, bulk_ref = NULL,
features <- intersect(features_ref, features_query)
}
features_common <- Reduce(intersect, list(features, rownames(srt_query[[query_assay]]), rownames(srt_ref[[ref_assay]])))
message("Use ", length(features_common), " common features to calculate distance.")
message("Use ", length(features_common), " features to calculate distance.")
if (isTRUE(ref_collapsing)) {
ref <- AverageExpression(object = srt_ref, features = features_common, slot = "data", assays = ref_assay, group.by = "ref_group", verbose = FALSE)[[1]]
ref <- t(log1p(ref))
Expand Down Expand Up @@ -339,10 +339,10 @@ RunKNNPredict <- function(srt_query, srt_ref = NULL, bulk_ref = NULL,
#

if (is.null(nn_method)) {
if (as.numeric(nrow(query)) * as.numeric(nrow(ref)) < 1e9) {
nn_method <- "raw"
} else {
if (as.numeric(nrow(query)) * as.numeric(nrow(ref)) >= 1e8) {
nn_method <- "annoy"
} else {
nn_method <- "raw"
}
}
message("Use '", nn_method, "' method to find neighbors.")
Expand Down
Loading
Loading