Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to set an SBO term for a function definition? #340

Closed
draeger opened this Issue Jan 31, 2018 · 13 comments

Comments

Projects
None yet
4 participants
@draeger
Copy link

draeger commented Jan 31, 2018

function relActFun(a)
  a + 2;
end

model m
  relActFun.sboTerm = SBO:0000487;

  // Rate Rules:
  a' = 7*relActFun(time);

  // Variable initializations:
  a = 5;

  // Other declarations:
  var a;
end

While other objects can be annotated using a syntax such as a.sboTerm = SBO:XXXX;, the line relActFun.sboTerm = SBO:0000487; causes an error. If I take it out, it works. So how to annotate a function in Antimony?

@0u812

This comment has been minimized.

Copy link
Member

0u812 commented Jan 31, 2018

Hi Andreas! I hadn’t thought of annotating functions. I’ll try to add that feature to the next release.

@draeger

This comment has been minimized.

Copy link
Author

draeger commented Jan 31, 2018

That would be nice! Thanks.

@hsauro

This comment has been minimized.

Copy link
Contributor

hsauro commented Jan 31, 2018

@0u812

This comment has been minimized.

Copy link
Member

0u812 commented Feb 1, 2018

@hsauro at the moment they're handled by Tellurium Python code. I'll add documentation.

@luciansmith

This comment has been minimized.

Copy link
Contributor

luciansmith commented Feb 14, 2018

For what it's worth, I would annotate the function in the function declaration, not in a model:

function relActFun(a)
  sboTerm = SBO:0000487;
  a + 2;
end

You could annotate models that way, too.

This means that you couldn't create a model with a parameter called 'sboTerm', but perhaps we don't need to worry about that?

@0u812

This comment has been minimized.

Copy link
Member

0u812 commented May 1, 2018

Hi all, just FYI annotating functions via SBO is now a feature in tellurium 2.0.17. I added support for both Andreas' and Lucian's proposed syntax, so either of the following will work:

function relActFun(a)
  sboTerm = SBO:0000487; # set SBO for this function
  a + 2;
end

model m
  relActFun.sboTerm = SBO:0000487; # another way to set SBO (overwrites previous value)

  // Rate Rules:
  a' = 7*relActFun(time);

  // Variable initializations:
  a = 5;

  // Other declarations:
  var a;
end

Either way will add the SBO term to the function definition in SBML:

<functionDefinition sboTerm="SBO:0000487" id="relActFun">
@draeger

This comment has been minimized.

Copy link
Author

draeger commented May 2, 2018

Excellent, thanks!

@draeger draeger closed this May 2, 2018

@0u812

This comment has been minimized.

Copy link
Member

0u812 commented May 2, 2018

My pleasure!

@hsauro

This comment has been minimized.

Copy link
Contributor

hsauro commented May 2, 2018

@luciansmith

This comment has been minimized.

Copy link
Contributor

luciansmith commented May 2, 2018

@draeger draeger reopened this May 4, 2018

@draeger

This comment has been minimized.

Copy link
Author

draeger commented May 4, 2018

@0u812, I installed Tellurium 2.0.17 and tried it out using just one model cell:

function relActFun(a)
  sboTerm = SBO:0000487; # set SBO for this function
  a + 2;
end

This raised the following error:

RuntimeError: Errors encountered when trying to load model into Antimony:
Error in model string, line 2: syntax error, unexpected element name, expecting '='

@0u812

This comment has been minimized.

Copy link
Member

0u812 commented May 7, 2018

Hi Andreas, the problem turned out to be that the parser I wrote wasn't handling comments correctly when they occurred on the same line as an SBO term. I fixed the issue and uploaded version 2.0.18 (Mac and Linux binaries uploaded, still working on Windows). Please let me know if you still have trouble with it. I tested it with the following code:

function relActFun(a)
  sboTerm = SBO:0000487; # can be commented out & example still works
  a + 2;
end

model m
  relActFun.sboTerm = SBO:0000487; # can be commented out & example still works

  // Rate Rules:
  a' = 7*relActFun(time);

  // Variable initializations:
  a = 5;

  // Other declarations:
  var a;
end

Next cell:

print(m.getSBML())

Returns:

...
<functionDefinition sboTerm="SBO:0000487" id="relActFun">
...
@draeger

This comment has been minimized.

Copy link
Author

draeger commented May 7, 2018

Excellent work, thanks! It works perfectly now!

@draeger draeger closed this May 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.