# PGP_Reconstruction

![PGP Reconstruction Logo](logo_pgp.png)

Pathway-Guided Pruning Reconstruction (PGP_Reconstruction) is a Python tool for reconstructing draft constraint-based metabolic models by pruning a universal model, following the general strategy introduced by CarveMe.

## Key Features
- Better consideration of compound transport via passive diffusion
- Represents a wide range of pathways
- Returns almost zero blocked reactions
- Uses Rhea as a reaction database
- Uses Uniprot as a protein database

## Installation

PGP_Reconstruction can be installed using pip:

```bash
pip install pgp_reconstruction
```

PGP_Reconstruction automatically downloads and installs some dependencies during the first run, including: a slightly modified version of [MinPath](https://github.com/mgtools/MinPath), large databases from an [external server](https://files.ufz.de/~umb-pgp_reconstruction-01/), and Prodigal from [its official GitHub repository](https://github.com/hyattpd/Prodigal/releases).

However, PGP_Reconstruction cannot install all dependencies automatically. You will need to install the following external dependencies manually:
- [Diamond](https://github.com/bbuchfink/diamond) (use the command `conda install -c bioconda diamond`)
- IBM [CPLEX](https://www.ibm.com/products/ilog-cplex-optimization-studio/cplex-optimizer) Optimizer

### Troubleshooting

**Issue:** After running PGP_Reconstruction, you encounter the error message `TypeError: solve() got an unexpected keyword argument 'emphasis'`.

**Cause:** PGP_Reconstruction relies on the `reframed` Python library to formulate the optimization problem that CPLEX solves. The error indicates you might not have the most recent version of `reframed`.

**Solution:** You will need to manually update your `reframed` library. Follow these steps:

1. Visit the [reframed GitHub repository](https://github.com/cdanielmachado/reframed).
2. Download the project files.
3. Unzip the downloaded folder.
4. Navigate into the unzipped directory.
5. Install the library by running the command `pip install .` in your terminal.

These steps will ensure you're working with the latest version of `reframed`.


## Usage

After installing PGP_RECONSTRUCTION, you can use it as: "pgprec sequenceFile". "sequenceFile" should ALWAYS be named after the name of modeled species. The sequences in the file can be DNA amino acids translated sequences. Additionally, "sequenceFile" can be an annotation file generated by Genbank (recognized extensions: '.gb', '.gbk' and '.genbank') or Prokka. After including the PGP_Reconstruction instalation folder in your path environment, the simplest possible usage case would be:

```bash
pgprec Escherichia_coli.faa
```

If you do not wish to include PGP_Reconstruction in your path environment, you can use it as:

```bash
C:\[...]\Python\Python3X\Lib\site-packages\pgp_reconstruction\cli\pgprec.py Escherichia_coli.faa
```

A more complex usage would be:

```bash
pgprec Escherichia_coli.gbk --constraints constraints.txt --reference "Escherichia coli.xml"
```

## License

PGP_Reconstruction is released under the [Apache Software License 2.0](https://www.apache.org/licenses/LICENSE-2.0).

## Support

If you encounter any issues or have any questions, please [open an issue](https://github.com/rcolpo/PGP_Reconstruction/issues) or reach out to the maintainers.

This project (Nr. 100386143) is co-financed by means of taxation based on the budget adopted by the representatives of the Landtag of Saxony.

![Freistaat Sachsen Logo](Freistaat_sachsen_logo.jpg)
