diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..fdf1f45 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,116 @@ +# This workflow will build a Java project with Maven +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: Publish Javadocs + +on: + push: + branches: [ development ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: nelonoel/branch-name@v1.0.1 + + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + java-package: jdk + + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Install GH import + run: | + python -m pip install --upgrade pip + pip install ghp-import + + - name: Checkout NeuroML2 + uses: actions/checkout@v2 + with: + repository: NeuroML/NeuroML2 + ref: development + path: NeuroML2 + + - name: Checkout org.lemsml + uses: actions/checkout@v2 + with: + repository: LEMS/jLEMS + ref: development + path: jLEMS + + - name: Checkout org.neuroml.model.injectingplugin + uses: actions/checkout@v2 + with: + repository: NeuroML/org.neuroml.model.injectingplugin + ref: development + path: org.neuroml.model.injectingplugin + + - name: Checkout org.neuroml1.model + uses: actions/checkout@v2 + with: + repository: NeuroML/org.neuroml1.model + ref: development + path: org.neuroml1.model + + - name: Checkout org.neuroml.model + uses: actions/checkout@v2 + with: + repository: NeuroML/org.neuroml.model + ref: development + path: org.neuroml.model + + - name: Checkout org.neuroml.export + uses: actions/checkout@v2 + with: + repository: NeuroML/org.neuroml.export + ref: development + path: org.neuroml.export + + - name: Checkout org.neuroml.import + uses: actions/checkout@v2 + with: + repository: NeuroML/org.neuroml.import + ref: development + path: org.neuroml.import + + + - name: Install NeuroML deps + run: | + pushd jLEMS + mvn install + popd + pushd NeuroML2 + mvn install + popd + pushd org.neuroml.model.injectingplugin + mvn install + popd + pushd org.neuroml1.model + mvn install + popd + pushd org.neuroml.model + mvn install + popd + pushd org.neuroml.export + mvn install + popd + pushd org.neuroml.import + mvn install + popd + + - name: Build docs + run: | + mvn javadoc:javadoc + + - name: Publish documentation on GH pages + run: | + ghp-import -f -m "Regenerate documentation" -b gh-pages -n -p target/site/apidocs + diff --git a/.travis.yml b/.travis.yml index 6af332a..7cbd054 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,13 @@ -dist: trusty -sudo: false +dist: xenial language: java jdk: - - openjdk7 + - oraclejdk11 + - openjdk8 - - oraclejdk8 - # - oraclejdk9 + #- openjdk10 # Some non deterministic recurring error with jdk10... + - openjdk11 install: - export main_repo_branch=$TRAVIS_BRANCH @@ -18,6 +18,7 @@ install: - ls -alt - git branch - python getNeuroML.py $main_repo_branch # will call mvn install on this & other repos + - mvn dependency:tree - pwd script: diff --git a/README.md b/README.md index f11f716..9292e72 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,13 @@ jNeuroML ======== +[![GitHub](https://img.shields.io/github/license/NeuroML/jNeuroML)](https://github.com/NeuroML/jNeuroML/blob/master/LICENSE.lesser) +[![GitHub pull requests](https://img.shields.io/github/issues-pr/NeuroML/jNeuroML)](https://github.com/NeuroML/jNeuroML/pulls) +[![GitHub issues](https://img.shields.io/github/issues/NeuroML/jNeuroML)](https://github.com/NeuroML/jNeuroML/issues) +[![GitHub Org's stars](https://img.shields.io/github/stars/NeuroML?style=social)](https://github.com/NeuroML) +[![Twitter Follow](https://img.shields.io/twitter/follow/NeuroML?style=social)](https://twitter.com/NeuroML) + + There are a number of repositories in active development under GitHub for handling [NeuroML](https://github.com/NeuroML) and [LEMS](https://github.com/LEMS) with Java. To make it easier to access all of this functionality, we've created a single package, jNeuroML, which allows access to most of this functionality through a simple command line interface and requires minimal installation. @@ -21,6 +28,18 @@ You can also check out the most recent verson of the jar file using: svn checkout svn://svn.code.sf.net/p/neuroml/code/jNeuroMLJar cd jNeuroMLJar + +### Fedora + +The [NeuroFedora](https://neuro.fedoraproject.org) community initiative provides jNeuroML for use on the [Fedora Linux Distribution](https://getfedora.org). +Fedora users can install jNeuroML using the following commands: + + sudo dnf copr enable @neurofedora/neurofedora-extra + sudo dnf install jneuroml + +Please see the [project documentation](https://docs.fedoraproject.org/en-US/neurofedora/copr/) for more information. + + Usage ----- @@ -76,10 +95,3 @@ If you prefer using/installing/coding in Python, try out [pyNeuroML](https://git [![Build Status](https://travis-ci.com/NeuroML/jNeuroML.png?branch=master)](https://travis-ci.com/NeuroML/jNeuroML) This code is distributed under the terms of the GNU Lesser General Public License. - - - - - - - diff --git a/getNeuroML.py b/getNeuroML.py index d55ba1a..bcadd73 100644 --- a/getNeuroML.py +++ b/getNeuroML.py @@ -4,6 +4,8 @@ import sys import os.path as op import subprocess +from textwrap import dedent + def main(): """Main""" @@ -50,9 +52,7 @@ def main(): # Which repos use a development branch? dev_branch_repos = neuroml2_spec_repo + neuroml_repos + jlems_repo - - all_repos = lems_repos + neuroml_repos - + all_repos = lems_repos + neuroml_repos # Set the preferred method for cloning from GitHub github_pref = "HTTP" @@ -68,23 +68,22 @@ def main(): local_dir = ".." + os.sep + repo.split("/")[1] - if mode is "clean": - print("------ Cleaning: %s -------"%repo) + if mode == "clean": + print("------ Cleaning: %s -------" % repo) if repo in java_repos: command = "mvn clean" print("It's a Java repository, so cleaning using Maven...") info = execute_command_in_dir(command, local_dir) - if mode is "update": - - print("------ Updating: %s -------" %repo) + if mode == "update": + print("------ Updating: %s -------" % repo) runMvnInstall = False if not op.isdir(local_dir): command = "git clone %s%s" % (pre_gh[github_pref], repo) - print ("Creating a new directory: %s by cloning from GitHub" % \ - (local_dir)) + print("Creating a new directory: %s by cloning from GitHub" % + (local_dir)) execute_command_in_dir(command, "..") runMvnInstall = True @@ -92,8 +91,8 @@ def main(): if switch_to_branch: if (repo in dev_branch_repos): command = "git checkout %s" % (switch_to_branch) - print ("Switching to branch: %s" % (switch_to_branch)) - exit_on_fail = switch_to_branch is not "experimental" + print("Switching to branch: %s" % (switch_to_branch)) + exit_on_fail = switch_to_branch != "experimental" execute_command_in_dir(command, local_dir, exit_on_fail) runMvnInstall = True @@ -107,55 +106,54 @@ def main(): or not op.isdir(local_dir + os.sep + "target") \ or ("jNeuroML" in repo) - if (repo in java_repos or repo in neuroml2_spec_repo) and runMvnInstall: + if (repo in java_repos or repo in neuroml2_spec_repo) \ + and runMvnInstall: command = "mvn install" print("It's a Java repository, so installing using Maven...") info = execute_command_in_dir(command, local_dir) - #The code below needs a non trivial rewrite due to python3 differences. - - # + # The code below needs a non trivial rewrite due to python3 + # differences. if str("BUILD SUCCESS") in str(info): - print("Successful installation using : %s!" %command) + print("Successful installation using : %s!" % command) else: - print("Problem installing using : %s!" %command) + print("Problem installing using : %s!" % command) print(info) exit(1) - if mode is "update": + if mode == "update": print("All repositories successfully updated & Java modules built!") - print("You should be able to run some examples straight " \ - "away using jnml: ") - if os.name is not 'nt': - print(" ./jnml "\ - "-validate ../NeuroML2/examples/NML2_FullNeuroML.nml") - print(" ./jnml " \ - "../NeuroML2/LEMSexamples/LEMS_NML2_Ex2_Izh.xml") + print("You should be able to run examples straight away using jnml: ") + if os.name != 'nt': + print(" ./jnml " + + "-validate ../NeuroML2/examples/NML2_FullNeuroML.nml") + print(" ./jnml " + + "../NeuroML2/LEMSexamples/LEMS_NML2_Ex2_Izh.xml") else: - print(" jnml -validate " \ - "..\\NeuroML2\\examples\\NML2_FullNeuroML.nml") - print(" jnml " \ - "..\\NeuroML2\\LEMSexamples\\LEMS_NML2_Ex2_Izh.xml") - if mode is "clean": + print(" jnml -validate " + + "..\\NeuroML2\\examples\\NML2_FullNeuroML.nml") + print(" jnml " + + "..\\NeuroML2\\LEMSexamples\\LEMS_NML2_Ex2_Izh.xml") + if mode == "clean": print("All repositories successfully cleaned!") - - def execute_command_in_dir(command, directory, exit_on_fail=True): """Execute a command in specific working directory""" if os.name == 'nt': directory = os.path.normpath(directory) - print(">>> Executing: (%s) in dir: %s (%s)" % (command, directory, os.path.abspath(directory))) + print(">>> Executing: (%s) in dir: %s (%s)" % + (command, directory, os.path.abspath(directory))) - p = subprocess.Popen(command, cwd=directory, shell=True, stdout=subprocess.PIPE) + p = subprocess.Popen(command, cwd=directory, shell=True, + stdout=subprocess.PIPE) return_str = p.communicate() - if p.returncode != 0: - print("Error: %s" % p.returncode) + if p.returncode != 0: + print("Error: %s" % p.returncode) print(return_str[0]) - if exit_on_fail: + if exit_on_fail: exit(p.returncode) if (sys.version_info > (3, 0)): return return_str[0].decode("utf-8") @@ -164,15 +162,27 @@ def execute_command_in_dir(command, directory, exit_on_fail=True): def help_info(): - print("\nUsage:\n\n python getNeuroML.py\n " \ - "Pull (or clone) the latest version of all NeuroML 2 repos & " \ - "compile/install with Maven if applicable\n\n" \ - " python getNeuroML.py clean\n " - "Run 'mvn clean' on all Java repos\n\n" \ - " python getNeuroML.py master\n " \ - "Switch all repos to master branch\n\n" \ - " python getNeuroML.py development\n " \ - "Switch relevant repos to development branch\n\n") + usage = ( + """\ + Usage: python getNeuroML.py [OPTION] + Script to install NeuroML libraries. + Note: requires internet connectivity. + + python getNeuroML.py + Pull (or clone) the latest version of all NeuroML 2 repos & + compile/install with Maven if applicable + + python getNeuroML.py clean + Run 'mvn clean' on all Java repos + + python getNeuroML.py master + Switch all repos to master branch + + python getNeuroML.py development + Switch relevant repos to development branch + """ + ) + print(dedent(usage)) if __name__ == "__main__": diff --git a/installers/linux-install.sh b/installers/linux-install.sh new file mode 100755 index 0000000..5f388c3 --- /dev/null +++ b/installers/linux-install.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# Copyright 2021 Ankur Sinha +# Author: Ankur Sinha +# File : linux-install.sh +# +# Install jNeuroML on Linux machines +jNeuroMLJarDir="$(pwd)" + +if command -v java &> /dev/null +then + echo "Found java installation:" + java -version +else + echo "Could not find 'java' command." + echo "Please ensure that a Java Runtime Environment is installed on your system and that the 'java' command is usable in the terminal" + exit -1 +fi + +if [ -e "jnml" ] && [ -f jNeuroML*jar-with-dependencies.jar ]; +then + echo "Found jar and jnml in current directory: $jNeuroMLJarDir" + echo "Updating ~/.bashrc to make it available in \$PATH." +else + echo "ERROR: jnml or jneuroML pre-compiled JAR file not found." + echo "ERROR: Please run this script from the jNeuroMLJar directory that contains both jnml and the jar file." + exit -1 +fi + +# Remove previous JNML additions +sed -i '/JNML_HOME/ d' ~/.bashrc + +# Export JNML_HOME so that jnml can find the JAR +cat >> ~/.bashrc << EOF +# JNML_HOME etc for jNeuroML +export JNML_HOME="$jNeuroMLJarDir" +export PATH="\$PATH:\$JNML_HOME" +EOF + +echo "Done: Please log out and back in and try to run jnml in a terminal." +exit 0 diff --git a/jnml b/jnml index fed6b95..5e4eabe 100755 --- a/jnml +++ b/jnml @@ -5,7 +5,7 @@ # Type java -X for more info export JNML_MAX_MEMORY=400M -export JNML_VERSION=0.9.1 +export JNML_VERSION=0.10.3 export CLASSPATH=.:./target/jNeuroML-$JNML_VERSION-jar-with-dependencies.jar:$JNML_HOME/target/jNeuroML-$JNML_VERSION-jar-with-dependencies.jar diff --git a/jnml.bat b/jnml.bat index 60b00c4..72bb14b 100644 --- a/jnml.bat +++ b/jnml.bat @@ -1,6 +1,6 @@ @echo off -set JNML_VERSION=0.9.1 +set JNML_VERSION=0.10.3 set CLASSPATH=target\jNeuroML-%JNML_VERSION%-jar-with-dependencies.jar;%JNML_HOME%\jNeuroML-%JNML_VERSION%-jar-with-dependencies.jar diff --git a/pom.xml b/pom.xml index 7921939..b82a773 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.neuroml jNeuroML - 0.9.1 + 0.10.3 jar jNeuroML @@ -24,18 +24,32 @@ org.neuroml1.model org.neuroml1.model - 1.6.1 + 1.7.2 org.neuroml.import org.neuroml.import - 1.6.1 + 1.7.2 - maven-assembly-plugin 2.4 @@ -43,7 +57,7 @@ jar-with-dependencies - + true @@ -67,15 +81,12 @@ maven-compiler-plugin 3.0 - 1.6 - 1.6 + 1.7 + 1.7 - + - - - diff --git a/src/main/java/org/neuroml/JNeuroML.java b/src/main/java/org/neuroml/JNeuroML.java index c934a37..af6b3af 100644 --- a/src/main/java/org/neuroml/JNeuroML.java +++ b/src/main/java/org/neuroml/JNeuroML.java @@ -59,7 +59,7 @@ public class JNeuroML public static final String JNML_SCRIPT = "jnml"; - public static final String JNML_VERSION = "0.9.1"; + public static final String JNML_VERSION = "0.10.3"; public static final String HELP_FLAG = "-help"; public static final String HELP_FLAG_SHORT = "-h"; @@ -67,7 +67,7 @@ public class JNeuroML public static final String VERSION_FLAG = "-v"; public static final String VERSION_FLAG_LONG = "-version"; - + public static final String SEARCH_PATH_FLAG = "-I"; public static final String SEARCH_PATH_JLEMSLIKE_FLAG = "-cp"; @@ -76,7 +76,7 @@ public class JNeuroML public static final String RUN_FLAG = "-run"; public static final String NO_RUN_FLAG = "-norun"; - + public static final String OUTPUT_DIR_FLAG = "-outputdir"; public static final String VALIDATE_FLAG = "-validate"; @@ -111,11 +111,11 @@ public class JNeuroML public static final String PYNN_EXPORT_FLAG = "-pynn"; public static final String RUN_PYNN_NEURON_FLAG = "-run-neuron"; - + public static final String NETPYNE_EXPORT_FLAG = "-netpyne"; - + public static final String NUMBER_PROCESSORS_FLAG = "-np"; - + public static final String VERTEX_EXPORT_FLAG = "-vertex"; public static final String NINEML_EXPORT_FLAG = "-nineml"; @@ -124,7 +124,7 @@ public class JNeuroML public static final String NEST_EXPORT_FLAG = "-nest"; public static final String MOOSE_EXPORT_FLAG = "-moose"; - + //public static final String GEPPETTO_EXPORT_FLAG = "-geppetto"; public static final String SBML_IMPORT_FLAG = "-sbml-import"; @@ -132,108 +132,109 @@ public class JNeuroML public static final String SBML_EXPORT_FLAG = "-sbml"; public static final String SBML_SEDML_EXPORT_FLAG = "-sbml-sedml"; - public static final String GRAPH_FLAG = "-graph"; + public static final String OLD_GRAPH_FLAG = "-graph"; + public static final String LEMS_GRAPH_FLAG = "-lems-graph"; public static final String SVG_FLAG = "-svg"; public static final String PNG_FLAG = "-png"; static String usage = "Usage: \n\n" + " " + JNML_SCRIPT + " LEMSFile.xml\n" - + " Load LEMSFile.xml using jLEMS, parse it and validate it as LEMS, and execute the model it contains\n\n" - + + " Load LEMSFile.xml using jLEMS, parse it and validate it as LEMS, and execute the model it contains\n\n" + + " " + JNML_SCRIPT + " LEMSFile.xml " + NO_GUI_FLAG + "\n" - + " As above, parse and execute the model and save results, but don't show GUI\n\n" - + + " As above, parse and execute the model and save results, but don't show GUI\n\n" + + " " + JNML_SCRIPT + " LEMSFile.xml " + NO_RUN_FLAG + "\n" - + " Parse the LEMS file, but don't run the simulation\n\n" - + + " Parse the LEMS file, but don't run the simulation\n\n" + + " " + JNML_SCRIPT + " " + SEARCH_PATH_FLAG + " directory1:directory2:directoryN LEMSFile.xml\n" - + " Execute the LEMS file, inclusing the : separated list of directories on the search path for includes\n\n" - - + " " + JNML_SCRIPT + " LEMSFile.xml " + GRAPH_FLAG + "\n" - + " Load LEMSFile.xml using jLEMS, and convert it to GraphViz format\n\n" - - + " " + JNML_SCRIPT + " LEMSFile.xml " + NEURON_EXPORT_FLAG + " [" + NO_GUI_FLAG + "] [" + RUN_FLAG+ "] ["+OUTPUT_DIR_FLAG+" dir]\n" - + " Load LEMSFile.xml using jLEMS, and convert it to NEURON format, OR load ModelFile.nml and generate hoc and mod files for cells, channels, synapses \n" - + " " + NO_GUI_FLAG+ " Do not generate graphical elements in NEURON, just run, save data and quit (if input file is LEMS file)\n" - + " " + RUN_FLAG + " Compile NMODL files and run the main NEURON Python file (only with LEMS file)\n" - + " " + NEURON_COMPILE_FLAG + " Compile NMODL files, but don't run (Linux only currently)\n" - + " " + OUTPUT_DIR_FLAG + " Generate NEURON files in another directory, dir\n\n" - + + " Execute the LEMS file, inclusing the : separated list of directories on the search path for includes\n\n" + + + " " + JNML_SCRIPT + " LEMSFile.xml " + LEMS_GRAPH_FLAG + "\n" + + " Load LEMSFile.xml using jLEMS, and convert it to GraphViz format (note, previously this option was: "+OLD_GRAPH_FLAG+")\n\n" + + + " " + JNML_SCRIPT + " LEMSFile.xml " + NEURON_EXPORT_FLAG + " [" + NO_GUI_FLAG + "] [" + RUN_FLAG+ "] ["+OUTPUT_DIR_FLAG+" dir]\n" + + " Load LEMSFile.xml using jLEMS, and convert it to NEURON format, OR load ModelFile.nml and generate hoc and mod files for cells, channels, synapses \n" + + " " + NO_GUI_FLAG+ " Do not generate graphical elements in NEURON, just run, save data and quit (if input file is LEMS file)\n" + + " " + RUN_FLAG + " Compile NMODL files and run the main NEURON Python file (only with LEMS file)\n" + + " " + NEURON_COMPILE_FLAG + " Compile NMODL files, but don't run (Linux only currently)\n" + + " " + OUTPUT_DIR_FLAG + " Generate NEURON files in another directory, dir\n\n" + + " " + JNML_SCRIPT + " LEMSFile.xml " + NETPYNE_EXPORT_FLAG + "\n" - + " Load LEMSFile.xml using jLEMS, and convert it to NetPyNE format\n" - + " " + RUN_FLAG + " Compile NMODL files and run the main NEURON Python file\n\n" - + + " Load LEMSFile.xml using jLEMS, and convert it to NetPyNE format\n" + + " " + RUN_FLAG + " Compile NMODL files and run the main NEURON Python file\n\n" + + " " + JNML_SCRIPT + " LEMSFile.xml " + BRIAN_EXPORT_FLAG + "\n" - + " Load LEMSFile.xml using jLEMS, and convert it to Brian v1 format (*EXPERIMENTAL - single components only*)\n\n" - + + " Load LEMSFile.xml using jLEMS, and convert it to Brian v1 format (*EXPERIMENTAL - single components only*)\n\n" + + " " + JNML_SCRIPT + " LEMSFile.xml " + BRIAN2_EXPORT_FLAG + "\n" - + " Load LEMSFile.xml using jLEMS, and convert it to Brian v2 format (*EXPERIMENTAL - single components only*)\n\n" - + + " Load LEMSFile.xml using jLEMS, and convert it to Brian v2 format (*EXPERIMENTAL - single components only*)\n\n" + + " " + JNML_SCRIPT + " LEMSFile.xml " + MOOSE_EXPORT_FLAG + "\n" - + " Load LEMSFile.xml using jLEMS, and convert it to MOOSE format (**EXPERIMENTAL**)\n\n" - - + " " + JNML_SCRIPT + " NMLFile.nml " + SVG_FLAG + "\n" + + " Load LEMSFile.xml using jLEMS, and convert it to MOOSE format (**EXPERIMENTAL**)\n\n" + + + " " + JNML_SCRIPT + " NMLFile.nml " + SVG_FLAG + "\n" + " Load NMLFile.nml and convert cells & networks to SVG image format \n\n" - - + " " + JNML_SCRIPT + " NMLFile.nml " + PNG_FLAG + "\n" + + + " " + JNML_SCRIPT + " NMLFile.nml " + PNG_FLAG + "\n" + " Load NMLFile.nml and convert cells & networks to PNG image format \n\n" - + + " " + JNML_SCRIPT + " LEMSFile.xml " + DLEMS_EXPORT_FLAG + "\n" - + " Load LEMSFile.xml using jLEMS, and convert it to dLEMS, a distilled form of LEMS in JSON (**EXPERIMENTAL - single components only**)\n\n" - - + " " + JNML_SCRIPT + " LEMSFile.xml " + VERTEX_EXPORT_FLAG+ "\n" - + " Load LEMSFile.xml using jLEMS, and convert it to VERTEX format (*EXPERIMENTAL*)\n\n" - - + " " + JNML_SCRIPT + " LEMSFile.xml " + XPP_EXPORT_FLAG + "\n" - + " Load LEMSFile.xml using jLEMS, and convert it to XPPAUT format (*EXPERIMENTAL - single components only*)\n\n" - - + " " + JNML_SCRIPT + " LEMSFile.xml " + DNSIM_EXPORT_FLAG + "\n" + + " Load LEMSFile.xml using jLEMS, and convert it to dLEMS, a distilled form of LEMS in JSON (**EXPERIMENTAL - single components only**)\n\n" + + + " " + JNML_SCRIPT + " LEMSFile.xml " + VERTEX_EXPORT_FLAG+ "\n" + + " Load LEMSFile.xml using jLEMS, and convert it to VERTEX format (*EXPERIMENTAL*)\n\n" + + + " " + JNML_SCRIPT + " LEMSFile.xml " + XPP_EXPORT_FLAG + "\n" + + " Load LEMSFile.xml using jLEMS, and convert it to XPPAUT format (*EXPERIMENTAL - single components only*)\n\n" + + + " " + JNML_SCRIPT + " LEMSFile.xml " + DNSIM_EXPORT_FLAG + "\n" + " Load LEMSFile.xml using jLEMS, and convert it to DNsim format (*EXPERIMENTAL - single components only*)\n\n" - - + " " + JNML_SCRIPT + " LEMSFile.xml " + SBML_EXPORT_FLAG + "\n" - + " Load LEMSFile.xml using jLEMS, and convert it to SBML format (**EXPERIMENTAL - single components only**)\n\n" - + + + " " + JNML_SCRIPT + " LEMSFile.xml " + SBML_EXPORT_FLAG + "\n" + + " Load LEMSFile.xml using jLEMS, and convert it to SBML format (**EXPERIMENTAL - single components only**)\n\n" + + " " + JNML_SCRIPT + " LEMSFile.xml " + SEDML_EXPORT_FLAG + "\n" - + " Load LEMSFile.xml using jLEMS, and convert it (just the simulation run/display/save information) to SED-ML format\n\n" - - + " " + JNML_SCRIPT + " LEMSFile.xml " + SBML_SEDML_EXPORT_FLAG + "\n" - + " Load LEMSFile.xml using jLEMS, and convert it to SBML format with a SED-ML file describing the experiment to run (*EXPERIMENTAL - single components only*)\n\n" - - + " " + JNML_SCRIPT + " LEMSFile.xml "+ MATLAB_EXPORT_FLAG + "\n" - + " Load LEMSFile.xml using jLEMS, and convert it to MATLAB format (**EXPERIMENTAL - single components only**)\n\n" - - + " " + JNML_SCRIPT+ " LEMSFile.xml " + CVODE_EXPORT_FLAG + "\n" + + " Load LEMSFile.xml using jLEMS, and convert it (just the simulation run/display/save information) to SED-ML format\n\n" + + + " " + JNML_SCRIPT + " LEMSFile.xml " + SBML_SEDML_EXPORT_FLAG + "\n" + + " Load LEMSFile.xml using jLEMS, and convert it to SBML format with a SED-ML file describing the experiment to run (*EXPERIMENTAL - single components only*)\n\n" + + + " " + JNML_SCRIPT + " LEMSFile.xml "+ MATLAB_EXPORT_FLAG + "\n" + + " Load LEMSFile.xml using jLEMS, and convert it to MATLAB format (**EXPERIMENTAL - single components only**)\n\n" + + + " " + JNML_SCRIPT+ " LEMSFile.xml " + CVODE_EXPORT_FLAG + "\n" + " Load LEMSFile.xml using jLEMS, and convert it to C format using CVODE package (**EXPERIMENTAL - single components only**)\n\n" - + + " " + JNML_SCRIPT + " LEMSFile.xml " + NINEML_EXPORT_FLAG + "\n" - + " Load LEMSFile.xml using jLEMS, and convert it to NineML format (*EXPERIMENTAL - single components only*)\n\n" - - + " " + JNML_SCRIPT + " LEMSFile.xml " + SPINEML_EXPORT_FLAG+ "\n" - + " Load LEMSFile.xml using jLEMS, and convert it to SpineML format (*EXPERIMENTAL - single components only*)\n\n" - - + " " + JNML_SCRIPT + " " + SBML_IMPORT_FLAG+ " SBMLFile.sbml duration dt\n" - + " Load SBMLFile.sbml using jSBML, and convert it to LEMS format using values for duration & dt in ms (ignoring SBML units)\n\n" - + + " Load LEMSFile.xml using jLEMS, and convert it to NineML format (*EXPERIMENTAL - single components only*)\n\n" + + + " " + JNML_SCRIPT + " LEMSFile.xml " + SPINEML_EXPORT_FLAG+ "\n" + + " Load LEMSFile.xml using jLEMS, and convert it to SpineML format (*EXPERIMENTAL - single components only*)\n\n" + + + " " + JNML_SCRIPT + " " + SBML_IMPORT_FLAG+ " SBMLFile.sbml duration dt\n" + + " Load SBMLFile.sbml using jSBML, and convert it to LEMS format using values for duration & dt in ms (ignoring SBML units)\n\n" + + " " + JNML_SCRIPT + " " + SBML_IMPORT_UNITS_FLAG + " SBMLFile.sbml duration dt\n" + " Load SBMLFile.sbml using jSBML, and convert it to LEMS format using values for duration & dt in ms (attempt to extract SBML units; ensure units are valid in the SBML!)\n\n" - + + " " + JNML_SCRIPT+" LEMSFile.xml " + VHDL_EXPORT_FLAG + " neuronid \n" + - " Load LEMSFile.xml using jLEMS, and convert it to VHDL format (**EXPERIMENTAL - point models only - single neurons only**)\n\n" - - + " " + JNML_SCRIPT + " " + VALIDATE_FLAG + " NMLFile.nml\n" - + " Validate NMLFile.nml against latest v2 Schema & perform a number of other tests\n\n" - - + " " + JNML_SCRIPT + " " + VALIDATE_V1_FLAG + " NMLFile.nml\n" + " Validate NMLFile.nml against NeuroML v1.8.1 Schema \n\n" - - + " " + JNML_SCRIPT + " " + VERSION_FLAG + "\n" - - + " " + JNML_SCRIPT + " " + VERSION_FLAG_LONG + "\n" + " Print information on versions of packages used\n\n" - - + " " + JNML_SCRIPT + " " + HELP_FLAG + "\n" - - + " " + JNML_SCRIPT + " " + HELP_FLAG_SHORT + "\n" - + " Load LEMSFile.xml using jLEMS, and convert it to VHDL format (**EXPERIMENTAL - point models only - single neurons only**)\n\n" + + + " " + JNML_SCRIPT + " " + VALIDATE_FLAG + " NMLFile.nml\n" + + " Validate NMLFile.nml against latest v2 Schema & perform a number of other tests\n\n" + + + " " + JNML_SCRIPT + " " + VALIDATE_V1_FLAG + " NMLFile.nml\n" + " Validate NMLFile.nml against NeuroML v1.8.1 Schema \n\n" + + + " " + JNML_SCRIPT + " " + VERSION_FLAG + "\n" + + + " " + JNML_SCRIPT + " " + VERSION_FLAG_LONG + "\n" + " Print information on versions of packages used\n\n" + + + " " + JNML_SCRIPT + " " + HELP_FLAG + "\n" + + + " " + JNML_SCRIPT + " " + HELP_FLAG_SHORT + "\n" + + " " + JNML_SCRIPT + " " + HELP_FLAG_SHORT_Q + "\n" + " Print this help information\n\n"; public static void showUsage() @@ -256,7 +257,7 @@ private static Lems loadLemsFile(File lemsFile, boolean includeConnectionsFromHD } return Utils.readLemsNeuroMLFile(lemsFile,includeConnectionsFromHDF5).getLems(); } - + private static Lems loadNmlFileAsLems(File nmlFile) throws LEMSException, NeuroMLException, IOException { if(!nmlFile.exists()) @@ -267,27 +268,27 @@ private static Lems loadNmlFileAsLems(File nmlFile) throws LEMSException, NeuroM } return Utils.readNeuroMLFile(nmlFile).getLems(); } - + private static String generateFormatFilename(File lemsFile, Format format, String extra) { String filename = lemsFile.getName(); return generateFormatFilename(filename, format, extra); } - + private static String generateFormatFilename(String lemsFilename, Format format, String extra) { String newSuffix = (extra!=null ? extra : "") + "." + format.getExtension(); - + String filename = lemsFilename; - + String oldSuffix = "."+Format.LEMS.getExtension(); - + if (filename.endsWith(oldSuffix)) { filename = filename.substring(0, filename.length() - oldSuffix.length()); } - + filename = filename + newSuffix; - + return filename; } @@ -318,13 +319,13 @@ public static void main(String[] args) throws SBMLException, org.sbml.jsbml.text argsToUse.add(args[i]); } } - + args = new String[argsToUse.size()]; args = argsToUse.toArray(args); - + //System.out.println("args: "+args.length ); //System.out.println("args: "+args[0] ); - + if(args.length == 0) { System.err.println("Error, no arguments to " + JNML_SCRIPT); @@ -461,7 +462,7 @@ else if(args[1].equals(NEURON_EXPORT_FLAG)) File lemsNmlFile = (new File(args[0])).getCanonicalFile(); Lems lems = null; - + if (lemsNmlFile.getName().endsWith("nml")) { lems = loadNmlFileAsLems(lemsNmlFile); @@ -476,7 +477,7 @@ else if(args[1].equals(NEURON_EXPORT_FLAG)) File outputDir = lemsNmlFile.getParentFile(); int i = 2; - while (i 0) { System.out.println("\nTry running this file locally with Geppetto using:\n\n " + "http://localhost:8080/org.geppetto.frontend/?sim=file://" + genFile + "\n"); @@ -768,8 +769,8 @@ else if(args[1].equals(CELLML_EXPORT_FLAG)) File lemsFile = new File(args[0]); Lems lems = loadLemsFile(lemsFile); - CellMLWriter cellmlw = new CellMLWriter(lems, - lemsFile.getParentFile(), + CellMLWriter cellmlw = new CellMLWriter(lems, + lemsFile.getParentFile(), generateFormatFilename(lemsFile, Format.CELLML, null)); for(File genFile : cellmlw.convert()) { @@ -875,8 +876,8 @@ else if(args[1].equals(BRIAN_EXPORT_FLAG) || args[1].equals(BRIAN2_EXPORT_FLAG)) { System.out.println("Writing to: " + genFile.getAbsolutePath()); } - } - else if(args[1].equals(GRAPH_FLAG)) + } + else if(args[1].equals(OLD_GRAPH_FLAG) || args[1].equals(LEMS_GRAPH_FLAG)) { File lemsFile = new File(args[0]); Lems lems = loadLemsFile(lemsFile); @@ -896,15 +897,30 @@ else if(args[1].equals(GRAPH_FLAG)) { pr.waitFor(); - BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getErrorStream())); - String line; - while((line = buf.readLine()) != null) + /* Successful termination of command */ + if (pr.exitValue() == 0) { - System.out.println("----" + line); + BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getInputStream())); + String line; + while((line = buf.readLine()) != null) + { + System.out.println("----" + line); + } + System.out.println("Have successfully run command: " + cmd); + System.exit(0); + } + /* Unsuccessful termination of command */ + else + { + BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getErrorStream())); + String line; + while((line = buf.readLine()) != null) + { + System.out.println("----" + line); + } + System.out.println("Error running command: " + cmd); + System.exit(1); } - - System.out.println("Have successfully run command: " + cmd); - } catch(InterruptedException e) { @@ -935,10 +951,10 @@ else if(args[1].equals(PNG_FLAG)) String pngFileName = nmlFile.getName().replaceAll("." + Format.NEUROML2.getExtension(), "." + Format.PNG.getExtension()); File pngFile = new File(nmlFile.getParentFile(), pngFileName); SVGWriter svgw = new SVGWriter(nmlDocument, nmlFile.getParentFile(), pngFileName); - + svgw.convertToPng(pngFile); System.out.println("Writing to: " + pngFile.getAbsolutePath()); - + } else { @@ -954,13 +970,13 @@ else if(args.length == 3) File lemsFile = new File(args[0]); Lems lems = loadLemsFile(lemsFile); - + VHDLWriter vw = new VHDLWriter(lems); - + Map componentScripts = vw.getNeuronModelScripts(args[2],false); //String testbenchScript = vw.getSimulationScript(ScriptType.TESTBENCH, args[2], false); String prjScript = vw.getPrjFile(componentScripts.keySet()); - + for (Map.Entry entry : componentScripts.entrySet()) { String key = entry.getKey(); String val = entry.getValue(); @@ -968,14 +984,14 @@ else if(args.length == 3) FileUtil.writeStringToFile(val, vwFile); System.out.println("Writing to: "+vwFile.getAbsolutePath()); } - + /*File vwFile = new File(lemsFile.getParentFile(), "/testbench.vhdl"); FileUtil.writeStringToFile(testbenchScript, vwFile); System.out.println("Writing to: "+vwFile.getAbsolutePath());*/ File vwFile = new File(lemsFile.getParentFile(), "/testbench.prj"); FileUtil.writeStringToFile(prjScript, vwFile); System.out.println("Writing to: "+vwFile.getAbsolutePath()); - + } } else if(args.length == 4)