Skip to content

Commit

Permalink
Work around annoy index save function's inability to deal with path s…
Browse files Browse the repository at this point in the history
…trings that start with a tilde.
  • Loading branch information
brgew committed Nov 9, 2023
1 parent a72a61b commit 98471cc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: monocle3
Title: Clustering, Differential Expression, and Trajectory Analysis for
Single-Cell RNA-Seq
Version: 1.4.9
Version: 1.4.10
Authors@R: c(
person(given = "Hannah",
family = "Pliner",
Expand Down
18 changes: 18 additions & 0 deletions R/io.R
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,10 @@ save_transform_models <- function( cds, directory_path, comment="", verbose=TRUE
assertthat::assert_that(archive_control[['archive_compression']] %in% c('gzip', 'bzip2', 'xz', 'none'),
msg=paste0("archive_compression must be \'none\', \'gzip\', \'bzip2\', or \'xz\'."))

# Make a 'normalized' path string. The annoy index save function does not
# recognize tildes.
directory_path <- normalizePath(directory_path, mustWork=FALSE)

# file information is written to an RDS file
# in directory_path
# cds_object: reduce_dim_aux
Expand Down Expand Up @@ -1434,6 +1438,11 @@ copy_reduce_dim_aux <- function(cds_dst, cds_src) {
# is not run.
load_transform_models <- function(cds, directory_path) {
appendLF <- TRUE

# Make a 'normalized' path string. The annoy index save function does not
# recognize tildes.
directory_path <- normalizePath(directory_path, mustWork=FALSE)

# Check for directory.
if(!file.exists(directory_path))
stop('Directory \'', directory_path, '\' does not exist.')
Expand Down Expand Up @@ -1743,6 +1752,10 @@ save_monocle_objects <- function(cds, directory_path, hdf5_assays=FALSE, comment
assertthat::assert_that(archive_control[['archive_compression']] %in% c('gzip', 'bzip2', 'xz', 'none'),
msg=paste0("archive_compression must be \'none\', \'gzip\', \'bzip2\', or \'xz\'."))

# Make a 'normalized' path string. The annoy index save function does not
# recognize tildes.
directory_path <- normalizePath(directory_path, mustWork=FALSE)

# file information is written to an RDS file
# in directory_path
# cds_object: cds | reduce_dim_aux
Expand Down Expand Up @@ -2059,6 +2072,11 @@ save_monocle_objects <- function(cds, directory_path, hdf5_assays=FALSE, comment
# is not run.
load_monocle_objects <- function(directory_path, matrix_control=list(matrix_path='.')) {
appendLF <- FALSE

# Make a 'normalized' path string. The annoy index save function does not
# recognize tildes.
directory_path <- normalizePath(directory_path, mustWork=FALSE)

# Check for directory.
if(!file.exists(directory_path))
stop('Directory or file \'', directory_path, '\' does not exist.')
Expand Down

0 comments on commit 98471cc

Please sign in to comment.