Skip to content

Commit

Permalink
Merge pull request #23 from biosustain/find_shorter_heterologous_alte…
Browse files Browse the repository at this point in the history
…rnatives

Adapt PathwayPredictor to also find shorter heterologous alternatives to a native pathway
  • Loading branch information
phantomas1234 committed Feb 11, 2015
2 parents 8bd4048 + 413cec1 commit 360d46c
Show file tree
Hide file tree
Showing 18 changed files with 6,867,445 additions and 3,285,080 deletions.
3 changes: 0 additions & 3 deletions cameo/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
import logging
logger = logging.getLogger(__name__)

with open(os.path.join(cameo._cameo_data_path, 'metanetx.pickle')) as f:
_METANETX = pickle.load(f)

from cameo.api.hosts import hosts
from cameo.api.designer import design
from cameo.api.products import products
4 changes: 2 additions & 2 deletions cameo/api/designer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from functools import partial
import progressbar
from cameo import Metabolite, Model
from cameo.api import _METANETX as METANETX
from cameo.data import metanetx
from cameo.api.hosts import hosts, Host
from cameo.api.products import products
from cameo.strain_design.pathway_prediction import PathwayPredictor
Expand Down Expand Up @@ -92,7 +92,7 @@ def predict_pathways(self, product, hosts=hosts): #TODO: make this work with a
pbar_models = progressbar.ProgressBar(widgets=["Processing", DisplayItemsWidget([model.id for model in host.models]), progressbar.Bar(), progressbar.ETA(), progressbar.Percentage()])
for model in pbar_models(list(host.models)):
# TODO: Check if product is already part of model
pathway_predictor = PathwayPredictor(model, universal_model=METANETX['universal_model'], mapping=METANETX['bigg2mnx'])
pathway_predictor = PathwayPredictor(model)
predicted_pathways = pathway_predictor.run(product, max_predictions=5, timeout=15*60) # TODO adjust these numbers to something reasonable
pathways[(host, model)] = predicted_pathways
return pathways
Expand Down
5 changes: 2 additions & 3 deletions cameo/api/products.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

import difflib
from cameo.api import _METANETX as METANETX
from cameo.data import metanetx


def inchi_to_svg(inchi, file=None):
Expand Down Expand Up @@ -49,8 +49,7 @@ def _repr_html_(self):
class Products(object):

def __init__(self):
metabolite_ids = [metabolite.id for metabolite in METANETX['universal_model'].metabolites]
self.data_frame = METANETX['chem_prop'].loc[metabolite_ids]
self.data_frame = metanetx.chem_prop

def search(self, query):
matches = self._search_by_source(query)
Expand Down
2 changes: 1 addition & 1 deletion cameo/core/solver_based_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def solver(self, value):
else:
raise not_valid_interface
self._solver = interface.Model()
self._populate_solver_from_scratch()
self._populate_solver_from_scratch() #FIXME: This ignores non-reaction variables and constraints

@property
def exchanges(self):
Expand Down
13 changes: 13 additions & 0 deletions cameo/data/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2015 Novo Nordisk Foundation Center for Biosustainability, DTU.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

0 comments on commit 360d46c

Please sign in to comment.