Skip to content

Commit

Permalink
fix bug in sapply for neuronlistz
Browse files Browse the repository at this point in the history
* had forgotten as.list method which existed for neuronlistfh
* with test
  • Loading branch information
jefferis committed Apr 16, 2021
1 parent dda1185 commit 5e77890
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Expand Up @@ -38,6 +38,7 @@ S3method(as.hxsurf,mesh3d)
S3method(as.im3d,im3d)
S3method(as.im3d,matrix)
S3method(as.list,neuronlistfh)
S3method(as.list,neuronlistz)
S3method(as.mesh3d,ashape3d)
S3method(as.mesh3d,boundingbox)
S3method(as.mesh3d,hxsurf)
Expand Down
4 changes: 4 additions & 0 deletions R/neuronlistz.R
Expand Up @@ -114,3 +114,7 @@ read_from_zip <- function(zipfile, p, multi=FALSE, neuron=TRUE) {
new=as.neuronlist(l, df=attr(x, 'df')[ichecked, , drop=FALSE])
copy_nl_attributes(new, x, ignoremore=c("keyfilemap", "db"))
}

# this is needed to make lapply behave properly
#' @export
as.list.neuronlistz<-function(x, ...) x
2 changes: 2 additions & 0 deletions tests/testthat/test-neuronlistz.R
Expand Up @@ -12,6 +12,8 @@ test_that("neuronlistz works", {
nz <- neuronlistz(tf2)
expect_equal(nz[1:5], Cell07PNs[1:5])

expect_equal(nvertices(nz), nvertices(Cell07PNs[1:5]))

nz2 <- neuronlistz(tf2, patt = "EBH.*")
expect_equal(rownames(nz2[,]), c("EBH11R", "EBH20L", "EBH20R"))
expect_equal(nz2[[1]], nz2["EBH11R"][[1]])
Expand Down

0 comments on commit 5e77890

Please sign in to comment.