Skip to content

Commit

Permalink
Update utilities.R
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbates committed Dec 31, 2023
1 parent 881b4ed commit 7b1f481
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -614,11 +614,13 @@ update.neuronlistfh <- function(x = NULL,
x = nat::union(x, old.neurons)
message(length(x), " given neurons combined with ", length(old.neurons), " old neurons from extant: ", file)
}
}else{
x = nat::union(x, old.neurons)
}
}
}
}
if(nat::is.neuronlist(x)){
if(nat::is.neuronlist(x)&&length(x)){
if(dbClass=="DB1"){try(file.remove(data))}
if(!is.null(meta)){
if(!all(names(x)%in%rownames(meta))){
Expand Down Expand Up @@ -647,7 +649,9 @@ update.neuronlistfh <- function(x = NULL,
file.copy(from = file, to = temp.zip, overwrite = TRUE)
}
given.neurons = try(nat::write.neurons(x, dir = file, format='qs', include.data.frame = TRUE, Force = TRUE, ...), silent = FALSE)
if(inherits("try-class",given.neurons)){
oldfh = nat::neuronlistz(file)
good = try(nat::as.neuronlist(oldfh[[1]]),silent = FALSE)
if(inherits("try-class",given.neurons)||all(class(good)!="try-error")){
try(file.copy(to = file, from = temp.zip, overwrite = TRUE), silent = TRUE)
try(suppress(file.remove(temp.zip)), silent = TRUE)
warning("could not create neuronlistz object")
Expand Down

0 comments on commit 7b1f481

Please sign in to comment.