Skip to content

Commit

Permalink
Merge pull request #30 from klamt-lab/version_202
Browse files Browse the repository at this point in the history
Version 0.6.3
  • Loading branch information
Paulocracy authored Nov 20, 2024
2 parents e115b91 + fca5bcb commit ee36d4c
Show file tree
Hide file tree
Showing 61 changed files with 2,652 additions and 1,528 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,5 @@ venv.bak/

# Visual Studio Code configuration folders
.vscode

uv.lock
48 changes: 28 additions & 20 deletions autopacmen/analysis_fva_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,38 @@
# IMPORTS
# External module for command-line interfaces
import click

# Internal module, contains the actual FBA comparison function
from .submodules.fva_comparison import fva_comparison_with_sbml


# Set-up command-line parameters using click decorators
@click.command()
@click.option("--sbml_original_path",
required=True,
type=click.Path(exists=True, file_okay=True,
dir_okay=True, readable=True),
prompt="Original SBML path",
help="Full SBML path of original model without protein allocation constraints")
@click.option("--sbml_protein_constrained_path",
required=True,
type=click.Path(exists=True, file_okay=True,
dir_okay=True, readable=True),
prompt="SBML path of sMOMENT-enhanced model",
help="Full SBML path of sMOMENT-enhanced model.")
@click.option("--objective",
required=True,
type=str,
prompt="Objective",
help="Objective of the comparative FVA.")
@click.option(
"--sbml_original_path",
required=True,
type=click.Path(exists=True, file_okay=True, dir_okay=True, readable=True),
prompt="Original SBML path",
help="Full SBML path of original model without protein allocation constraints",
)
@click.option(
"--sbml_protein_constrained_path",
required=True,
type=click.Path(exists=True, file_okay=True, dir_okay=True, readable=True),
prompt="SBML path of sMOMENT-enhanced model",
help="Full SBML path of sMOMENT-enhanced model.",
)
@click.option(
"--objective",
required=True,
type=str,
prompt="Objective",
help="Objective of the comparative FVA.",
)
# Command-line interface function
def fba_comparison_cli(sbml_original_path: str, sbml_protein_constrained_path: str, objective: str) -> None:
def fba_comparison_cli(
sbml_original_path: str, sbml_protein_constrained_path: str, objective: str
) -> None:
"""FVA (Flux Variability Analysis) comparison with the given arguments, e.g. in order to check the validity of the sMOMENTed model.
An FVA result summary is shown for the original SBML model as
Expand All @@ -58,11 +65,12 @@ def fba_comparison_cli(sbml_original_path: str, sbml_protein_constrained_path: s
python analysis_fva_comparison.py --sbml_original_path C:\\original.xml --sbml_protein_constrained_path C:\\pac.xml --objective ACALD
"""
fva_comparison_with_sbml(
sbml_original_path, sbml_protein_constrained_path, objective)
sbml_original_path, sbml_protein_constrained_path, objective
)


