Skip to content

Commit

Permalink
remove isAmount from reactio
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Metelkin committed Jan 25, 2024
1 parent f599d0e commit 2245823
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 16 deletions.
1 change: 0 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
- checking legal functions inside Expressions and functionDefinition
- `#defineFunction`: different exports, functionDef vs units
- write reusable `Build` class
- remove `isAmount` properties from `@Reaction`

## ideas

Expand Down
1 change: 0 additions & 1 deletion src/another-xlsx-export/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class AnotherXLSXExport extends XLSXExport {
.map((_q) => {
//q['#'] = counter++;
let q = {st: 'r', ..._q};
if (q.isAmount !== false) q.compartment = 'no';
delete q.class;
delete q.units;
delete q.units2;
Expand Down
8 changes: 2 additions & 6 deletions src/core/reaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const { UnitTerm } = require('./unit-term');
class Reaction extends Process {
constructor(isCore = false){
super(isCore);
this.isAmount = true;
this.modifiers = [];
}
merge(q = {}){
Expand All @@ -35,7 +34,6 @@ class Reaction extends Process {
}

if (q.compartment !== undefined) this.compartment = q.compartment;
if (q.isAmount !== undefined) this.isAmount = !!q.isAmount;
}

return this;
Expand All @@ -46,10 +44,9 @@ class Reaction extends Process {
clone(){
let clonedComponent = super.clone();

if (this.modifiers.length > 0)
if (this.modifiers.length > 0) {
clonedComponent.modifiers = this.modifiers.map((modifier) => modifier.clone());
if (typeof this.isAmount !== 'undefined')
clonedComponent.isAmount = this.isAmount;
}

return clonedComponent;
}
Expand All @@ -62,7 +59,6 @@ class Reaction extends Process {
}

if (this.compartment !== undefined) res.compartment = this.compartment;
if (this.isAmount !== true) res.isAmount = this.isAmount;

return res;
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/species.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class Species extends Record {
}
toQ(options = {}){
let res = super.toQ(options);
if(this.compartment) res.compartment = this.compartment;
if(this.isAmount) res.isAmount = this.isAmount;
if (this.compartment) res.compartment = this.compartment;
if (this.isAmount) res.isAmount = this.isAmount;
return res;
}
unitsSBML(){
Expand Down
4 changes: 0 additions & 4 deletions src/heta.json-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,6 @@
{ "$ref": "#/definitions/ID" }
]
}
},
"isAmount": { "enum": [true, false, 1, 0] },
"compartment": {
"$ref": "#/definitions/ID"
}
},
"errorMessage": {
Expand Down
2 changes: 1 addition & 1 deletion src/templates/dbsolve-model.slv.njk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% macro diff(backReferences = []) -%}
{% for br in backReferences|exclude2('stoichiometry', undefined) -%}
{% if br.stoichiometry > 0 and not loop.first %}+{% endif %}{{ br.stoichiometry + '*'}}{{ br.process }}{{ '' if br._process_.isAmount!==false else '*' + br._process_.compartment }}
{% if br.stoichiometry > 0 and not loop.first %}+{% endif %}{{ br.stoichiometry + '*'}}{{ br.process }}
{%- endfor %}
{%- endmacro %}
{%- set compartments = population.selectByClassName('Compartment') %}
Expand Down
2 changes: 1 addition & 1 deletion src/templates/slv-blocks-template.slv.njk
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ default_compartment_ = 1; // {units: UL} This is fake compartment to support com
=============================== RHS ================================
{% macro diff(backReferences=[]) -%}
{% for br in backReferences|exclude2('stoichiometry', undefined) -%}
{% if br.stoichiometry>0 and not loop.first %}+{% endif %}{{ br.stoichiometry + '*'}}{{ br.process }}{{ '' if br._process_.isAmount!==false else '*' + br._process_.compartment }}
{% if br.stoichiometry>0 and not loop.first %}+{% endif %}{{ br.stoichiometry + '*'}}{{ br.process }}
{%- endfor %}
{%- endmacro %}
{% block rhs %}
Expand Down

0 comments on commit 2245823

Please sign in to comment.