Skip to content

Commit

Permalink
improved package structure: utils and flux_analysis are now available…
Browse files Browse the repository at this point in the history
… as well
  • Loading branch information
SamiralVdB committed Dec 10, 2024
1 parent 0d4c597 commit 9ad1872
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/PAModelpy/Enzyme.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def change_kcat_values(self, rxn2kcat: Dict):
else:
catalytic_event_id = f"CE_{CatalyticEvent._extract_reaction_id_from_catalytic_reaction_id(rxn_id, self.enzyme_id_regex)}"
# change rxn2kcat dictionary
self.rxn2kcat[rxn_id] = {**self.rxn2kcat[rxn_id],**kcats}
self.rxn2kcat.setdefault(catalytic_event_id, {}).update(kcats)
# is there already a link between enzyme and reaction?
if catalytic_event_id not in self.catalytic_events:
warn(f"Reaction {rxn_id} is not associated with enzyme {self.id}. Skip")
Expand Down
4 changes: 1 addition & 3 deletions src/PAModelpy/EnzymeSectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,7 @@ def _get_model_genes_from_enzyme(self, enzyme_id: str, model: Model) -> list:
def change_kcat_values(self, rxn_id:str, enzyme_id:str,
kcat_f_b:dict[Literal['f', 'b'], float]
) -> None:
rxnid2protein = defaultdict(dict ,self.rxn2protein[rxn_id])
rxnid2protein[enzyme_id] = {**rxnid2protein[enzyme_id],**kcat_f_b}
self.rxn2protein[rxn_id] = dict(rxnid2protein)
self.rxn2protein.setdefault(rxn_id, {}).update(kcat_f_b)

def __setstate__(self, state):
# Restore state from the unpickled state
Expand Down
2 changes: 1 addition & 1 deletion src/PAModelpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
print('Loading PAModelpy modules version 0.0.4.1')
print('Loading PAModelpy modules version 0.0.4.2')

from .Enzyme import *
from .EnzymeSectors import *
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
from dataclasses import dataclass, field


from src.PAModelpy.PAModel import PAModel
from src.PAModelpy.EnzymeSectors import ActiveEnzymeSector, UnusedEnzymeSector, TransEnzymeSector
from src.PAModelpy.configuration import Config
from ..PAModel import PAModel
from ..EnzymeSectors import ActiveEnzymeSector, UnusedEnzymeSector, TransEnzymeSector
from ..configuration import Config

DEFAULT_MOLMASS = 39959.4825 #kDa
DEFAULT_KCAT = 11 #s-1
Expand Down Expand Up @@ -80,7 +80,7 @@ def parse_gpr_information(gpr_info:str,
gene2protein: dict[str, str] = None) -> tuple[list,list]:
#filter out nan entries
if not isinstance(gpr_info, str):
return None
return None, None

# #only get the genes associated with this enzyme
gpr_list = _parse_gpr(gpr_info)
Expand Down Expand Up @@ -191,11 +191,13 @@ def _check_if_all_model_reactions_are_in_rxn_info2protein(model: cobra.Model,
protein2gpr:defaultdict[str,list]
) -> Tuple[dict[str, ReactionInformation],defaultdict[str,list]]:
for rxn in model.reactions:
rxn_id = _extract_reaction_id(
rxn.id) # some reactions ids are associated with copy numbers, only filter for the actual reaction id
if not (
rxn.id not in rxn_info2protein.keys()
and 'EX'.lower() not in rxn.id.lower()#is the reaction an exchange with the environment?
and 'BIOMASS' not in rxn.id#is the reaction a pseudoreaction?
and len(rxn._genes) > 0 #is the reaction associated with enzymes?
rxn_id not in rxn_info2protein.keys()
and 'EX'.lower() not in rxn.id.lower() # is the reaction an exchange with the environment?
and 'BIOMASS' not in rxn.id # is the reaction a pseudoreaction?
and len(rxn._genes) > 0 # is the reaction associated with enzymes?
and list(rxn._genes)[0].id != 's0001'
): continue

Expand Down
3 changes: 2 additions & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from PAModelpy import *
from PAModelpy.src.PAModelpy.flux_analysis import *
from PAModelpy.src.PAModelpy.utils import *
4 changes: 2 additions & 2 deletions src/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ requires = [
build-backend = "setuptools.build_meta"

[tool.setuptools.packages]
find = {} # Scan the project directory with the default parameters
find = { where = ["src"] } # Scan the project directory with the default parameters

[project]
name = 'PAModelpy'
version = '0.0.4.1'
version = '0.0.4.2'
authors = [{name='Samira van den Bogaard', email = '[email protected]'}]
description = 'Python framework for building and analysing protein allocation models'
readme = 'README.md'
Expand Down

0 comments on commit 9ad1872

Please sign in to comment.