NeuroML / jNeuroML

A single package (command line tool and library) in Java to validate, simulate, translate and analyse NeuroML 2 models
https://docs.neuroml.org/Userdocs/Software/jNeuroML.html
GNU Lesser General Public License v3.0
8 stars 20 forks source link

Validator does not find segmentgroups that are referenced before they are defined in the NML file #83

Closed sanjayankur31 closed 3 years ago

sanjayankur31 commented 3 years ago

Describe the bug A file where a segment group includes segment groups before they are defined in the file is valid NeuroML, but the validator reports that they're not defined, probably because it doesn't do a full pass of the doc before running tests.

To Reproduce On the attached NML file, run jnml -validate.

Expected behavior it should validate correctly

Observed behavior Does not validate correctly

System information:

Additional context

<neuroml xmlns="http://www.neuroml.org/schema/neuroml2"  xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 https://raw.github.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.1.xsd" id="oml_cell">
    <include href="olm-example/leak_chan.channel.nml"/>
    <include href="olm-example/HCNolm.channel.nml"/>
    <include href="olm-example/Kdrfast.channel.nml"/>
    <include href="olm-example/KvAolm.channel.nml"/>
    <include href="olm-example/Nav.channel.nml"/>
    <cell id="olm">
        <morphology id="morphology">
            <segment id="0" name="Seg0_soma_0">
                <proximal x="0.000000e+00" y="0.000000e+00" z="0.000000e+00" diameter="10.0"/>
                <distal x="0.000000e+00" y="1.000000e+01" z="0.000000e+00" diameter="10.0"/>
            </segment>
            <segment id="1" name="Seg1_soma_0">
                <parent segment="0"/>
                <distal x="0.000000e+00" y="2.000000e+01" z="0.000000e+00" diameter="10.0"/>
            </segment>
            <segment id="2" name="Seg1_axon_0">
                <parent segment="0" fractionAlong="0.0"/>
                <proximal x="0.000000e+00" y="0.000000e+00" z="0.000000e+00" diameter="1.5"/>
                <distal x="0.000000e+00" y="-7.500000e+01" z="0.000000e+00" diameter="1.5"/>
            </segment>
            <segment id="3" name="Seg1_axon_0">
                <parent segment="2"/>
                <distal x="0.000000e+00" y="-1.500000e+02" z="0.000000e+00" diameter="1.5"/>
            </segment>
            <segment id="4" name="Seg0_dend_0">
                <parent segment="1" fractionAlong="0.0"/>
                <proximal x="0.000000e+00" y="2.000000e+01" z="0.000000e+00" diameter="3.0"/>
                <distal x="1.000000e+02" y="1.200000e+02" z="0.000000e+00" diameter="3.0"/>
            </segment>
            <segment id="5" name="Seg0_dend_1">
                <parent segment="1"/>
                <proximal x="0.000000e+00" y="2.000000e+01" z="0.000000e+00" diameter="3.0"/>
                <distal x="-1.000000e+02" y="1.200000e+02" z="0.000000e+00" diameter="3.0"/>
            </segment>
            <segment id="6" name="Seg1_dend_0">
                <parent segment="4" fractionAlong="0.0"/>
                <distal x="1.770000e+02" y="1.970000e+02" z="0.000000e+00" diameter="3.0"/>
            </segment>
            <segment id="7" name="Seg1_dend_1">
                <parent segment="5" fractionAlong="0.0"/>
                <distal x="-1.770000e+02" y="1.970000e+02" z="0.000000e+00" diameter="3.0"/>
            </segment>
            <segmentGroup id="all">
                <member segment="0"/>
                <member segment="1"/>
                <member segment="2"/>
                <member segment="3"/>
                <member segment="4"/>
                <member segment="5"/>
                <member segment="6"/>
                <member segment="7"/>
            </segmentGroup>
            <segmentGroup neuroLexId="GO:0043025" id="soma_group">
                <notes>Default soma segment group for the cell</notes>
                <property tag="color" value="0 0 0.8"/>
                <include segmentGroup="soma_0"/>
            </segmentGroup>
            <segmentGroup neuroLexId="GO:0030424" id="axon_group">
                <notes>Default axon segment group for the cell</notes>
                <property tag="color" value="0 0.8 0"/>
                <include segmentGroup="axon_0"/>
            </segmentGroup>
            <segmentGroup neuroLexId="GO:0030425" id="dendrite_group">
                <notes>Default dendrite segment group for the cell</notes>
                <property tag="color" value="0.8 0 0"/>
                <include segmentGroup="dend_0"/>
                <include segmentGroup="dend_1"/>
            </segmentGroup>
            <segmentGroup neuroLexId="GO:0043025" id="soma_0">
                <member segment="0"/>
                <member segment="1"/>
            </segmentGroup>
            <segmentGroup neuroLexId="GO:0030424" id="axon_0">
                <member segment="2"/>
                <member segment="3"/>
            </segmentGroup>
            <segmentGroup neuroLexId="GO:0030425" id="dend_0">
                <member segment="4"/>
                <member segment="5"/>
            </segmentGroup>
            <segmentGroup neuroLexId="GO:0030425" id="dend_1">
                <member segment="6"/>
                <member segment="7"/>
            </segmentGroup>
        </morphology>
        <biophysicalProperties id="biophys">
            <membraneProperties>
                <channelDensity id="leak_all" ionChannel="leak_chan" condDensity="0.01 mS_per_cm2" erev="-67mV" ion="non_specific"/>
                <channelDensity id="HCNolm_soma" ionChannel="HCNolm" condDensity="0.5 mS_per_cm2" erev="-32.9mV" segmentGroup="soma_0" ion="h"/>
                <channelDensity id="Kdrfast_soma" ionChannel="Kdrfast" condDensity="73.37 mS_per_cm2" erev="-77mV" segmentGroup="soma_0" ion="k"/>
                <channelDensity id="Kdrfast_dendrite" ionChannel="Kdrfast" condDensity="105.8 mS_per_cm2" erev="-77mV" segmentGroup="dendrite_group" ion="k"/>
                <channelDensity id="Kdrfast_axon" ionChannel="Kdrfast" condDensity="117.392 mS_per_cm2" erev="-77mV" segmentGroup="axon_0" ion="k"/>
                <channelDensity id="KvAolm_soma" ionChannel="KvAolm" condDensity="4.95 mS_per_cm2" erev="-77mV" segmentGroup="soma_0" ion="k"/>
                <channelDensity id="KvAolm_dendrite" ionChannel="KvAolm" condDensity="2.8 mS_per_cm2" erev="-77mV" segmentGroup="dendrite_group" ion="k"/>
                <channelDensity id="Nav_soma" ionChannel="Nav" condDensity="10.7 mS_per_cm2" erev="50mV" segmentGroup="soma_0" ion="na"/>
                <channelDensity id="Nav_dendrite" ionChannel="Nav" condDensity="23.4 mS_per_cm2" erev="50mV" segmentGroup="dendrite_group" ion="na"/>
                <channelDensity id="Nav_axon" ionChannel="Nav" condDensity="17.12 mS_per_cm2" erev="50mV" segmentGroup="axon_0" ion="na"/>
                <specificCapacitance value="1.3 uF_per_cm2"/>
                <initMembPotential value="-67mV"/>
            </membraneProperties>
            <intracellularProperties>
                <resistivity value="0.15 kohm_cm"/>
            </intracellularProperties>
        </biophysicalProperties>
    </cell>
</neuroml>

gives:

$ jnml -validate ./olm.cell.nml 
 jNeuroML v0.10.3
Validating: /home/asinha/./olm.cell.nml
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.sun.xml.bind.v2.runtime.reflect.opt.Injector (file:/usr/share/java/jNeuroML-0.10.3.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Please consider reporting this to the maintainers of com.sun.xml.bind.v2.runtime.reflect.opt.Injector
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Valid against schema
  Test: 10005 (Segment Group used in the include element of segmentGroup should exist) failed! ... SegmentGroup: soma_group, includes: soma_0
  Test: 10005 (Segment Group used in the include element of segmentGroup should exist) failed! ... SegmentGroup: axon_group, includes: axon_0
  Test: 10005 (Segment Group used in the include element of segmentGroup should exist) failed! ... SegmentGroup: dendrite_group, includes: dend_0
  Test: 10005 (Segment Group used in the include element of segmentGroup should exist) failed! ... SegmentGroup: dendrite_group, includes: dend_1

(and other errors about missing include files.

pgleeson commented 3 years ago

@sanjayankur31 This is fixed in the commit mentioned above