Skip to content

Commit

Permalink
adjusted setup method+docs to include membrane sector
Browse files Browse the repository at this point in the history
  • Loading branch information
SamiralVdB committed Dec 18, 2024
1 parent 7922db9 commit 195c907
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 16 deletions.
34 changes: 32 additions & 2 deletions docs/PAM_setup_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,40 @@ pip install cobra PAModelpy
| `ups_mu` | Change in unused enzyme fraction per unit change of the associated reaction. |
| `mol_mass` | Molar mass of unused enzymes. [kDa] |

#### Membrane Sheet
*Only required if you are building a membrane-constrained PAM (mcPAM)*

| **Parameter** | **Description** |
|---------------------|--------------------------------------------------------------------------------------------------|
| `id_list` | Identifier related to protein fraction associated with the available membrane area. |
| `area_avail_0` | Available membrane area at zero growth [μm^{2}]. |
| `ups_mu` | Increase in available membrane surface area per unit increase of the growth rate [μm^{2}/h]. |


#### MembraneEnzyme Sheet
*Only required if you are building a membrane-constrained PAM (mcPAM)*

| **Column** | **Description** |
|----------------|--------------------------------------------------|
| `rxn_id` | Reaction ID from the genome-scale model. |
| `enzyme_id` | Unique enzyme identifier*. |
| `alpha_number` | Number of alpha helices embedded in the membrane. |
| `location` | Cellular location of the enzyme**. |


* A unique enzyme identifier is defined as a single identifier per catalytically active unit. This means that an enzyme complex has a single identifier.
* Enzyme-complex identifiers can be parsed from peptide identifiers and gene-to-protein mapping using the `merge_enzyme_complexes` function.
** Either 'Cell membrane', 'Cytoplasm', or 'Unknown'

---

## Building a PAM

### Steps to Create a PAM

1. Prepare the genome-scale model and parameter file.
2. Use the `set_up_pam` function to initialize the model.
2. Optionally: configure the Config object to match the identifiers of your model (see example 2)
3. Use the `set_up_pam` function to initialize the model.

#### Example Usage
```python
Expand All @@ -96,11 +122,15 @@ pam = set_up_pam(pam_info_file=param_file,
adjust_reaction_ids=False)
```

3. Optimize the PAM:
4. Optimize the PAM:
```python
pam.optimize()
print(f"Objective Value: {pam.objective.value}")
```
### Creating a mcPAM
To create a mcPAM, you can use the example as described above. The only alteration is that in the
`set_up_pam` function, you'll need to set the `membrane_sector` parameter to `True`. Optionally, you can
define the fraction of membrane area available for active enzymes using `max_membrane_area`.

---

Expand Down
36 changes: 22 additions & 14 deletions src/PAModelpy/utils/pam_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,11 @@ def set_up_pam(pam_info_file:str = '',
model:Union[str, cobra.Model] = 'Models/iML1515.xml',
config:Config = None,
total_protein: Union[bool, float] = True,
active_enzymes: bool = None,
translational_enzymes: bool = None,
unused_enzymes: bool = None,
membrane_sector: bool = None,
max_area:float = 0.03,
active_enzymes: bool = True,
translational_enzymes: bool = True,
unused_enzymes: bool = True,
membrane_sector: bool = False,
max_membrane_area:float = 0.03,
sensitivity:bool = True,
enzyme_db:pd.DataFrame = None,
adjust_reaction_ids:bool = False) -> PAModel:
Expand Down Expand Up @@ -384,31 +384,36 @@ def set_up_pam(pam_info_file:str = '',
enzyme_db['rxn_id'] = enzyme_db['rxn_id'].apply(_check_rxn_identifier_format)
# create enzyme objects for each gene-associated reaction
rxn2protein, protein2gene = parse_reaction2protein(enzyme_db, model)
active_enzyme_sector = ActiveEnzymeSector(rxn2protein=rxn2protein, protein2gene=protein2gene,
active_enzyme_info = ActiveEnzymeSector(rxn2protein=rxn2protein, protein2gene=protein2gene,
configuration=config)

else:
active_enzyme_info = None

if translational_enzymes:
translational_info = pd.read_excel(pam_info_file, sheet_name='Translational')
translation_enzyme_sector = TransEnzymeSector(
translation_enzyme_info = TransEnzymeSector(
id_list=[translational_info[translational_info.Parameter == 'id_list'].loc[0, 'Value']],
tps_0=[translational_info[translational_info.Parameter == 'tps_0'].loc[1, 'Value']],
tps_mu=[translational_info[translational_info.Parameter == 'tps_mu'].loc[2, 'Value']],
mol_mass=[translational_info[translational_info.Parameter == 'mol_mass'].loc[3, 'Value']],
configuration = config)
else:
translation_enzyme_info = None

if unused_enzymes:
unused_protein_info = pd.read_excel(pam_info_file, sheet_name='UnusedEnzyme').set_index('Parameter')

ups_0 = unused_protein_info.at['ups_0', 'Value']
ups_mu = unused_protein_info.at['ups_mu', 'Value']

unused_protein_sector = UnusedEnzymeSector(
unused_enzyme_info = UnusedEnzymeSector(
id_list=[unused_protein_info.at['id_list', 'Value']],
ups_mu=[ups_mu],
ups_0=[ups_0],
mol_mass=[unused_protein_info.at['mol_mass', 'Value']],
configuration = config)
else:
unused_enzyme_info = None

if membrane_sector:
membrane_info = pd.read_excel(pam_info_file, sheet_name='Membrane').set_index('Parameter')
Expand All @@ -417,21 +422,24 @@ def set_up_pam(pam_info_file:str = '',
area_avail_0 = membrane_info.at['area_avail_0','Value']
area_avail_mu = membrane_info.at['area_avail_mu','Value']
alpha_numbers_dict = active_membrane_info.alpha_numbers.to_dict()
enzyme_location = active_membrane_info.Location.to_dict()
enzyme_location = active_membrane_info.location.to_dict()

membrane_sector = MembraneSector(area_avail_0=area_avail_0,
area_avail_mu=area_avail_mu,
alpha_numbers_dict=alpha_numbers_dict,
enzyme_location=enzyme_location,
max_area=max_area)
max_area=max_membrane_area)

else:
membrane_sector = None


if total_protein: total_protein = TOTAL_PROTEIN_CONCENTRATION

pamodel = PAModel(id_or_model=model, p_tot=total_protein,
active_sector=active_enzyme_sector,
translational_sector=translation_enzyme_sector,
unused_sector=unused_protein_sector,
active_sector=active_enzyme_info,
translational_sector=translation_enzyme_info,
unused_sector=unused_enzyme_info,
membrane_sector=membrane_sector,
sensitivity=sensitivity, configuration = config
)
Expand Down

0 comments on commit 195c907

Please sign in to comment.