I have a SBML file which contains details of series of biochemical reactions. Each reaction has a set of reactants (metabolites). My goal is to get a list of reactants for each of the reactions. I can manually access the list of reactants as follows.
library(SBMLR)
currentFile = readSBML("Sample.xml")
currentReactants = currentFile$reactions$R_DM_4CRSOL$reactants
Here R_DM_4CRSOL is the name of the first reaction. And each time when I want to get the list of reactants I need to specify the reactionID. But the thing is I have 2700 reactions and I need to automate the process. I tried assigning the ReactioinID into a variable and executing the command as follows. But it doesn't work as follows.
a = "R_DM_4CRSOL"
b = currentFile$reactions$a$reactants
Finally I thought of creating a string of the executable command for each of the reaction. I was able to create the string but I don't know how to execute it. I tried using sys but it gives me a warning as follows.
a = "$R_DM_4CRSOL"
b = paste("currentFile$reactions",a,"$reactants",sep="")
d = system(b)
Warning message: running command 'currentFile$reactions$R_DM_4CRSOL$reactants' had status 127
Can someone please tell me how can I achieve this? Thank you in advance.