Skip to content

Commit 6c31463

Browse files
authored
Merge pull request #177 from cole-trapnell-lab/develop
Pull for v0.1.3
2 parents e212173 + 30b5bf7 commit 6c31463

22 files changed

+616
-95
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ inst/doc
33
.Rhistory
44
.RData
55
.Ruserdata
6+
.DS_store

.travis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ language: r
55
before_install:
66
- sudo apt-get install -y libudunits2-dev
77
- sudo apt-get install -y gdal-bin
8+
- sudo apt-get install -y libgdal1-dev
89
r:
910
- bioc-devel
1011
- bioc-release
@@ -44,6 +45,12 @@ r_binary_packages:
4445
- tibble
4546
- tidyr
4647
- viridis
48+
49+
script:
50+
- |
51+
R CMD build .
52+
travis_wait 20 R CMD check monocle3*tar.gz
53+
4754
after_success:
4855
- Rscript -e 'covr::codecov()'
4956
notifications:

DESCRIPTION

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: monocle3
22
Title: Clustering, differential expression, and trajectory analysis for single-
33
cell RNA-Seq
4-
Version: 0.1.2
4+
Version: 0.1.3
55
Authors@R:
66
person(given = "Hannah",
77
family = "Pliner",
@@ -65,6 +65,7 @@ Imports:
6565
RcppParallel,
6666
reshape2 (>= 1.4.3),
6767
reticulate (>= 1.11.1),
68+
rsample (>= 0.0.5),
6869
RhpcBLASctl,
6970
Rtsne (>= 0.15),
7071
S4Vectors,
@@ -86,3 +87,5 @@ Suggests:
8687
spelling
8788
VignetteBuilder: knitr
8889
Language: en-US
90+
Remotes:
91+
VPetukhov/ggrastr

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export("principal_graph_aux<-")
77
export(aggregate_gene_expression)
88
export(choose_cells)
99
export(choose_graph_segments)
10+
export(clear_cds_slots)
1011
export(cluster_cells)
1112
export(clusters)
1213
export(coefficient_table)

NEWS.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# monocle3 0.1.3
2+
3+
### Changes
4+
* Added bootstrap bars to plot_percent_cells_positive().
5+
* Added a UMI cutoff for load_cellranger_data().
6+
* Added clear_cds_slots() to clear slots from a cds.
7+
* Added cell_stroke parameter to plot_cells.
8+
9+
### Bug fixes
10+
* Fixed #154, which actually resulted from a problem in how ncenter was calculated for each partition.
11+
* Fixed an issue that prevents plotting cells by pseudotime when root_cells are passed to order_cells().
12+
* Fixed #167 - NAs from plot_genes_by_group.
13+
114
# monocle3 0.1.2
215

316
### Changes

R/graph_test.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ graph_test <- function(cds,
7575

7676
test_res <- tryCatch({
7777
if(method == "Moran_I") {
78-
mt <- my.moran.test(exprs_val, lw, wc, alternative = alternative)
78+
mt <- suppressWarnings(my.moran.test(exprs_val, lw, wc, alternative = alternative))
7979
data.frame(status = 'OK', p_value = mt$p.value,
8080
morans_test_statistic = mt$statistic,
8181
morans_I = mt$estimate[["Moran I statistic"]])
8282
} else if(method == 'Geary_C') {
83-
gt <- my.geary.test(exprs_val, lw, wc, alternative = alternative)
83+
gt <- suppressWarnings(my.geary.test(exprs_val, lw, wc, alternative = alternative))
8484
data.frame(status = 'OK', p_value = gt$p.value,
8585
geary_test_statistic = gt$statistic,
8686
geary_C = gt$estimate[["Geary C statistic"]])

R/learn_graph.R

+7-7
Original file line numberDiff line numberDiff line change
@@ -226,27 +226,27 @@ multi_component_RGE <- function(cds,
226226
num_clusters_in_partition <-
227227
length(unique(clusters(cds)[colnames(X_subset)]))
228228
num_cells_in_partition = ncol(X_subset)
229-
ncenter <- cal_ncenter(num_clusters_in_partition, num_cells_in_partition)
230-
if(is.null(ncenter) || ncenter >= ncol(X_subset)) {
231-
ncenter <- ncol(X_subset) - 1
229+
curr_ncenter <- cal_ncenter(num_clusters_in_partition, num_cells_in_partition)
230+
if(is.null(curr_ncenter) || curr_ncenter >= ncol(X_subset)) {
231+
curr_ncenter <- ncol(X_subset) - 1
232232
}
233233
} else {
234-
ncenter <- min(ncol(X_subset) - 1, ncenter)
234+
curr_ncenter <- min(ncol(X_subset) - 1, ncenter)
235235
}
236236
if (verbose)
237-
message(paste("Using", ncenter, "nodes for principal graph"))
237+
message(paste("Using", curr_ncenter, "nodes for principal graph"))
238238

239239
kmean_res <- NULL
240240

241-
centers <- t(X_subset)[seq(1, ncol(X_subset), length.out=ncenter), ,
241+
centers <- t(X_subset)[seq(1, ncol(X_subset), length.out=curr_ncenter), ,
242242
drop = F]
243243
centers <- centers + matrix(stats::rnorm(length(centers), sd = 1e-10),
244244
nrow = nrow(centers)) # add random noise
245245

246246
kmean_res <- tryCatch({
247247
stats::kmeans(t(X_subset), centers=centers, iter.max = 100)
248248
}, error = function(err) {
249-
stats::kmeans(t(X_subset), centers = ncenter, iter.max = 100)
249+
stats::kmeans(t(X_subset), centers = curr_ncenter, iter.max = 100)
250250
})
251251

252252
if (kmean_res$ifault != 0){

R/load_cellranger_data.R

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ get_genome_in_matrix_path <- function(matrix_path, genome=NULL) {
3333
#' @param pipestance_path Path to the output directory produced by Cell Ranger
3434
#' @param genome The desired genome (e.g., 'hg19' or 'mm10')
3535
#' @param barcode_filtered Load only the cell-containing barcodes
36+
#' @param umi_cutoff Numeric, desired cutoff to include a cell. Default is 100.
3637
#' @return a new cell_data_set object
3738
#' @export
3839
#' @examples
@@ -41,7 +42,7 @@ get_genome_in_matrix_path <- function(matrix_path, genome=NULL) {
4142
#' gene_bc_matrix <- load_cellranger_data("/home/user/cellranger_output")
4243
#' }
4344
load_cellranger_data <- function(pipestance_path=NULL, genome=NULL,
44-
barcode_filtered=TRUE) {
45+
barcode_filtered=TRUE, umi_cutoff = 100) {
4546
# check for correct directory structure
4647
if (!dir.exists(pipestance_path))
4748
stop("Could not find the pipestance path: '", pipestance_path,"'.
@@ -132,8 +133,11 @@ load_cellranger_data <- function(pipestance_path=NULL, genome=NULL,
132133
barcodes$V1 = make.unique(barcodes$V1)
133134
colnames(data) = barcodes[,1]
134135
pd = data.frame(barcode=barcodes[,1], row.names=barcodes[,1])
136+
data <- data[,Matrix::colSums(data) > umi_cutoff]
137+
pd <- pd[colnames(data),, drop=FALSE]
135138
gbm <- new_cell_data_set(data,
136139
cell_metadata = pd,
137140
gene_metadata = feature.names)
141+
138142
return(gbm)
139143
}

R/order_cells.R

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ order_cells <- function(cds,
9393
} else if(!is.null(root_cells)){
9494
closest_vertex <- cds@principal_graph_aux[[
9595
reduction_method]]$pr_graph_cell_proj_closest_vertex
96-
root_pr_nodes <- paste("Y_", closest_vertex[root_cells,], sep="")
96+
root_pr_nodes <- unique(paste("Y_", closest_vertex[root_cells,], sep=""))
97+
#principal_graph(cds)[[reduction_method]]
9798
}
9899

99100
cds@principal_graph_aux[[reduction_method]]$root_pr_nodes <- root_pr_nodes

0 commit comments

Comments
 (0)