diff --git a/R/utilities.R b/R/utilities.R index f6d97a0d..5081f910 100644 --- a/R/utilities.R +++ b/R/utilities.R @@ -252,6 +252,7 @@ save_compressed_nblast_mat <- function(x, threshold=-0.5, digits=3, format=c("rda", "rds"), + remove = NULL, ...) { format=match.arg(format) overwrite=match.arg(overwrite) @@ -265,29 +266,37 @@ save_compressed_nblast_mat <- function(x, }else if(overwrite=="combine"){ combine = TRUE if(format=="rds"){ - old = readRDS(fname) + old = tryCatch(readRDS(fname), function(e) NULL) }else{ - old = load_assign(fname) + old = tryCatch(load_assign(fname), function(e) NULL) } } } + if(is.null(old)){ + warning("No extant NBLAST at ", fname) + } colnames(x) = gsub("_m$","",colnames(x)) # factor in mirrored hemibrain neurons rownames(x) = gsub("_m$","",rownames(x)) x = apply(x, 2, function(i) tapply(i, rownames(x), sum, na.rm = TRUE)) x = t(apply(t(x), 2, function(i) tapply(i, colnames(x), sum, na.rm = TRUE))) x[x