Skip to content

Commit ad2ade6

Browse files
authored
Add files via upload
1 parent 588cfb6 commit ad2ade6

30 files changed

+443
-588
lines changed

DESCRIPTION

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
Package: RISC
22
Type: Package
33
Title: Robust Integration of Single-Cell RNA-Seq Datasets
4-
Version: 1.6.0
5-
Date: 2022-11-11
4+
Version: 1.7
5+
Date: 2022-1-10
6+
Update: 2024-3-15
67
Authors@R: c(person("Yang", "Liu", role = c("aut", "cre"),
78
email = "[email protected]"),
89
person("Deyou", "Zheng", role = "aut"),
@@ -12,19 +13,19 @@ Description: The 'RISC' package can integrate single cell RNA sequencing data, c
1213
URL: https://www.biorxiv.org/content/10.1101/483297v1.article-info
1314
https://github.com/yangRISC/RISC
1415
Depends: R (>= 4.0.0)
15-
Imports: Rcpp, Matrix, sparseMatrixStats, MASS, Matrix.utils, pbapply,
16+
Imports: Rcpp, Matrix, sparseMatrixStats, MASS, pbapply, hdf5r,
1617
doParallel, foreach, irlba, Rtsne, umap, densityClust, FNN,
17-
igraph, RColorBrewer, ggplot2, gridExtra, pheatmap, hdf5r,
18-
methods, grDevices, stats, utils
18+
igraph, RColorBrewer, ggplot2, gridExtra, pheatmap, methods,
19+
grDevices, stats, utils
1920
LinkingTo: Rcpp, RcppArmadillo
2021
LazyData: true
2122
Encoding: UTF-8
22-
RoxygenNote: 7.2.2
23+
RoxygenNote: 7.3.1
2324
Suggests: testthat, usethis, knitr, rmarkdown
2425
VignetteBuilder: knitr
2526
NeedsCompilation: yes
2627
License: GPL-3 | file LICENSE
27-
Packaged: 2022-11-13 23:17:37 UTC; liuy128
28+
Packaged: 2024-03-18 13:34:09 UTC; liuy128
2829
Author: Yang Liu [aut, cre],
2930
Deyou Zheng [aut],
3031
Tao Wang [aut]

NAMESPACE

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ importFrom(Matrix,rowMeans)
3535
importFrom(Matrix,rowSums)
3636
importFrom(Matrix,spMatrix)
3737
importFrom(Matrix,sparseMatrix)
38-
importFrom(Matrix.utils,aggregate.Matrix)
3938
importFrom(Rcpp,evalCpp)
4039
importFrom(Rtsne,Rtsne)
4140
importFrom(densityClust,densityClust)
@@ -47,6 +46,8 @@ importFrom(grDevices,col2rgb)
4746
importFrom(grDevices,colorRampPalette)
4847
importFrom(gridExtra,grid.arrange)
4948
importFrom(hdf5r,H5File)
49+
importFrom(igraph,"E<-")
50+
importFrom(igraph,E)
5051
importFrom(igraph,cluster_louvain)
5152
importFrom(igraph,graph_from_data_frame)
5253
importFrom(igraph,simplify)
@@ -67,6 +68,7 @@ importFrom(stats,embed)
6768
importFrom(stats,gaussian)
6869
importFrom(stats,glm)
6970
importFrom(stats,ks.test)
71+
importFrom(stats,loess)
7072
importFrom(stats,loess.smooth)
7173
importFrom(stats,median)
7274
importFrom(stats,model.matrix)

R/Cluster.R

+7-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#' "kd_tree", "cover_tree", "CR", "brute".
2222
#' @param npc The number of PCA or PLS used for cell clustering.
2323
#' @param k The number of cluster searched for, works in "density" method.
24+
#' @param res The resolution of cluster searched for, works in "louvain" method.
2425
#' @param dc The distance used to generate random center points which affect
2526
#' clusters. If have no idea about this, do not input anything. Keep it as the
2627
#' default value for most users. Work for "density" method.
@@ -30,7 +31,7 @@
3031
#' @name scCluster
3132
#' @importFrom densityClust densityClust findClusters
3233
#' @importFrom FNN get.knn
33-
#' @importFrom igraph simplify graph_from_data_frame cluster_louvain
34+
#' @importFrom igraph simplify graph_from_data_frame cluster_louvain E E<-
3435
#' @references Blondel et al., JSTAT (2008)
3536
#' @references Rodriguez et al., Sicence (2014)
3637
#' @export
@@ -44,19 +45,21 @@
4445

4546
scCluster <- function(
4647
object,
47-
slot = "cell.umap",
48+
slot = "cell.pca",
4849
neighbor = 10,
4950
algorithm = "kd_tree",
5051
method = 'louvain',
5152
npc = 20,
5253
k = 10,
54+
res = 0.5,
5355
dc = NULL,
5456
redo = TRUE,
5557
random.seed = 123
5658
) {
5759

5860
set.seed(random.seed)
5961
k = as.integer(k)
62+
res = as.numeric(res)
6063
neighbor = as.integer(neighbor)
6164
algorithm = as.character(algorithm)
6265
npc = as.integer(npc)
@@ -112,8 +115,9 @@ scCluster <- function(
112115
clust0 = get.knn(count, k = neighbor, algorithm = algorithm)
113116
clust1 = data.frame(NodStar = rep(1L:nrow(count), neighbor), NodEnd = as.vector(clust0$nn.index), stringsAsFactors = FALSE)
114117
clust1 = graph_from_data_frame(clust1, directed = FALSE)
118+
E(clust1)$weight = 1/(1 + as.vector(clust0$nn.dist))
115119
clust1 = simplify(clust1)
116-
clust1 = cluster_louvain(clust1, weights = 1/(1 + as.vector(clust0$nn.dist)))
120+
clust1 = cluster_louvain(clust1, resolution = res)
117121
object@cluster = object@coldata$Cluster = as.factor(clust1$membership)
118122
names(object@cluster) = names(object@coldata$Cluster) = rownames(count)
119123
object@metadata[['clustering']] = data.frame(Method = 'louvain', PCs = npc, Neighbors = neighbor, stringsAsFactors = F)

0 commit comments

Comments
 (0)