Skip to content

Commit

Permalink
use compartment for @reaction in DOT
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Metelkin committed Dec 22, 2023
1 parent a0b5af8 commit e724667
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
- checking legal functions inside Expressions and functionDefinition
- `#defineFunction`: circular dependences within functions, internal functions, different exports, functionDef vs units
- write reusable `Build` class
- remove `isAmount`, `compartment` properties from `@Reaction`
- remove `isAmount` properties from `@Reaction`

## ideas

Expand Down
8 changes: 5 additions & 3 deletions src/dot-export/namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ Namespace.prototype.getDotImage = function() {
let substrates = proc.actors.filter((x) => x.stoichiometry < 0);
// push records
proc.actors.forEach((actor) => {
let record = this.get(actor.target) || { id: actor.target }; // use fake record
let record = this.get(actor.target) || { id: actor.target }; // use target record or fake record for abstract NS
let compartmentId = record.compartment || '_';
clustersDict[compartmentId]?.push(record) || (clustersDict[compartmentId] = [record]);
});
// push process
let compartmentOfFirstSubstrate = this.get(substrates[0]?.target)?.compartment || '_';
clustersDict[compartmentOfFirstSubstrate]?.push(proc);
let compartmentOfReaction = proc.compartment // use explicit compartment, first substrate compartment, or empty
|| this.get(substrates[0]?.target)?.compartment
|| '_';
clustersDict[compartmentOfReaction]?.push(proc);
});
/* display all records
this.selectByInstanceOf('Record')
Expand Down

0 comments on commit e724667

Please sign in to comment.