# Start-up routine if script is called
if __name__ == '__main__':
if __name__ == "__main__":
# Thanks to the click decorators, the command-line interface
# function does not need to be called directly. The given
# console arguments are added automatically.
Expand Down
52 changes: 32 additions & 20 deletions autopacmen/analysis_fva_prot_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,44 @@
(FVA) with given protein bounds on a sMOMENT-enhanced model.
"""

from typing import List

# IMPORTS
# External modules
import click
from typing import List

# Internal modules
from .submodules.fva_prot_pool import fva_prot_pool_with_sbml


# Set-up command-line parameters using click decorators
@click.command()
@click.option("--sbml_path",
required=True,
type=click.Path(exists=True, file_okay=True, dir_okay=True, readable=True),
prompt="SBML path",
help="Full path to the sMOMENT model SBML")
@click.option("--protein_pool_bounds",
required=True,
type=str,
prompt="Protein pool bounds",
help="Protein pool bounds for which the FVAs are run, semicolon-separated.")
@click.option("--objective",
required=False,
default="",
type=str,
prompt="Objective",
help="Objective of the FVA.")
@click.option(
"--sbml_path",
required=True,
type=click.Path(exists=True, file_okay=True, dir_okay=True, readable=True),
prompt="SBML path",
help="Full path to the sMOMENT model SBML",
)
@click.option(
"--protein_pool_bounds",
required=True,
type=str,
prompt="Protein pool bounds",
help="Protein pool bounds for which the FVAs are run, semicolon-separated.",
)
@click.option(
"--objective",
required=False,
default="",
type=str,
prompt="Objective",
help="Objective of the FVA.",
)
# Command-line interface function
def fva_prot_pool_with_sbml_cli(sbml_path: str, objective: str, protein_pool_bounds: str) -> None:
def fva_prot_pool_with_sbml_cli(
sbml_path: str, objective: str, protein_pool_bounds: str
) -> None:
"""Runs an FVA (Flux Variability Analysis) and prints the result with the sMOMENT-enhanced model and the given protein pool bounds.
The FVA results are generated by cobrapy can give a hint how to fit the protein pool.
Expand All @@ -60,13 +70,15 @@ def fva_prot_pool_with_sbml_cli(sbml_path: str, objective: str, protein_pool_bou
"""
# Parse protein pool bounds given by user as string with each protein pool separated with a semicolon
protein_pool_bounds_list: List[str] = protein_pool_bounds.split(";")
protein_pool_bounds_float_list: List[float] = [float(x) for x in protein_pool_bounds_list]
protein_pool_bounds_float_list: List[float] = [
float(x) for x in protein_pool_bounds_list
]
# Run FVAs :D
fva_prot_pool_with_sbml(sbml_path, protein_pool_bounds_float_list, objective)


# Start-up routine if script is called
if __name__ == '__main__':
if __name__ == "__main__":
# Thanks to the click decorators, the command-line interface
# function does not need to be called directly. The given
# console arguments are added automatically.
Expand Down
47 changes: 29 additions & 18 deletions autopacmen/data_create_combined_kcat_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,37 @@
# IMPORTS
# External modules
import click

# Internal modules
from .submodules.create_combined_kcat_database import create_combined_kcat_database


# Set-up command-line parameters using click decorators
@click.command()
@click.option("--sabio_rk_kcat_database_path",
required=True,
type=click.Path(exists=True, file_okay=True, dir_okay=True, readable=True),
prompt="SABIO-RK JSON path",
help="Full path SABIO-RK JSON created with data_parse_brenda_json_for_model.py")
@click.option("--brenda_kcat_database_path",
required=True,
type=click.Path(exists=True, file_okay=True, dir_okay=True, readable=True),
prompt="BRENDA JSON path",
help="")
@click.option("--output_path",
required=True,
type=click.Path(exists=True, file_okay=True, dir_okay=True),
prompt="Output path",
help="Full path to the newly created combined JSON")
def parse_create_combined_kcat_database(sabio_rk_kcat_database_path: str, brenda_kcat_database_path: str, output_path: str) -> None:
@click.option(
"--sabio_rk_kcat_database_path",
required=True,
type=click.Path(exists=True, file_okay=True, dir_okay=True, readable=True),
prompt="SABIO-RK JSON path",
help="Full path SABIO-RK JSON created with data_parse_brenda_json_for_model.py",
)
@click.option(
"--brenda_kcat_database_path",
required=True,
type=click.Path(exists=True, file_okay=True, dir_okay=True, readable=True),
prompt="BRENDA JSON path",
help="",
)
@click.option(
"--output_path",
required=True,
type=click.Path(exists=True, file_okay=True, dir_okay=True),
prompt="Output path",
help="Full path to the newly created combined JSON",
)
def parse_create_combined_kcat_database(
sabio_rk_kcat_database_path: str, brenda_kcat_database_path: str, output_path: str
) -> None:
"""Combines the BRENDA and SABIO-RK JSONs into one big JSON which can be used by modeling_get_reactions_kcat_mapping.py
The BRENDA JSON is to have been created with data_parse_brenda_json_for_model.py, the SABIO-RK JSON with
Expand All @@ -57,11 +66,13 @@ def parse_create_combined_kcat_database(sabio_rk_kcat_database_path: str, brenda
python data_create_combined_kcat_database.py --sabio_rk_kcat_database_path C:\\JSONS\\brenda.json --brenda_kcat_database_path C:\\JSONS\\sabio.json --output_path C:\\JSONS\\sabio.json
</pre>
"""
create_combined_kcat_database(sabio_rk_kcat_database_path, brenda_kcat_database_path, output_path)
create_combined_kcat_database(
sabio_rk_kcat_database_path, brenda_kcat_database_path, output_path
)


# Start-up routine if script is called
if __name__ == '__main__':
if __name__ == "__main__":
# Thanks to the click decorators, the command-line interface
# function does not need to be called directly. The given
# console arguments are added automatically.
Expand Down
31 changes: 19 additions & 12 deletions autopacmen/data_parse_bigg_metabolites_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,30 @@
# IMPORTS
# External modules
import click

# Internal modules
from .submodules.parse_bigg_metabolites_file import parse_bigg_metabolites_file


# Set-up command-line parameters using click decorators
@click.command()
@click.option("--bigg_metabolites_file_path",
required=True,
type=click.Path(exists=True, file_okay=True, dir_okay=True, readable=True),
prompt="Full path to the BIGG metabolites",
help="BIGG metabolites file path")
@click.option("--json_output_folder",
required=True,
type=click.Path(exists=True, dir_okay=True),
prompt="JSON output folder",
help="Path to the folder in which the newly generated JSON will be created")
def parse_brenda_textfile_cli(bigg_metabolites_file_path: str, json_output_folder: str) -> None:
@click.option(
"--bigg_metabolites_file_path",
required=True,
type=click.Path(exists=True, file_okay=True, dir_okay=True, readable=True),
prompt="Full path to the BIGG metabolites",
help="BIGG metabolites file path",
)
@click.option(
"--json_output_folder",
required=True,
type=click.Path(exists=True, dir_okay=True),
prompt="JSON output folder",
help="Path to the folder in which the newly generated JSON will be created",
)
def parse_brenda_textfile_cli(
bigg_metabolites_file_path: str, json_output_folder: str
) -> None:
"""Converts the given BIGG metabolites text file into a machine-readable JSON file.
The BIGG metabolites text file can be downloaded as text file from http://bigg.ucsd.edu/data_access
Expand All @@ -57,7 +64,7 @@ def parse_brenda_textfile_cli(bigg_metabolites_file_path: str, json_output_folde


# Start-up routine if script is called
if __name__ == '__main__':
if __name__ == "__main__":
# Thanks to the click decorators, the command-line interface
# function does not need to be called directly. The given
# console arguments are added automatically.
Expand Down
47 changes: 27 additions & 20 deletions autopacmen/data_parse_brenda_json_for_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,39 @@
# IMPORTS
# External modules
import click

# Internal modules
from .submodules.parse_brenda_json_for_model import parse_brenda_json_for_model


# Set-up command-line parameters using click decorators
@click.command()
@click.option("--sbml_path",
required=True,
type=click.Path(exists=True, file_okay=True,
dir_okay=True, readable=True),
prompt="Path to SBML model",
help="Full path to the SBML with the model of which the BRENDA JSON will be derived.")
@click.option("--brenda_json_path",
required=True,
type=click.Path(exists=True, file_okay=True,
dir_okay=True, readable=True),
prompt="BRENDA JSON path",
help="Full path to the BRENDA JSON created with data_parse_brenda_textfile.py")
@click.option("--json_output_path",
required=True,
type=click.Path(file_okay=True, dir_okay=True, writable=True),
prompt="JSON output path",
help="The full path for the model-specific JSON file of the "
"BRENDA JSON created with data_parse_brenda_textfile.py")
@click.option(
"--sbml_path",
required=True,
type=click.Path(exists=True, file_okay=True, dir_okay=True, readable=True),
prompt="Path to SBML model",
help="Full path to the SBML with the model of which the BRENDA JSON will be derived.",
)
@click.option(
"--brenda_json_path",
required=True,
type=click.Path(exists=True, file_okay=True, dir_okay=True, readable=True),
prompt="BRENDA JSON path",
help="Full path to the BRENDA JSON created with data_parse_brenda_textfile.py",
)
@click.option(
"--json_output_path",
required=True,
type=click.Path(file_okay=True, dir_okay=True, writable=True),
prompt="JSON output path",
help="The full path for the model-specific JSON file of the "
"BRENDA JSON created with data_parse_brenda_textfile.py",
)
# Command-line interface function
def parse_brenda_json_for_model_cli(sbml_path: str, brenda_json_path: str, json_output_path: str) -> None:
def parse_brenda_json_for_model_cli(
sbml_path: str, brenda_json_path: str, json_output_path: str
) -> None:
"""Converts the given BRENDA JSON created with data_parse_brenda_textfile.py into a even more easily readable model-specific JSON.
This conversion is needed for all subsequent AutoPACMEN steps. The model-specific JSON contains all of the model's EC number entries
Expand All @@ -65,7 +72,7 @@ def parse_brenda_json_for_model_cli(sbml_path: str, brenda_json_path: str, json_


# Start-up routine if script is called
if __name__ == '__main__':
if __name__ == "__main__":
# Thanks to the click decorators, the command-line interface
# function does not need to be called directly. The given
# console arguments are added automatically.
Expand Down
Loading

0 comments on commit ee36d4c

Please sign in to comment.