From 8cee5dc3843676485d58561abe0fff6dd4a035a5 Mon Sep 17 00:00:00 2001 From: YBCS Date: Sun, 24 Mar 2024 16:59:43 +0530 Subject: [PATCH 1/4] add -swc in pynml --- pyneuroml/pynml.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pyneuroml/pynml.py b/pyneuroml/pynml.py index 97e7b9ee..0f364fa0 100644 --- a/pyneuroml/pynml.py +++ b/pyneuroml/pynml.py @@ -26,6 +26,7 @@ import lems.model.model as lems_model from pyneuroml import DEFAULTS, JNEUROML_VERSION, __version__ from pyneuroml.errors import ARGUMENT_ERR, UNKNOWN_ERR +from pyneuroml.swc.ExportSWC import convert_to_swc from pyneuroml.utils import extract_lems_definition_files # these imports are included for backwards compatibility @@ -415,6 +416,11 @@ def _parse_arguments(): action="store_true", help=("Validate SEDML file(s)"), ) + mut_exc_opts.add_argument( + "-swc", + action="store_true", + help=("Load a NeuroML file, and convert it to swc format\n"), + ) return parser.parse_args() @@ -852,6 +858,13 @@ def _evaluate_arguments(args): exit_on_fail = True run_multi = True + elif args.swc: + for f in args.input_files: + logger.info(f"converting {f} to swc format...") + convert_to_swc(f) + logger.info(f"Done converting {len(args.input_files)} files to swc format") + sys.exit(0) + if run_multi is False: run_jneuroml( pre_args, From ecf31135be504e3925491a62595f2dc67390ca35 Mon Sep 17 00:00:00 2001 From: YBCS Date: Wed, 27 Mar 2024 09:38:59 +0530 Subject: [PATCH 2/4] adress comments --- common.h2m | 16 +++ pyneuroml/pynml.py | 10 +- pyneuroml/swc/ExportSWC.py | 7 +- pynml-archive.1 | 48 ++++++++ pynml-channelanalysis.1 | 113 ++++++++++++++++++ pynml-channelml2nml.1 | 44 +++++++ pynml-modchananalysis.1 | 75 ++++++++++++ pynml-plotchan.1 | 44 +++++++ pynml-plotmorph.1 | 74 ++++++++++++ pynml-plotspikes.1 | 63 ++++++++++ pynml-plottimeseries.1 | 44 +++++++ pynml-povray.1 | 115 +++++++++++++++++++ pynml-sonata.1 | 53 +++++++++ pynml-summary.1 | 38 +++++++ pynml-tune.1 | 151 ++++++++++++++++++++++++ pynml.1 | 227 +++++++++++++++++++++++++++++++++++++ test-ghactions.sh | 1 + version.h2m | 3 + 18 files changed, 1121 insertions(+), 5 deletions(-) create mode 100644 common.h2m create mode 100644 pynml-archive.1 create mode 100644 pynml-channelanalysis.1 create mode 100644 pynml-channelml2nml.1 create mode 100644 pynml-modchananalysis.1 create mode 100644 pynml-plotchan.1 create mode 100644 pynml-plotmorph.1 create mode 100644 pynml-plotspikes.1 create mode 100644 pynml-plottimeseries.1 create mode 100644 pynml-povray.1 create mode 100644 pynml-sonata.1 create mode 100644 pynml-summary.1 create mode 100644 pynml-tune.1 create mode 100644 pynml.1 create mode 100644 version.h2m diff --git a/common.h2m b/common.h2m new file mode 100644 index 00000000..6357fd94 --- /dev/null +++ b/common.h2m @@ -0,0 +1,16 @@ +[see-also] +.BR pynml (1), +.BR pynml-archive (1), +.BR pynml-channelanalysis (1), +.BR pynml-channelml2nml (1), +.BR pynml-modchananalysis (1), +.BR pynml-plotchan (1), +.BR pynml-plotmorph (1), +.BR pynml-plotspikes (1), +.BR pynml-plottimeseries (1), +.BR pynml-povray (1), +.BR pynml-sonata (1), +.BR pynml-summary (1), +.BR pynml-tune (1), +.PP +Please see https://docs.neuroml.org for complete documentation on the NeuroML standard and the software ecosystem. diff --git a/pyneuroml/pynml.py b/pyneuroml/pynml.py index 0f364fa0..98532af2 100644 --- a/pyneuroml/pynml.py +++ b/pyneuroml/pynml.py @@ -419,7 +419,7 @@ def _parse_arguments(): mut_exc_opts.add_argument( "-swc", action="store_true", - help=("Load a NeuroML file, and convert it to swc format\n"), + help=("Load NeuroML file(s), and convert it to swc format\n"), ) return parser.parse_args() @@ -859,10 +859,12 @@ def _evaluate_arguments(args): run_multi = True elif args.swc: + convert_count = 0 for f in args.input_files: - logger.info(f"converting {f} to swc format...") - convert_to_swc(f) - logger.info(f"Done converting {len(args.input_files)} files to swc format") + confirm_neuroml_file(f) + logger.info(f"trying to convert {f} to swc format ?") + convert_count += 1 if convert_to_swc(f) else 0 + logger.info(f"Converted {convert_count} file(s) to swc format") sys.exit(0) if run_multi is False: diff --git a/pyneuroml/swc/ExportSWC.py b/pyneuroml/swc/ExportSWC.py index 8750750a..495fe1d3 100644 --- a/pyneuroml/swc/ExportSWC.py +++ b/pyneuroml/swc/ExportSWC.py @@ -124,6 +124,9 @@ def convert_to_swc(nml_file_name, add_comments=False, target_dir=None): lines = [] comment_lines = [] + if not nml_doc.cells: + return False + for cell in nml_doc.cells: swc_file_name = "%s/%s.swc" % (target_dir, cell.id) swc_file = open(swc_file_name, "w") @@ -183,13 +186,15 @@ def convert_to_swc(nml_file_name, add_comments=False, target_dir=None): for i in range(len(lines)): line = lines[i] swc_line = "%s" % (line) - print(swc_line) + logger.debug(swc_line) swc_file.write("%s\n" % swc_line) swc_file.close() print("Written to %s" % swc_file_name) + return True + if __name__ == "__main__": if len(sys.argv) == 1: diff --git a/pynml-archive.1 b/pynml-archive.1 new file mode 100644 index 00000000..f90940b5 --- /dev/null +++ b/pynml-archive.1 @@ -0,0 +1,48 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1. +.TH PYNML-ARCHIVE "1" "March 2024" "pynml-archive v1.2.8" "User Commands" +.SH NAME +pynml-archive \- manual page for pynml-archive v1.2.8 +.SH DESCRIPTION +usage: pynml\-archive [\-h] [\-zipfileName ] +.TP +[\-zipfileExtension ] +[\-filelist [ ...]] + +.PP +A script to create a COMBINE archive +.SS "positional arguments:" +.TP + +Name of the NeuroML 2/LEMS main file +.SS "options:" +.TP +\fB\-h\fR, \fB\-\-help\fR +show this help message and exit +.TP +\fB\-zipfileName\fR +Extension to use for archive. +.TP +\fB\-zipfileExtension\fR +Extension to use for archive. +.TP +\fB\-filelist\fR [ ...] +Explicit list of files to create archive of. +.SH "SEE-ALSO" +.BR pynml (1), +.BR pynml-archive (1), +.BR pynml-channelanalysis (1), +.BR pynml-channelml2nml (1), +.BR pynml-modchananalysis (1), +.BR pynml-plotchan (1), +.BR pynml-plotmorph (1), +.BR pynml-plotspikes (1), +.BR pynml-plottimeseries (1), +.BR pynml-povray (1), +.BR pynml-sonata (1), +.BR pynml-summary (1), +.BR pynml-tune (1), +.PP +Please see https://docs.neuroml.org for complete documentation on the NeuroML standard and the software ecosystem. +.SH ENVIRONMENT +.PP +pyNeuroML v1.2.8 (libNeuroML v0.5.8, jNeuroML v0.13.0) diff --git a/pynml-channelanalysis.1 b/pynml-channelanalysis.1 new file mode 100644 index 00000000..1a2d3f34 --- /dev/null +++ b/pynml-channelanalysis.1 @@ -0,0 +1,113 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1. +.TH PYNML-CHANNELANALYSIS "1" "March 2024" "pynml-channelanalysis v1.2.8" "User Commands" +.SH NAME +pynml-channelanalysis \- manual page for pynml-channelanalysis v1.2.8 +.SH DESCRIPTION +usage: pynml\-channelanalysis [\-h] [\-v] [\-minV ] [\-maxV ] +.TP +[\-temperature ] +[\-duration ] +[\-clampDelay ] +[\-clampDuration ] +[\-clampBaseVoltage ] +[\-stepTargetVoltage ] +[\-erev ] +[\-scaleDt ] +[\-caConc ] +[\-datSuffix ] [\-norun] [\-nogui] +[\-html] [\-md] [\-ivCurve] + +[ ...] +.PP +A script which can be run to generate a LEMS file to analyse the behaviour of +channels in NeuroML 2 +.SS "positional arguments:" +.TP + +Name of the NeuroML 2 file(s) +.SS "options:" +.TP +\fB\-h\fR, \fB\-\-help\fR +show this help message and exit +.TP +\fB\-v\fR +Verbose output +.TP +\fB\-minV\fR +Minimum voltage to test (integer, mV), default: \fB\-100mV\fR +.TP +\fB\-maxV\fR +Maximum voltage to test (integer, mV), default: 100mV +.TP +\fB\-temperature\fR +Temperature (float, celsius), default: 6.3degC +.TP +\fB\-duration\fR +Duration of simulation in ms, default: 100ms +.TP +\fB\-clampDelay\fR +Delay before voltage clamp is activated in ms, +default: 10ms +.TP +\fB\-clampDuration\fR +Duration of voltage clamp in ms, default: 80ms +.TP +\fB\-clampBaseVoltage\fR +Clamp base (starting/finishing) voltage in mV, +default: \fB\-70mV\fR +.TP +\fB\-stepTargetVoltage\fR +Voltage in mV through which to step voltage clamps, +default: 20mV +.TP +\fB\-erev\fR +Reversal potential of channel for currents, default: +0mV +.TP +\fB\-scaleDt\fR +Scale dt in generated LEMS, default: 1 +.TP +\fB\-caConc\fR +Internal concentration of Ca2+ (float, concentration +in mM), default: 5e\-05mM +.TP +\fB\-datSuffix\fR +String to add to dat file names (before .dat) +.TP +\fB\-norun\fR +If used, just generate the LEMS file, don't run it +.TP +\fB\-nogui\fR +Supress plotting of variables and only save data to +file +.TP +\fB\-html\fR +Generate a HTML page featuring the plots for the +channel +.TP +\fB\-md\fR +Generate a (GitHub flavoured) Markdown page featuring +the plots for the channel +.TP +\fB\-ivCurve\fR +Save currents through voltage clamp at each level & +plot current vs voltage for ion channel +.SH "SEE-ALSO" +.BR pynml (1), +.BR pynml-archive (1), +.BR pynml-channelanalysis (1), +.BR pynml-channelml2nml (1), +.BR pynml-modchananalysis (1), +.BR pynml-plotchan (1), +.BR pynml-plotmorph (1), +.BR pynml-plotspikes (1), +.BR pynml-plottimeseries (1), +.BR pynml-povray (1), +.BR pynml-sonata (1), +.BR pynml-summary (1), +.BR pynml-tune (1), +.PP +Please see https://docs.neuroml.org for complete documentation on the NeuroML standard and the software ecosystem. +.SH ENVIRONMENT +.PP +pyNeuroML v1.2.8 (libNeuroML v0.5.8, jNeuroML v0.13.0) diff --git a/pynml-channelml2nml.1 b/pynml-channelml2nml.1 new file mode 100644 index 00000000..2fcc2b1f --- /dev/null +++ b/pynml-channelml2nml.1 @@ -0,0 +1,44 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1. +.TH PYNML-CHANNELML2NML "1" "March 2024" "pynml-channelml2nml v1.2.8" "User Commands" +.SH NAME +pynml-channelml2nml \- manual page for pynml-channelml2nml v1.2.8 +.SH DESCRIPTION +usage: pynml\-channelml2nml [\-h] [\-xsltfile ] +.TP +[\-saveToFile ] + +.PP +A script to convert ChannelML files to NeuroML2 +.SS "positional arguments:" +.TP + +Path of the ChannelML file +.SS "options:" +.TP +\fB\-h\fR, \fB\-\-help\fR +show this help message and exit +.TP +\fB\-xsltfile\fR +Path to the XSLT file +.TP +\fB\-saveToFile\fR +Name of the outputfile file +.SH "SEE-ALSO" +.BR pynml (1), +.BR pynml-archive (1), +.BR pynml-channelanalysis (1), +.BR pynml-channelml2nml (1), +.BR pynml-modchananalysis (1), +.BR pynml-plotchan (1), +.BR pynml-plotmorph (1), +.BR pynml-plotspikes (1), +.BR pynml-plottimeseries (1), +.BR pynml-povray (1), +.BR pynml-sonata (1), +.BR pynml-summary (1), +.BR pynml-tune (1), +.PP +Please see https://docs.neuroml.org for complete documentation on the NeuroML standard and the software ecosystem. +.SH ENVIRONMENT +.PP +pyNeuroML v1.2.8 (libNeuroML v0.5.8, jNeuroML v0.13.0) diff --git a/pynml-modchananalysis.1 b/pynml-modchananalysis.1 new file mode 100644 index 00000000..5cee716c --- /dev/null +++ b/pynml-modchananalysis.1 @@ -0,0 +1,75 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1. +.TH PYNML-MODCHANANALYSIS "1" "March 2024" "pynml-modchananalysis v1.2.8" "User Commands" +.SH NAME +pynml-modchananalysis \- manual page for pynml-modchananalysis v1.2.8 +.SH DESCRIPTION +usage: pynml\-modchananalysis [\-h] [\-v] [\-nogui] [\-minV ] +.TP +[\-maxV ] [\-stepV ] +[\-dt