Skip to content

Commit

Permalink
Updated gapfill.py #52 #126
Browse files Browse the repository at this point in the history
  • Loading branch information
GwennyGit committed Aug 14, 2024
1 parent 74c1890 commit 7324828
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/refinegems/classes/gapfill.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ def _map_ec_to_reac_mnx(unmapped_reacs:pd.DataFrame) -> pd.DataFrame:
The extended table
"""

# input: pd.DataFrame with a least the ec-code column
# input: pd.DataFrame with at least the ec-code column
# load MNX reac prop table
mnx_reac_prop = load_a_table_from_database('mnx_reac_prop',False)
# convert table into one EC-number a row
# convert table into one EC-number per row
mnx_reac_prop.drop('is_balanced', inplace=True, axis=1)
mnx_reac_prop['ec-code'] = mnx_reac_prop['ec-code'].apply(lambda x: x.split(';') if isinstance(x,str) else None)
# exclude entries without EC-number
Expand Down Expand Up @@ -330,7 +330,9 @@ def add_genes_from_table(self,model:libModel, gene_table:pd.DataFrame) -> None:
_description_
- gene_table (pd.DataFrame):
The table with the genes to add. At least needs the columns
'','' and 'ec-code'.
'','' and 'ec-code'.
@TODO: Hier fehlt was, oder? Passt auch
nicht ganz zu den Spaltennamen oben...
"""

# ncbiprotein | locus_tag | ...
Expand Down Expand Up @@ -526,7 +528,7 @@ def fill_model(self, model:Union[cobra.Model,libModel],
missing_genes:pd.DataFrame,
missing_reacs:pd.DataFrame,
**kwargs) -> libModel:
"""Based on a table of missing reactions and missing metabolites,
"""Based on a table of missing genes and missing reactions,
fill the gaps in a model as good as possible automatically.
.. note::
Expand Down Expand Up @@ -566,7 +568,7 @@ def fill_model(self, model:Union[cobra.Model,libModel],
mes = f'Unknown type of model: {type(model)}'
raise TypeError(mes)

# Step 1: Add genes to model whoose reactions are already in it
# Step 1: Add genes to model whose reactions are already in it
# -------------------------------------------------------------
# filter the respective genes and reactions
reacs_in_model = missing_reacs[~(missing_reacs['add_to_GPR'].isnull())]
Expand Down Expand Up @@ -1262,6 +1264,9 @@ def get_fluxes(row: pd.Series) -> dict[str: str]:
elif 'REVERSIBLE' in direction:
fluxes['lower_bound'] = 'cobra_default_lb'
fluxes['upper_bound'] = 'cobra_default_ub'
else:
#@TODO LOGGING.WARNING + Set to reversible
pass

return str(fluxes)

Expand Down

0 comments on commit 7324828

Please sign in to comment.