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

Evaluation #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Evaluation #1

wants to merge 5 commits into from

Conversation

tluquez
Copy link

@tluquez tluquez commented Apr 25, 2018

Hello! :)
There are two issues and 1 question:

  1. Question: In the line 125, I am trying to replace all unauthorised characters in the reactions and update the reaction column of each file:
    temp_var <- mget(setdiff(ls(pattern = "react"), lsf.str())) sapply(temp_var[[i]][, 3], function(i) { assign(temp_var[[i]][, 3], mgsub( c("-->", '<==>', '->', "\\(|\\)"), c("=>", '<=>', "=>", ""), temp_var[[i]][, 3] ), envir = .GlobalEnv) })
    However, even though the code successfully replace the desired characters, the assign() section is not writing the new column to the file in the workspace. How can I accomplish the above mentioned goal?

  2. Issue: When running the gapfill() function from g2f there is an error raised, which stands:
    1050 Orphan reactants found Error in reactionList[validateSyntax(reactionList)] : invalid subscript type 'list'
    So I checked where does this list subscript come from:
    class(validateSyntax(stm_react$equation)) "logical"
    So now I don't know why is this error popping up.

  3. Issue: When executing the gap fill from cobrapy (line 205), there is this error:
    Infeasible: gapfilling optimization failed (infeasible)
    And, even after look at it in the web there is no useful option to try.

Thank you in advance for your time.

Kind regards.

@dosorio
Copy link
Member

dosorio commented Apr 29, 2018

library(sybilSBML)
library(minval)
library(g2f)

Solving the question 1

model <- readSBMLmod("MODEL1507180017.xml")
modelS <- as.matrix(model@S)
rownames(modelS) <- model@met_name
modelR <- minval:::rearmReactions(S = modelS, reversible = model@react_rev)
modelR <- gsub("-Ureidoglycolate", "Ureidoglycolate", modelR)
orphanMetabolites(modelR)

Solving the issue 1

selectedR <- sample(seq_along(modelR), size = 100, replace = FALSE)
query <- modelR[selectedR]
#gapFill(reactionList = query, reference = modelR)

Subset Model to generate new XML

filteredModel <- rmReact(model = model, react = model@react_id[!seq_along(modelR) %in% selectedR])
writeSBML(morg = filteredModel,filename = "filteredModel.xml")

In Python

import cobra
import libsbml

filteredModel = cobra.io.read_sbml_model('filteredModel.xml')
model = cobra.io.read_sbml_model('MODEL1507180017.xml')
gapfill(filteredModel, model, demand_reactions=False, iterations=1)

@tluquez
Copy link
Author

tluquez commented Apr 30, 2018

The question

Hi Dani, thanks for your help. May be I did not express myself clear enough with the question. I understand your code, and thanks at all for the use of the '@' operator, I had not realised that it can be used to extract data from .modelorg objects. I can update the syntax of the reactions' formulae with this code:

stm_react$equation <- mgsub(c("-->", '<==>', '->', "\\(|\\)"), c("=>", '<=>', "=>", ""), stm_react$equation) 

But, inasmuch as I am planning to supplement several especies_react files, I want to do that assignment operation sequentially, like this:

temp_var <- mget(setdiff(ls(pattern = "react"), lsf.str()))  # Retrieves a list with all the species_react.csv files 

 sapply(temp_var[[i]][, 3], function(i) {
  assign(temp_var[[i]][, 3], mgsub(
    c("-->", '<==>', '->', "\\(|\\)"),
    c("=>", '<=>', "=>", ""),
    temp_var[[i]][, 3]
  ), envir = .GlobalEnv)
})

However it just does not update the object especie_react$equation in the global environment. So, basically, what I am trying to do is update an object in the global environment using the loop, however it is not updated to the global environment. Do you have any idea of how to do that? I have been searching in the web but nothing seems to work.

First issue

I still get the same error. Did you were able to recreate the error? The data files can be downloaded with the first chunk in the warming up section (line 97).

Second issue

I am still working on it. As soon as I have some update I will be telling you.

@tluquez
Copy link
Author

tluquez commented May 21, 2018

@pot53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants