natverse / fafbseg

Support functions for analysis of Drosophila connectomes especially the FAFB-FlyWire whole brain
https://natverse.org/fafbseg/
GNU General Public License v3.0
6 stars 4 forks source link

Error in fafb2flywire during xform_brain #32

Closed tatsuookubo closed 4 years ago

tatsuookubo commented 4 years ago

Thank you for developing tools for analyzing FlyWire data in the natverse environment!

I got the following warning when transforming a FlyWire skeleton from 'FlyWire' to 'JFRC2' template. neuron_JFRC2 <- xform_brain(neuron_fw, sample = 'FlyWire', reference = 'JFRC2')

Transforming neurons using the sequence: FlyWire->FAFB14->JFRC2013->JFRC2 Warning message: In mapmany(xyzraw, baseurl = baseurl, ...) : Internal Server Error (HTTP 500).

While neuron_JFRC2 is created, summary(neuron_JFRC2) shows that the cable.length is 0, and plot3d(neuron_JFRC2)does not show anything.

jefferis commented 4 years ago

Thanks @tatsuookubo. Are you using the very latest version of the fafbseg package? The remote service providing the transform has been changed.

tatsuookubo commented 4 years ago

Thank you @jefferis for the advice. I've tried natmanager::install(pkgs="fafbseg") to update the package and 'sessionInfo()' tells me that I'm using fafbseg_0.7.0 and I'm still having the same issue.

jefferis commented 4 years ago

Can you just confirm the GitHub sha1 as reported by devtools::session_info()?

tatsuookubo commented 4 years ago

devtools::session_info() says fafbseg * 0.7.0 2020-09-08 [1] Github (natverse/fafbseg@dec810b)

jefferis commented 4 years ago

@tatsuookubo can you

  1. try the examples for fafb2flywire
    # identified location in FAFB14
    p.fafb.nm <- cbind(477042, 284535, 90680)
    p.fafb.raw <- p.fafb.nm/c(4,4,40)
    # corresponding location in FlyWire
    p.flywire.raw <- cbind(118865, 71338, 2267)
    p.flywire.nm <- p.flywire.raw * c(4,4,40)
    flywire2fafb(p.flywire.nm)-p.fafb.nm
  2. share the neuron_fw in some way. I think there is something about your specific input that is causing trouble because I cannot replicate the issue. It may be that there is e.g. a problem handling bad points on the new service run by @perlman.
tatsuookubo commented 4 years ago

The given examples worked nicely both ways (fafb2flywire and flywire2fafb).

Here is a minimal reproducible example in my environment (Ubuntu 20.04, R 4.0.2).

library(natverse)
library(fafbseg)
library(reticulate)

segid <- "720575940633169983" # FlyWire segment ID
choose_segmentation(release = 'flywire31')
path_swc <- meshparty_skeletonize(segid, savedir = "/home/tatsuo/R/connectomics/swc_files")
neuron_fw <- read.neurons(path_swc)
neuron_JFRC2 <- xform_brain(neuron_fw, sample = "FlyWire", reference = "JFRC2")
perlman commented 4 years ago

Yes, this looks like a problem with the transformation service. The error is percolating up from the code inherited from CloudVolumeServer to parallelize the query.

It would be very helpful to get a small snippet triggering the error (e.g., try splitting the neuron into small pieces and try each of them?)

jefferis commented 4 years ago

I think the problem is that meshparty_skeletonize returns neurons in µm not nm. You can do this:

neuron_JFRC2 <- xform_brain(neuron_fw*1e3, sample = "FlyWire", reference = "JFRC2")

and things should work. It would be nice if we could get better error messages and more transparent support for units.

tatsuookubo commented 4 years ago

Yes, this fix worked! Thank you very much @jefferis for the advice, and @perlman for working on the transform!