Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEURON compatible morphologies from ArrayMorphology. #151

Open
wants to merge 8 commits into
base: development
Choose a base branch
from

Conversation

christian-oreilly
Copy link

Allows to do something like

fname = 'Morphologies/pyr/MouseLight_Final/CNG version/AA0995.CNG.swc'
SWCLoader.load_swc_single(fname).to_neuroml_morphology("pyr_morph")   

and use successfully this morphology in NEURON simulations. Tested with https://neuromorpho.org/neuron_info.jsp?neuron_name=AA0995 . If you like it you can merge it; if you'd prefer not to merge right away, you can wait. I'll continue to use this code with other morphologies for a project of mine so I'll push fixes if this does not work with other morphologies.

I attached the generated morphology, for reference. The biophys is rubbish (they are the same as for the tutorial on the OLM cell), but the morphology seems reasonable to me.

pyr.cell.nml.zip

@sanjayankur31
Copy link
Contributor

Hi @christian-oreilly , thanks for that. Could you rebase that against the development branch please? The master branch is "stable, released code", so all new features/fixes go into development. We then merge development into master when we make a release.

The development branch has a number of new cell builder methods and so on which could perhaps make this easier for you too:

https://libneuroml.readthedocs.io/en/development/userdocs/coreclasses.html#cell

@sanjayankur31 sanjayankur31 self-assigned this Oct 17, 2022
@sanjayankur31 sanjayankur31 added T: enhancement Type: enhancement S: waiting for reporter Waiting for reporter to respond labels Oct 17, 2022
@sanjayankur31
Copy link
Contributor

@christian-oreilly
Copy link
Author

Very nice to know, @sanjayankur31. I am used to the master being the "development version" and releases being flagged as such, so I did not think of looking for a bleeding-edge branch. This is very good to know! I'll look at the development code and edit the PR accordingly.

@christian-oreilly christian-oreilly changed the base branch from master to development November 29, 2022 20:51
@christian-oreilly
Copy link
Author

@sanjayankur31 Sorry for taking so long to get around to do that but this PR is now rebased onto development.

@christian-oreilly
Copy link
Author

Well, @sanjayankur31, that is somewhat counterproductive guys (and a failure in communication) if you ask me to rebased this PR and the next day that I rebase, you put a runtime error to deprecate the method that this PR is relying on ( c2f829f ). Anyway, I'll just fork this converter out of libneuroml and provide it as a standalone if you are not interested in maintaining this as part of libneuroml as your doc https://docs.neuroml.org/Userdocs/ImportingMorphologyFiles.html do not point to any viable Python option for import SWC, as far as I can tell.

@sanjayankur31
Copy link
Contributor

sanjayankur31 commented Dec 7, 2022

Ah, sorry about that @christian-oreilly. I hadn't looked at this PR in a while and I missed that the code was being used here. I'll revert that change to mark it for deprecation in a future release.

This rather naive coverter is not really complete/tested. For example, it runs none of the checks listed in our documentation to ensure that the generated NeuroML file is viable for modelling. A user will need to do all of these checks themselves. A full SWC converter is being worked on here:

NeuroML/pyNeuroML#89

https://github.com/WardDPeeters/Morphologies

The plan is to include this in pyneuroml to create an interactive converter, hopefully in the new year.

Until then, the suggested method is to use neuroConstruct, which runs all the necessary checks already provides an interactive UI for the user to make tweaks where required. If your files are NEURON files, this is another pythonic way of doing it:

https://github.com/sanjayankur31/Human-L2-3-Cortical-Microcircuit/blob/feat/neuroml/NeuroML2/cellmorph2nml.py

@sanjayankur31 sanjayankur31 reopened this Dec 7, 2022
@sanjayankur31
Copy link
Contributor

Error softened to warning: f4415dc

@christian-oreilly
Copy link
Author

Thanks for the info, @sanjayankur31. It is much appreciated and useful. I'll look at these different options. Your conversion from NEURON seems interesting. Do you have anything going on about converting mod files? I started a while back to work on that (based on the work of others using the domain-specific language converter textx). At the time, I could not find anything public doing a satisfying job, but I'd be very interested to know if you are working on something for that under the radar. I don't want to lose time on that if there is a more "official" solution to that already being developped.

@sanjayankur31
Copy link
Contributor

There's no completely automated way to convert mod files that I'm aware of, primarily because they can contain equations and so on in them that need a human to go over and convert into a declarative form that NeuroML requires. We have helper tools though. They're noted here:

https://docs.neuroml.org/Userdocs/CreatingNeuroMLModels.html?highlight=chananalysis#b-convert-channels-to-neuroml

In short:

Then, a human must go over the mod file and fill in the rest. To help with this there are:

  • pynml-modchananlyis: generates info plots about the activation variables listed in the mod files
  • pynml-channelanalysis: generates info plots about the activation variables used in the NeuroML

So the idea is to complete the neuroml channel file iteratively until the plots from pynml-channelanalysis match the ones that pynml-modchananalysis.

I think neuroConstruct does have lots of these utilities built in too, but I haven't used it much so i can't be sure. (I find it easiest to find existing NeuroML channel files and tweak them. The ones in the L5bPyrCellHayetal repo tend to cover quite a few and there should be more on NeuroML-DB. channelpedia also provides NeuroMLv1 exports of channels, and these can be converted to NeuroML using the pynml-channelml2nml tool.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: waiting for reporter Waiting for reporter to respond T: enhancement Type: enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants