From 18c2ce42c3be3f1de18a134769476e5dd1b35926 Mon Sep 17 00:00:00 2001
From: Padraig Gleeson
Date: Fri, 22 Sep 2023 17:39:59 +0100
Subject: [PATCH 01/10] To v1.10.0
---
pom.xml | 14 +++++------
.../neuroml/model/util/NeuroMLElements.java | 7 +++---
.../resources/bindings/NeuroML_v2.3.1.xjb | 23 +++++++++++++++++++
3 files changed, 34 insertions(+), 10 deletions(-)
create mode 100644 src/main/resources/bindings/NeuroML_v2.3.1.xjb
diff --git a/pom.xml b/pom.xml
index 8636ebc7..66d5f1b8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,10 +3,10 @@
4.0.0
org.neuroml.model
org.neuroml.model
- 1.9.1
+ 1.10.0
bundle
- 2.3
+ 2.3.1
UTF-8
@@ -19,12 +19,12 @@
org.neuroml.model.injectingplugin
org.neuroml.model.injectingplugin
- 1.9.1
+ 1.10.0
org.neuroml.core
neuroml2-base-definitions
- 1.9.1
+ 1.10.0
@@ -64,7 +64,7 @@
<br />
<br />
- Copyright NeuroML Contributors 2022
+ Copyright NeuroML Contributors 2023
@@ -105,7 +105,7 @@
- org.neuroml.core:neuroml2-base-definitions:1.9.1
+ org.neuroml.core:neuroml2-base-definitions:1.10.0
@@ -198,7 +198,7 @@
org.neuroml.model.injectingplugin
org.neuroml.model.injectingplugin
- 1.9.1
+ 1.10.0
diff --git a/src/main/java/org/neuroml/model/util/NeuroMLElements.java b/src/main/java/org/neuroml/model/util/NeuroMLElements.java
index e9118b35..ae85b3b9 100644
--- a/src/main/java/org/neuroml/model/util/NeuroMLElements.java
+++ b/src/main/java/org/neuroml/model/util/NeuroMLElements.java
@@ -2,7 +2,7 @@
public class NeuroMLElements {
- public static final String ORG_NEUROML_MODEL_VERSION = "1.9.1";
+ public static final String ORG_NEUROML_MODEL_VERSION = "1.10.0";
public static final String NAMESPACE_URI_VERSION_2 = "http://www.neuroml.org/schema/neuroml2";
@@ -17,11 +17,12 @@ public class NeuroMLElements {
public static final String DEFAULT_SCHEMA_LOCATION_VERSION_2_1 = "https://raw.githubusercontent.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.1.xsd";
public static final String DEFAULT_SCHEMA_LOCATION_VERSION_2_2 = "https://raw.githubusercontent.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.2.xsd";
public static final String DEFAULT_SCHEMA_LOCATION_VERSION_2_3 = "https://raw.githubusercontent.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.3.xsd";
+ public static final String DEFAULT_SCHEMA_LOCATION_VERSION_2_3_1 = "https://raw.githubusercontent.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.3.1.xsd";
- public static final String LATEST_SCHEMA_VERSION = "2.3";
+ public static final String LATEST_SCHEMA_VERSION = "2.3.1";
public static final String LATEST_SCHEMA = "/Schemas/NeuroML2/NeuroML_v"+LATEST_SCHEMA_VERSION+".xsd";
- public static final String LATEST_SCHEMA_LOCATION = DEFAULT_SCHEMA_LOCATION_VERSION_2_3;
+ public static final String LATEST_SCHEMA_LOCATION = DEFAULT_SCHEMA_LOCATION_VERSION_2_3_1;
// Top level...
public static final String NEUROML_ROOT = "neuroml";
diff --git a/src/main/resources/bindings/NeuroML_v2.3.1.xjb b/src/main/resources/bindings/NeuroML_v2.3.1.xjb
new file mode 100644
index 00000000..8ddb502b
--- /dev/null
+++ b/src/main/resources/bindings/NeuroML_v2.3.1.xjb
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 35e9c04b404ecda3e3c741e894ea55ed3f6c76f6 Mon Sep 17 00:00:00 2001
From: pgleeson
Date: Wed, 1 May 2024 11:12:29 +0100
Subject: [PATCH 02/10] Test on java 21
---
.github/workflows/ci.yml | 11 ++++++++---
.github/workflows/javadocs.yml | 11 ++++++-----
pom.xml | 4 ++--
3 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 53c66677..0c40c61d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -16,14 +16,19 @@ jobs:
strategy:
fail-fast: false
matrix:
- java: [ '8', '11', '16', '17', '19' ]
+ java: [ '8', '11', '16', '17', '19', '21' ]
runs-on: [ubuntu-latest, macos-latest, windows-latest]
+ exclude:
+ - runs-on: macos-latest
+ java: "8"
+ - runs-on: macos-latest
+ java: "16"
name: Test on Java ${{ matrix.Java }} on ${{ matrix.runs-on }}
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.Java }}
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
java-version: ${{ matrix.Java }}
distribution: 'temurin'
diff --git a/.github/workflows/javadocs.yml b/.github/workflows/javadocs.yml
index df4fda2e..226a1cde 100644
--- a/.github/workflows/javadocs.yml
+++ b/.github/workflows/javadocs.yml
@@ -9,16 +9,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
- name: Set up JDK 17
- uses: actions/setup-java@v1
+ uses: actions/setup-java@v4
with:
java-version: 17
java-package: jdk
+ distribution: 'temurin'
- name: Set up Python 3.9
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v5
with:
python-version: 3.9
@@ -28,14 +29,14 @@ jobs:
pip install ghp-import
- name: Checkout NeuroML2
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
with:
repository: NeuroML/NeuroML2
ref: development
path: NeuroML2
- name: Checkout org.neuroml.model.injectingplugin
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
with:
repository: NeuroML/org.neuroml.model.injectingplugin
ref: development
diff --git a/pom.xml b/pom.xml
index 66d5f1b8..6d88b38f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -158,8 +158,8 @@
maven-compiler-plugin
3.0
-
- 1.7
+
+ 1.8
From 6e7a41a2f0c350376d2b7801b5ea5354bcb5e604 Mon Sep 17 00:00:00 2001
From: pgleeson
Date: Wed, 1 May 2024 11:20:22 +0100
Subject: [PATCH 03/10] Install HDF5 on macos-latest (v14)
---
.github/workflows/ci.yml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 0c40c61d..72fe3570 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -33,6 +33,11 @@ jobs:
java-version: ${{ matrix.Java }}
distribution: 'temurin'
+ - name: Install HDF5 on macos-latest (v14)
+ if: ${{ matrix.runs-on == 'macos-latest' }}
+ run: |
+ brew install hdf5
+
- name: Install and test (non Win)
env:
main_repo_branch: ${GITHUB_REF_NAME}
From e9d6a4c7d80a5949fa9d810188f3cf2df1b20362 Mon Sep 17 00:00:00 2001
From: pgleeson
Date: Wed, 1 May 2024 11:25:34 +0100
Subject: [PATCH 04/10] Just tets on macos-12
---
.github/workflows/ci.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 72fe3570..c9957d9f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
java: [ '8', '11', '16', '17', '19', '21' ]
- runs-on: [ubuntu-latest, macos-latest, windows-latest]
+ runs-on: [ubuntu-latest, macos-12, windows-latest]
exclude:
- runs-on: macos-latest
java: "8"
From 23132a9c4d545f0fcac31c0088afd36f015b9d0c Mon Sep 17 00:00:00 2001
From: pgleeson
Date: Wed, 29 May 2024 14:19:32 +0100
Subject: [PATCH 05/10] Changes to correctly validate cells with external
morph/biophys
e.g.
---
.../org/neuroml/model/util/CellUtils.java | 41 ++++++++++++++-
.../neuroml/model/util/NeuroML2Validator.java | 51 +++++++++++++------
2 files changed, 75 insertions(+), 17 deletions(-)
diff --git a/src/main/java/org/neuroml/model/util/CellUtils.java b/src/main/java/org/neuroml/model/util/CellUtils.java
index 5d6527a9..a1f82193 100644
--- a/src/main/java/org/neuroml/model/util/CellUtils.java
+++ b/src/main/java/org/neuroml/model/util/CellUtils.java
@@ -13,6 +13,8 @@
import org.neuroml.model.Point3DWithDiam;
import org.neuroml.model.Segment;
import org.neuroml.model.SegmentGroup;
+import org.neuroml.model.Morphology;
+import org.neuroml.model.BiophysicalProperties;
/**
*
@@ -44,6 +46,41 @@ public static boolean hasUnbranchedNonOverlappingInfo(Cell cell)
return false;
}
+ public static Morphology getCellMorphology(Cell cell, NeuroMLDocument nml2doc) {
+
+ if (cell.getMorphology()!=null) {
+
+ return cell.getMorphology();
+ }
+
+ else if (cell.getMorphologyAttr() !=null)
+ {
+ for (Morphology m: nml2doc.getMorphology()) {
+ if (m.getId().equals(cell.getMorphologyAttr()))
+ return m;
+ }
+ }
+ return null;
+ }
+
+ public static BiophysicalProperties getCellBiophysicalProperties(Cell cell, NeuroMLDocument nml2doc) {
+
+ if (cell.getBiophysicalProperties()!=null) {
+
+ return cell.getBiophysicalProperties();
+ }
+
+ else if (cell.getBiophysicalPropertiesAttr() !=null)
+ {
+ for (BiophysicalProperties bp: nml2doc.getBiophysicalProperties()) {
+ if (bp.getId().equals(cell.getBiophysicalPropertiesAttr()))
+ return bp;
+ }
+ }
+ return null;
+ }
+
+
public static LinkedHashMap getIdsVsSegments(Cell cell) {
LinkedHashMap idsVsSegments = new LinkedHashMap();
@@ -240,9 +277,9 @@ public static void main(String[] args) throws Exception {
String test = "/Users/padraig/neuroConstruct/osb/cerebral_cortex/networks/ACnet2/neuroConstruct/generatedNeuroML2/pyr_4_sym.cell.nml";
test = "/Users/padraig/git/GoC_Varied_Inputs/Cells/Golgi/GoC.cell.nml";
//test = "/home/padraig/neuroConstruct/osb/cerebral_cortex/networks/ACnet2/neuroConstruct/generatedNeuroML2/bask_soma.cell.nml";
- NeuroMLDocument nml2 = conv.loadNeuroML(new File(test));
+ NeuroMLDocument nml2doc = conv.loadNeuroML(new File(test));
- Cell cell = nml2.getCell().get(0);
+ Cell cell = nml2doc.getCell().get(0);
System.out.println("cell: " + cell.getId());
LinkedHashMap ids = getIdsVsSegments(cell);
diff --git a/src/main/java/org/neuroml/model/util/NeuroML2Validator.java b/src/main/java/org/neuroml/model/util/NeuroML2Validator.java
index 625da19e..d76bbb98 100644
--- a/src/main/java/org/neuroml/model/util/NeuroML2Validator.java
+++ b/src/main/java/org/neuroml/model/util/NeuroML2Validator.java
@@ -40,6 +40,8 @@
import org.neuroml.model.SegmentGroup;
import org.neuroml.model.Species;
import org.neuroml.model.Standalone;
+import org.neuroml.model.Morphology;
+import org.neuroml.model.BiophysicalProperties;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
@@ -139,22 +141,22 @@ public void validateWithTests(File xmlFile) throws SAXException, IOException, Ne
return;
}
NeuroMLConverter conv = new NeuroMLConverter();
- NeuroMLDocument nml2 = conv.loadNeuroML(xmlFile, true, false);
- validateWithTests(nml2);
+ NeuroMLDocument nml2doc = conv.loadNeuroML(xmlFile, true, false);
+ validateWithTests(nml2doc);
}
/*
* TODO: Needs to be moved to a separate package for validation!
*/
- public void validateWithTests(NeuroMLDocument nml2) throws NeuroMLException
+ public void validateWithTests(NeuroMLDocument nml2doc) throws NeuroMLException
{
// Checks the areas the Schema just can't reach...
//////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////
- for (IncludeType include: nml2.getInclude()) {
+ for (IncludeType include: nml2doc.getInclude()) {
File inclFile = new File(baseDirectory, include.getHref());
test(TEST_INCLUDED_FILES_EXIST, "Included file: "+include.getHref()
@@ -164,7 +166,7 @@ public void validateWithTests(NeuroMLDocument nml2) throws NeuroMLException
LinkedHashMap standalones = null;
try
{
- standalones = NeuroMLConverter.getAllStandaloneElements(nml2);
+ standalones = NeuroMLConverter.getAllStandaloneElements(nml2doc);
}
catch (NeuroMLException ne)
{
@@ -186,7 +188,7 @@ public void validateWithTests(NeuroMLDocument nml2) throws NeuroMLException
//////////////////////////////////////////////////////////////////
HashMap> cellidsVsSegs = new HashMap>();
- for (Cell cell: nml2.getCell()){
+ for (Cell cell: nml2doc.getCell()){
// Morphologies
ArrayList segIds = new ArrayList();
@@ -194,8 +196,10 @@ public void validateWithTests(NeuroMLDocument nml2) throws NeuroMLException
boolean rootFound = false;
int numParentless = 0;
- if (cell.getMorphology() != null) {
- for(Segment segment: cell.getMorphology().getSegment()) {
+ Morphology morphology = CellUtils.getCellMorphology(cell, nml2doc);
+
+ if (morphology != null) {
+ for(Segment segment: morphology.getSegment()) {
int segId = segment.getId();
test(TEST_REPEATED_IDS, "Current segment ID: "+segId, !segIds.contains(segId));
@@ -212,7 +216,7 @@ public void validateWithTests(NeuroMLDocument nml2) throws NeuroMLException
test(WARN_ROOT_ID_0, "", rootFound);
test(TEST_ONE_SEG_MISSING_PARENT, "", (numParentless==1));
- for(SegmentGroup segmentGroup: cell.getMorphology().getSegmentGroup()) {
+ for(SegmentGroup segmentGroup: morphology.getSegmentGroup()) {
test(TEST_REPEATED_GROUPS, "SegmentGroup: "+segmentGroup.getId(), !segGroups.contains(segmentGroup.getId()));
@@ -245,7 +249,7 @@ public void validateWithTests(NeuroMLDocument nml2) throws NeuroMLException
}
}
- for(SegmentGroup segmentGroup: cell.getMorphology().getSegmentGroup()) {
+ for(SegmentGroup segmentGroup: morphology.getSegmentGroup()) {
segGroups.add(segmentGroup.getId());
for (Include inc: segmentGroup.getInclude()) {
// This second time time, all segment groups are known, so fail if included group missing
@@ -257,8 +261,10 @@ public void validateWithTests(NeuroMLDocument nml2) throws NeuroMLException
//TODO: test for morphology attribute!
}
- if (cell.getBiophysicalProperties()!=null) {
- MembraneProperties mp = cell.getBiophysicalProperties().getMembraneProperties();
+ BiophysicalProperties bp = CellUtils.getCellBiophysicalProperties(cell, nml2doc);
+
+ if (bp!=null) {
+ MembraneProperties mp = bp.getMembraneProperties();
//TODO: consolidate!
for (ChannelDensity cd: mp.getChannelDensity()) {
@@ -292,7 +298,7 @@ public void validateWithTests(NeuroMLDocument nml2) throws NeuroMLException
test(TEST_ION_CHANNEL_EXISTS, "Ion channel: "+cd.getIonChannel()+" in "+cd.getId()+" not found!", standaloneIds.contains(cd.getIonChannel()));
}
- IntracellularProperties ip = cell.getBiophysicalProperties().getIntracellularProperties();
+ IntracellularProperties ip = bp.getIntracellularProperties();
for (Species sp: ip.getSpecies()) {
/* See PospischilEtAl2008/NeuroML2/cells/LTS/LTS.cell.nml for example.
@@ -306,7 +312,7 @@ public void validateWithTests(NeuroMLDocument nml2) throws NeuroMLException
}
- for (Network network: nml2.getNetwork()) {
+ for (Network network: nml2doc.getNetwork()) {
ArrayList allNetElementIds = new ArrayList();
//////////////////////////////////////////////////////////////////
@@ -463,6 +469,18 @@ public void validateWithTests(NeuroMLDocument nml2) throws NeuroMLException
if (warnings.length()==0)
warnings.append(NO_WARNINGS);
+
+ String testFail = "failed!";
+ if (validity.indexOf(testFail)>=0)
+ {
+
+ int num = (validity.length() - validity.toString().replaceAll(testFail,"").length())/testFail.length();
+ if (num==1)
+ validity.append("\n1 failure in validation!");
+ else
+ validity.append("\n"+num+" failures in validation!");
+ }
+
}
@@ -539,7 +557,10 @@ public static void testValidity(File xmlFile, StreamSource schemaFileSource) thr
public static void main(String[] args) throws Exception {
- File f = new File("../neuroConstruct/osb/showcase/BlueBrainProjectShowcase/NMC/NeuroML2/CaDynamics_E2_NML2.nml");
+ //File f = new File("../git/morphology_include/pyr_soma_m_in_b_in.cell.nml");
+ //File f = new File("../git/morphology_include/pyr_soma_m_out_b_in.cell.nml");
+ //File f = new File("../git/morphology_include/pyr_soma_m_in_b_out.cell.nml");
+ File f = new File("../git/morphology_include/pyr_soma_m_out_b_out.cell.nml");
//File f = new File("../neuroConstruct/osb/cerebral_cortex/networks/ACnet2/neuroConstruct/generatedNeuroML2/pyr_4_sym.cell.nml");
//File f = new File("../neuroConstruct/osb/cerebral_cortex/networks/ACnet2/neuroConstruct/generatedNeuroML2/MediumNet.net.nml");
//File f = new File("../OpenCortex/examples/Deterministic.net.nml");
From 72c56e10b060a55665bef7f69014e3e8ccc4422b Mon Sep 17 00:00:00 2001
From: pgleeson
Date: Fri, 31 May 2024 10:11:34 +0100
Subject: [PATCH 06/10] Improved handling of cells with external
morphology/biophysics
---
.../org/neuroml/model/util/CellUtils.java | 157 +++++++++++++-----
.../neuroml/model/util/NeuroML2Validator.java | 3 +-
2 files changed, 121 insertions(+), 39 deletions(-)
diff --git a/src/main/java/org/neuroml/model/util/CellUtils.java b/src/main/java/org/neuroml/model/util/CellUtils.java
index a1f82193..61ec8f99 100644
--- a/src/main/java/org/neuroml/model/util/CellUtils.java
+++ b/src/main/java/org/neuroml/model/util/CellUtils.java
@@ -34,9 +34,16 @@ public static boolean isUnbranchedNonOverlapping(SegmentGroup sg) {
sg.getNeuroLexId().equals(NEUROML2_NEUROLEX_UNBRANCHED_NONOVERLAPPING_SEG_GROUP);
}
- public static boolean hasUnbranchedNonOverlappingInfo(Cell cell)
+ @Deprecated
+ public static boolean hasUnbranchedNonOverlappingInfo(Cell cell) throws NeuroMLException
{
- for (SegmentGroup sg : cell.getMorphology().getSegmentGroup())
+ return hasUnbranchedNonOverlappingInfo(cell, null);
+ }
+
+ public static boolean hasUnbranchedNonOverlappingInfo(Cell cell, NeuroMLDocument nml2doc) throws NeuroMLException {
+
+ Morphology morphology = getCellMorphology(cell, nml2doc);
+ for (SegmentGroup sg : morphology.getSegmentGroup())
{
if (isUnbranchedNonOverlapping(sg))
{
@@ -46,21 +53,26 @@ public static boolean hasUnbranchedNonOverlappingInfo(Cell cell)
return false;
}
- public static Morphology getCellMorphology(Cell cell, NeuroMLDocument nml2doc) {
+ public static Morphology getCellMorphology(Cell cell, NeuroMLDocument nml2doc) throws NeuroMLException {
if (cell.getMorphology()!=null) {
-
return cell.getMorphology();
}
-
else if (cell.getMorphologyAttr() !=null)
- {
- for (Morphology m: nml2doc.getMorphology()) {
+ {
+ for (Morphology m: nml2doc.getMorphology())
+ {
if (m.getId().equals(cell.getMorphologyAttr()))
return m;
}
- }
- return null;
+ throw new NeuroMLException("Cannot find morphology: "+cell.getMorphologyAttr()+" specified as an attribute in cell: "+cell.getId());
+ }
+ else if (nml2doc==null)
+ {
+ return null;
+ // Cannot get any morphology attribute
+ }
+ return null; // may be expected...
}
public static BiophysicalProperties getCellBiophysicalProperties(Cell cell, NeuroMLDocument nml2doc) {
@@ -80,7 +92,10 @@ else if (cell.getBiophysicalPropertiesAttr() !=null)
return null;
}
-
+ /**
+ * @deprecated use LinkedHashMap getIdsVsSegments(Cell cell, NeuroMLDocument nml2doc) instead.
+ */
+ @Deprecated
public static LinkedHashMap getIdsVsSegments(Cell cell) {
LinkedHashMap idsVsSegments = new LinkedHashMap();
@@ -90,6 +105,16 @@ public static LinkedHashMap getIdsVsSegments(Cell cell) {
return idsVsSegments;
}
+ public static LinkedHashMap getIdsVsSegments(Cell cell, NeuroMLDocument nml2doc) throws NeuroMLException {
+
+ LinkedHashMap idsVsSegments = new LinkedHashMap();
+ Morphology morphology = getCellMorphology(cell, nml2doc);
+ for (Segment seg : morphology.getSegment()) {
+ idsVsSegments.put(seg.getId(), seg);
+ }
+ return idsVsSegments;
+ }
+
public static SegmentGroup getSegmentGroup(Cell cell, String id) throws NeuroMLException {
for (SegmentGroup sg: cell.getMorphology().getSegmentGroup()) {
if (sg.getId().equals(id))
@@ -98,8 +123,13 @@ public static SegmentGroup getSegmentGroup(Cell cell, String id) throws NeuroMLE
throw new NeuroMLException("No SegmentGroup with id: "+id+" in cell with id: "+cell.getId());
}
+ @Deprecated
public static Segment getSegmentWithId(Cell cell, int segmentId) throws NeuroMLException {
- List segments = cell.getMorphology().getSegment();
+ return getSegmentWithId(cell, null, segmentId);
+ }
+
+ public static Segment getSegmentWithId(Cell cell, NeuroMLDocument nml2doc, int segmentId) throws NeuroMLException {
+ List segments = getCellMorphology(cell, nml2doc).getSegment();
if (segments.size()>segmentId) {
Segment guess = segments.get(segmentId);
if (guess.getId()==segmentId)
@@ -112,16 +142,21 @@ public static Segment getSegmentWithId(Cell cell, int segmentId) throws NeuroMLE
throw new NeuroMLException("No Segment with id: "+segmentId+" in cell with id: "+cell.getId());
}
- public static LinkedHashMap getNamesVsSegmentGroups(Cell cell) {
+ public static LinkedHashMap getNamesVsSegmentGroups(Cell cell, NeuroMLDocument nml2doc) throws NeuroMLException {
LinkedHashMap namesVsSegmentGroups = new LinkedHashMap();
- for (SegmentGroup sg : cell.getMorphology().getSegmentGroup()) {
+ for (SegmentGroup sg : getCellMorphology(cell, nml2doc).getSegmentGroup()) {
namesVsSegmentGroups.put(sg.getId(), sg);
}
return namesVsSegmentGroups;
}
- public static ArrayList getSegmentIdsInGroup(Cell cell, String segmentGroup) {
+ public static LinkedHashMap getNamesVsSegmentGroups(Cell cell) throws NeuroMLException {
+
+ return getNamesVsSegmentGroups(cell, null);
+ }
+
+ public static ArrayList getSegmentIdsInGroup(Cell cell, String segmentGroup) throws NeuroMLException {
for (SegmentGroup sg : cell.getMorphology().getSegmentGroup()) {
if (sg.getId().equals(segmentGroup)) {
@@ -158,34 +193,45 @@ public static boolean hasSegmentGroup(Cell cell, String segmentGroup) {
return false;
}
+ @Deprecated
public static ArrayList getSegmentsInGroup(Cell cell, String segmentGroup) throws NeuroMLException {
+ return getSegmentsInGroup(cell, null, segmentGroup);
+ }
- for (SegmentGroup sg : cell.getMorphology().getSegmentGroup()) {
+ public static ArrayList getSegmentsInGroup(Cell cell, NeuroMLDocument nml2doc, String segmentGroup) throws NeuroMLException {
+
+ for (SegmentGroup sg : CellUtils.getCellMorphology(cell, nml2doc).getSegmentGroup()) {
if (sg.getId().equals(segmentGroup)) {
- LinkedHashMap namesVsSegmentGroups = getNamesVsSegmentGroups(cell);
- return getSegmentsInGroup(cell, namesVsSegmentGroups, sg);
+ LinkedHashMap namesVsSegmentGroups = getNamesVsSegmentGroups(cell, nml2doc);
+ return getSegmentsInGroup(cell, nml2doc, namesVsSegmentGroups, sg);
}
}
throw new NeuroMLException("No SegmentGroup: "+segmentGroup+" in cell with id: "+cell.getId());
}
+
public static ArrayList getSegmentsInGroup(Cell cell, LinkedHashMap namesVsSegmentGroups, SegmentGroup segmentGroup) throws NeuroMLException {
+ return getSegmentsInGroup(cell, null, namesVsSegmentGroups, segmentGroup);
+ }
+
+ public static ArrayList getSegmentsInGroup(Cell cell, NeuroMLDocument nml2doc, LinkedHashMap namesVsSegmentGroups, SegmentGroup segmentGroup) throws NeuroMLException {
+
ArrayList segsHere = new ArrayList();
for (Member memb : segmentGroup.getMember()) {
- segsHere.add(getSegmentWithId(cell, memb.getSegment()));
+ segsHere.add(getSegmentWithId(cell, nml2doc, memb.getSegment()));
}
for (Include inc : segmentGroup.getInclude()) {
String sg = inc.getSegmentGroup();
- ArrayList segs = getSegmentsInGroup(cell, namesVsSegmentGroups, namesVsSegmentGroups.get(sg));
+ ArrayList segs = getSegmentsInGroup(cell, nml2doc, namesVsSegmentGroups, namesVsSegmentGroups.get(sg));
segsHere.addAll(segs);
}
return segsHere;
}
- public static LinkedHashMap> getSegmentGroupsVsSegIds(Cell cell) {
+ public static LinkedHashMap> getSegmentGroupsVsSegIds(Cell cell) throws NeuroMLException {
LinkedHashMap> sgVsSegId = new LinkedHashMap>();
@@ -199,13 +245,33 @@ public static LinkedHashMap> getSegmentGroupsVs
return sgVsSegId;
}
+ public static LinkedHashMap> getSegmentGroupsVsSegIds(Cell cell, NeuroMLDocument nml2doc) throws NeuroMLException {
+
+ LinkedHashMap> sgVsSegId = new LinkedHashMap>();
+
+ Morphology morphology = getCellMorphology(cell, nml2doc);
+
+ LinkedHashMap namesVsSegmentGroups = getNamesVsSegmentGroups(cell, nml2doc);
+
+ for (SegmentGroup sg : morphology.getSegmentGroup()) {
+ ArrayList segsHere = getSegmentIdsInGroup(namesVsSegmentGroups, sg);
+ sgVsSegId.put(sg, segsHere);
+ }
+
+ return sgVsSegId;
+ }
+
public static double distance(Point3DWithDiam p, Point3DWithDiam d) {
return Math.sqrt( Math.pow(p.getX()-d.getX(),2) + Math.pow(p.getY()-d.getY(),2) + Math.pow(p.getZ()-d.getZ(),2) );
}
public static double getFractionAlongSegGroupLength(Cell cell, String segmentGroup, int segmentId, float fractAlongSegment) throws NeuroMLException {
+ return getFractionAlongSegGroupLength(cell, null, segmentGroup, segmentId, fractAlongSegment);
+ }
+
+ public static double getFractionAlongSegGroupLength(Cell cell, NeuroMLDocument nml2doc, String segmentGroup, int segmentId, float fractAlongSegment) throws NeuroMLException {
- ArrayList segs = getSegmentsInGroup(cell, segmentGroup);
+ ArrayList segs = getSegmentsInGroup(cell, nml2doc, segmentGroup);
if (segs.size()==1)
{
if(segs.get(0).getId()!=segmentId)
@@ -272,30 +338,45 @@ public static double getFractionAlongSegGroupLength(Cell cell, String segmentGro
public static void main(String[] args) throws Exception {
NeuroMLConverter conv = new NeuroMLConverter();
- //String test = "/home/padraig/neuroConstruct/osb/cerebral_cortex/networks/ACnet2/neuroConstruct/generatedNeuroML2/bask.cell.nml";
+
+
+ ArrayList cellFiles = new ArrayList();
+ cellFiles.add("../neuroConstruct/osb/cerebral_cortex/networks/ACnet2/neuroConstruct/generatedNeuroML2/bask.cell.nml");
//String test = "/home/padraig/neuroConstruct/osb/hippocampus/networks/nc_superdeep/neuroConstruct/generatedNeuroML2/pvbasketcell.cell.nml";
- String test = "/Users/padraig/neuroConstruct/osb/cerebral_cortex/networks/ACnet2/neuroConstruct/generatedNeuroML2/pyr_4_sym.cell.nml";
- test = "/Users/padraig/git/GoC_Varied_Inputs/Cells/Golgi/GoC.cell.nml";
+ cellFiles.add("../neuroConstruct/osb/cerebral_cortex/networks/ACnet2/neuroConstruct/generatedNeuroML2/pyr_4_sym.cell.nml");
+ //test = "/Users/padraig/git/GoC_Varied_Inputs/Cells/Golgi/GoC.cell.nml";
//test = "/home/padraig/neuroConstruct/osb/cerebral_cortex/networks/ACnet2/neuroConstruct/generatedNeuroML2/bask_soma.cell.nml";
- NeuroMLDocument nml2doc = conv.loadNeuroML(new File(test));
- Cell cell = nml2doc.getCell().get(0);
- System.out.println("cell: " + cell.getId());
+ cellFiles.add("../git/morphology_include/pyr_soma_m_out_b_in.cell.nml");
- LinkedHashMap ids = getIdsVsSegments(cell);
+ for(String cellFile : cellFiles)
+ {
+ NeuroMLDocument nml2doc = conv.loadNeuroML(new File(cellFile), true, true);
- System.out.println("getIdsVsSegments: ");
- for (Integer id: ids.keySet()) {
- System.out.println("ID "+id+": "+ids.get(id));
- }
+ Cell cell = nml2doc.getCell().get(0);
+ System.out.println("-------- Cell loaded: " + cell.getId()+" from "+cellFile);
+
+ LinkedHashMap ids = getIdsVsSegments(cell, nml2doc);
- LinkedHashMap> sgVsSegId = getSegmentGroupsVsSegIds(cell);
- for (SegmentGroup sg: sgVsSegId.keySet()) {
- System.out.println("SG "+sg.getId()+": "+sgVsSegId.get(sg));
+ System.out.println("getIdsVsSegments: ");
+ for (Integer id: ids.keySet()) {
+ System.out.println("ID "+id+": "+ids.get(id));
+ }
+
+ System.out.println("hasUnbranchedNonOverlappingInfo: "+hasUnbranchedNonOverlappingInfo(cell, nml2doc));
+ System.out.println("getSegmentWithId: "+getSegmentWithId(cell, nml2doc, 0));
+
+ System.out.println("getSegmentsInGroup: "+getSegmentsInGroup(cell, nml2doc, "soma_group"));
+
+ System.out.println("getFractionAlongSegGroupLength: "+getFractionAlongSegGroupLength(cell, nml2doc, "soma_group", 0, 0.1f));
+
+ LinkedHashMap> sgVsSegId = getSegmentGroupsVsSegIds(cell, nml2doc);
+ for (SegmentGroup sg: sgVsSegId.keySet()) {
+ System.out.println("SG "+sg.getId()+": "+sgVsSegId.get(sg));
+ }
+ //getFractionAlongSegGroupLength(cell, "basal2", 8, 0.1f);
+ //getFractionAlongSegGroupLength(cell, "some_apicals", 2, 0.5f);
}
- getFractionAlongSegGroupLength(cell, "soma_group", 0, 0.1f);
- //getFractionAlongSegGroupLength(cell, "basal2", 8, 0.1f);
- //getFractionAlongSegGroupLength(cell, "some_apicals", 2, 0.5f);
}
diff --git a/src/main/java/org/neuroml/model/util/NeuroML2Validator.java b/src/main/java/org/neuroml/model/util/NeuroML2Validator.java
index d76bbb98..63978f70 100644
--- a/src/main/java/org/neuroml/model/util/NeuroML2Validator.java
+++ b/src/main/java/org/neuroml/model/util/NeuroML2Validator.java
@@ -560,7 +560,8 @@ public static void main(String[] args) throws Exception {
//File f = new File("../git/morphology_include/pyr_soma_m_in_b_in.cell.nml");
//File f = new File("../git/morphology_include/pyr_soma_m_out_b_in.cell.nml");
//File f = new File("../git/morphology_include/pyr_soma_m_in_b_out.cell.nml");
- File f = new File("../git/morphology_include/pyr_soma_m_out_b_out.cell.nml");
+ //File f = new File("../git/morphology_include/pyr_soma_m_out_b_out.cell.nml");
+ File f = new File("../NeuroML2/examples/NML2_FullNeuroML.nml");
//File f = new File("../neuroConstruct/osb/cerebral_cortex/networks/ACnet2/neuroConstruct/generatedNeuroML2/pyr_4_sym.cell.nml");
//File f = new File("../neuroConstruct/osb/cerebral_cortex/networks/ACnet2/neuroConstruct/generatedNeuroML2/MediumNet.net.nml");
//File f = new File("../OpenCortex/examples/Deterministic.net.nml");
From fff5ec67720f5e320025b7ca7cfcb04801b7a7d8 Mon Sep 17 00:00:00 2001
From: pgleeson
Date: Tue, 11 Jun 2024 11:15:39 +0100
Subject: [PATCH 07/10] Fix issue in javadoc generation
---
src/main/java/org/neuroml/model/util/CellUtils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/neuroml/model/util/CellUtils.java b/src/main/java/org/neuroml/model/util/CellUtils.java
index 61ec8f99..06d54627 100644
--- a/src/main/java/org/neuroml/model/util/CellUtils.java
+++ b/src/main/java/org/neuroml/model/util/CellUtils.java
@@ -93,7 +93,7 @@ else if (cell.getBiophysicalPropertiesAttr() !=null)
}
/**
- * @deprecated use LinkedHashMap getIdsVsSegments(Cell cell, NeuroMLDocument nml2doc) instead.
+ * @deprecated use getIdsVsSegments(Cell cell, NeuroMLDocument nml2doc) instead.
*/
@Deprecated
public static LinkedHashMap getIdsVsSegments(Cell cell) {
From ffd32eba82ef4b223dc3af9e3ec40e75a19ecc39 Mon Sep 17 00:00:00 2001
From: Padraig Gleeson
Date: Tue, 11 Jun 2024 12:00:27 +0100
Subject: [PATCH 08/10] To v1.10.1
---
pom.xml | 10 +++++-----
.../java/org/neuroml/model/util/NeuroMLElements.java | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/pom.xml b/pom.xml
index 6d88b38f..2e0613db 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
org.neuroml.model
org.neuroml.model
- 1.10.0
+ 1.10.1
bundle
2.3.1
@@ -19,12 +19,12 @@
org.neuroml.model.injectingplugin
org.neuroml.model.injectingplugin
- 1.10.0
+ 1.10.1
org.neuroml.core
neuroml2-base-definitions
- 1.10.0
+ 1.10.1
@@ -105,7 +105,7 @@
- org.neuroml.core:neuroml2-base-definitions:1.10.0
+ org.neuroml.core:neuroml2-base-definitions:1.10.1
@@ -198,7 +198,7 @@
org.neuroml.model.injectingplugin
org.neuroml.model.injectingplugin
- 1.10.0
+ 1.10.1
diff --git a/src/main/java/org/neuroml/model/util/NeuroMLElements.java b/src/main/java/org/neuroml/model/util/NeuroMLElements.java
index ae85b3b9..2673433a 100644
--- a/src/main/java/org/neuroml/model/util/NeuroMLElements.java
+++ b/src/main/java/org/neuroml/model/util/NeuroMLElements.java
@@ -2,7 +2,7 @@
public class NeuroMLElements {
- public static final String ORG_NEUROML_MODEL_VERSION = "1.10.0";
+ public static final String ORG_NEUROML_MODEL_VERSION = "1.10.1";
public static final String NAMESPACE_URI_VERSION_2 = "http://www.neuroml.org/schema/neuroml2";
From 2fbedb8693ea2a8e05d77aeee3e10168af224945 Mon Sep 17 00:00:00 2001
From: Padraig Gleeson
Date: Tue, 11 Jun 2024 12:16:46 +0100
Subject: [PATCH 09/10] Fix javadocs
---
.github/workflows/javadocs.yml | 4 ++--
pom.xml | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/javadocs.yml b/.github/workflows/javadocs.yml
index 226a1cde..366be122 100644
--- a/.github/workflows/javadocs.yml
+++ b/.github/workflows/javadocs.yml
@@ -32,14 +32,14 @@ jobs:
uses: actions/checkout@v4
with:
repository: NeuroML/NeuroML2
- ref: development
+ ref: ${{ github.ref }}
path: NeuroML2
- name: Checkout org.neuroml.model.injectingplugin
uses: actions/checkout@v4
with:
repository: NeuroML/org.neuroml.model.injectingplugin
- ref: development
+ ref: ${{ github.ref }}
path: org.neuroml.model.injectingplugin
- name: Install NeuroML deps
diff --git a/pom.xml b/pom.xml
index 2e0613db..d783f870 100644
--- a/pom.xml
+++ b/pom.xml
@@ -64,7 +64,7 @@
<br />
<br />
- Copyright NeuroML Contributors 2023
+ Copyright NeuroML Contributors 2024
|
From ed0c4b5704c50993e3f8917aa5bc887fc4f1385f Mon Sep 17 00:00:00 2001
From: pgleeson
Date: Thu, 13 Jun 2024 13:36:39 +0100
Subject: [PATCH 10/10] Add string for CELL_2CA_POOLS_COMP_TYPE
---
src/main/java/org/neuroml/model/util/NeuroMLElements.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/main/java/org/neuroml/model/util/NeuroMLElements.java b/src/main/java/org/neuroml/model/util/NeuroMLElements.java
index 2673433a..ad0a3111 100644
--- a/src/main/java/org/neuroml/model/util/NeuroMLElements.java
+++ b/src/main/java/org/neuroml/model/util/NeuroMLElements.java
@@ -47,6 +47,7 @@ public class NeuroMLElements {
public static final String BASE_RATE_UNIT = "baseRateUnit";
public static final String CELL_COMP_TYPE = "cell";
+ public static final String CELL_2CA_POOLS_COMP_TYPE = "cell2CaPools";
public static final String BASE_COND_SCALING_CA = "baseConductanceScalingCaDependent";