Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pyneuroml/pynml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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,
Expand Down