From 531449e5a127f821e142c2e74b69c948f3bfb932 Mon Sep 17 00:00:00 2001 From: rasi Date: Thu, 16 Dec 2021 18:04:34 -0800 Subject: [PATCH 1/2] Remove reaction tagging for output and add new options to help --- src/NFinput/NFinput.cpp | 32 +++++++-------- src/NFsim.cpp | 87 ++++++++++++++++++++++++----------------- 2 files changed, 67 insertions(+), 52 deletions(-) diff --git a/src/NFinput/NFinput.cpp b/src/NFinput/NFinput.cpp index 17110336..7cbc5a60 100644 --- a/src/NFinput/NFinput.cpp +++ b/src/NFinput/NFinput.cpp @@ -1828,20 +1828,20 @@ bool NFinput::initReactionRules( } } - if( !pRateLaw->Attribute("tag") ) { - cerr<<"\n!!Error! This XML file was generated using an older version of BioNetGen that does not support the 'TotalRate' convention!"<Attribute("tag")); - if(rf>0) tagFlag=true; - if(verbose) cout<<"\t\t\t= "<Attribute("tag") ) { + // cerr<<"\n!!Error! This XML file was generated using an older version of BioNetGen that does not support the 'TotalRate' convention!"<Attribute("tag")); + // if(rf>0) tagFlag=true; + // if(verbose) cout<<"\t\t\t= "<Attribute("id") || !pRateLaw->Attribute("type")) { cerr<<"!!Error:: ReactionRule "<setAllReactantAndProductTemplates(reactants, products); r->setTotalRateFlag(totalRateFlag); - if (tagFlag) { + // if (tagFlag) { r->tag(); s->turnOnTagRxnOutput(); - } + // } // Use reaction connectivity flag // Set to true if given on the command line r->setConnectivityFlag(s->getConnectivityFlag()); diff --git a/src/NFsim.cpp b/src/NFsim.cpp index df47f7ae..1a434d09 100644 --- a/src/NFsim.cpp +++ b/src/NFsim.cpp @@ -75,20 +75,24 @@ * -notf = disables On the Fly Observables, see manual * * -cb = turn on complex bookkeeping, see manual - * + * * -connect - infer network connectivity before starting simulation. (default: no). - * Does not require any modification to BioNetGen or PySB. * @author Arvind Rasi Subramaniam - * - * -printconnected - print connectivity of each reaction to an output file. (default: no). + * + * -rxnlog - write out firing time and molecules for all reactions + * Does not require any modification to BioNetGen or PySB. * @author Arvind Rasi Subramaniam * * -trackconnected - write out the reactions whose rates change after firing of each reaction. - * Default: false + * this works only if -rxnlog switch is included * @author: Arvind Rasi Subramaniam + * + * -printconnected - print connectivity of each reaction to an output file. (default: no). + * this works only if -rxnlog switch is included + * @author Arvind Rasi Subramaniam * * -trackrxnnum - track reaction number instead of name. this helps to keep the rxn log file small. - * Default: false + * this works only if -rxnlog switch is included * @author: Arvind Rasi Subramaniam * * -maxcputime - maximum run time for simulation in seconds (default: 1000s). @@ -516,37 +520,32 @@ System *initSystemFromFlags(map argMap, bool verbose) } } - if (s->getAnyRxnTagged()) { - if (argMap.find("rxnlog") != argMap.end()) { - string rxnLogFileName = argMap.find("rxnlog")->second; - s->registerReactionFileLocation(rxnLogFileName); - // track the reactions whose rates change upon each each reaction - // firing. This is useful for debugging to make sure that all the - // right reactions are updated after each firing. - // Arvind Rasi Subramaniam Nov 21, 2018 - if (argMap.find("trackconnected") != argMap.end()) { - s->registerConnectedRxnFileLocation( - rxnLogFileName.replace( - rxnLogFileName.end()-4, - rxnLogFileName.end(), - "_connected.tsv")); - s->setTrackConnected(true); - } else { - s->setTrackConnected(false); - } - if (argMap.find("printconnected") != argMap.end()) { - s->registerListOfConnectedRxnFileLocation( - rxnLogFileName.replace( - rxnLogFileName.end()-4, - rxnLogFileName.end(), - "_connectedlist.tsv")); - s->setPrintConnected(true); - } else { - s->setPrintConnected(false); - } + if (argMap.find("rxnlog") != argMap.end()) { + string rxnLogFileName = argMap.find("rxnlog")->second; + s->registerReactionFileLocation(rxnLogFileName); + // track the reactions whose rates change upon each each reaction + // firing. This is useful for debugging to make sure that all the + // right reactions are updated after each firing. + // Arvind Rasi Subramaniam Nov 21, 2018 + if (argMap.find("trackconnected") != argMap.end()) { + s->registerConnectedRxnFileLocation( + rxnLogFileName.replace( + rxnLogFileName.end()-4, + rxnLogFileName.end(), + "_connected.tsv")); + s->setTrackConnected(true); + } else { + s->setTrackConnected(false); + } + if (argMap.find("printconnected") != argMap.end()) { + s->registerListOfConnectedRxnFileLocation( + rxnLogFileName.replace( + rxnLogFileName.end()-4, + rxnLogFileName.end(), + "_connectedlist.tsv")); + s->setPrintConnected(true); } else { - s->registerReactionFileLocation( - s->getName() + "_rxns.dat"); + s->setPrintConnected(false); } if (argMap.find("trackrxnnum") != argMap.end()) { s->setRxnNumberTrack(true); @@ -554,6 +553,7 @@ System *initSystemFromFlags(map argMap, bool verbose) s->setRxnNumberTrack(false); } } + // } //turn off on the fly calculation of observables @@ -740,6 +740,21 @@ void printHelp(string version) cout<<""< Date: Thu, 16 Dec 2021 19:36:49 -0800 Subject: [PATCH 2/2] Add filename option to -rxnlog switch in help message --- src/NFsim.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/NFsim.cpp b/src/NFsim.cpp index 1a434d09..a8f5161d 100644 --- a/src/NFsim.cpp +++ b/src/NFsim.cpp @@ -79,7 +79,7 @@ * -connect - infer network connectivity before starting simulation. (default: no). * @author Arvind Rasi Subramaniam * - * -rxnlog - write out firing time and molecules for all reactions + * -rxnlog [filename] - write out firing time and participating molecules for all reactions to file * Does not require any modification to BioNetGen or PySB. * @author Arvind Rasi Subramaniam * @@ -742,13 +742,13 @@ void printHelp(string version) cout<<""<