AllenInstitute / AllenSDK

code for reading and processing Allen Institute for Brain Science data
https://allensdk.readthedocs.io/en/latest/
Other
349 stars 151 forks source link

[Nobug] Axon modification when reading .swc morphology #1683

Open brenthuisman opened 4 years ago

brenthuisman commented 4 years ago

We're trying to reproduce some results made with AllenSDK-Neuron in Arbor. What seems to be the biggest source of deviation is the way AllenSDK modifies the axon. For instance, in allensdk/model/biophysical/utils.py AllActiveUtils.generate_morphology() we can see there seem to be two modes: 1. truncation and 2. substitution with a stub. No keeping the morphology as-is in the file. Why is this?

Secondly, is the truncation really a truncation? On l364-370 we have:

        axon_diams = [self.h.axon[0].diam, self.h.axon[0].diam]
        self.h.distance(sec=self.h.soma[0])
        for sec in self.h.allsec():
            if sec.name()[:4] == "axon":
                if self.h.distance(0.5, sec=sec) > 60:
                    axon_diams[1] = sec.diam
                    break

This looks like it is actually substitution with a cone, where the two diameters are the first and last encountered in the morphology file. Do I understand this correctly?

Thanks for any insight!

Environment:

tmchartrand commented 4 years ago

@brenthuisman this issue is discussed in the documentation (http://help.brain-map.org/display/celltypes/Documentation) - in short the decision was in the interest of consistency of models across the dataset -- many cells have little to no axon reconstructed, so if axons were included the variability of reconstructions would cause variability in model parameters and behavior. You're right that the truncation, strictly speaking, is followed by approximation as a conical frustum - but the diameters are the first and the closest to 60 um (the length of the stub), not the last encountered. In the future, conceptual questions like this may get answered faster (and benefit other users more) on our community forum, https://community.brain-map.org/.

brenthuisman commented 4 years ago

Thanks for your reply and explanation. I must say this information was quite well hidden ;) For my own reference, the documentation you refer to must be "Neuronal Models: Biophysical - All Active" > Model configuration > Morphology > IAS paragraph.

I see now how what you're saying here is what's happening. I would say the documentation underspecifies the problem a bit though: it does not say which two diameters are chosen. Should this be made more clear?

tmchartrand commented 4 years ago

Ah, I should have clarified which set of models you were working with. The perisomatic models are intended to be used with the stub, which is clearly specified in the Perisomatic documentation and the accompanying publication (https://www.nature.com/articles/s41467-017-02718-3). The set of All Active models on the website are intended to be used with the 'truncation' format and could certainly be more clearly specified. However, the correct option is selected by default when running through AllenSDK, and those models were released as a work in progress, not a final result, so further support is unlikely. We do have an updated set of All active models accompanied by a manuscript in progress (https://www.biorxiv.org/content/10.1101/2020.04.09.030239v1.full). These models are not fully released on brain-map.org but available at https://github.com/AllenInstitute/All-active-Manuscript (incidentally, they return to the stub axon format).

I should also clarify that the limited simulator capabilities in AllenSDK are really only intended as an executable reproduction of the model characterizations released on the web, not so much an option for running more general single-cell simulations with variations on the models. A bit more thought around translating these subtleties of models across simulations and across simulator platforms can be found in our simulator BMTK (https://github.com/AllenInstitute/bmtk) and the SONATA data format, a collaboration with the BlueBrain Project (https://github.com/AllenInstitute/sonata).