Metadata-Version: 2.4
Name: fetchprotein
Version: 1.0.0
Summary: Fetch a protein 3D Structure / MSA / FASTA file from the PDB, UniProt or AlphaFold-DB (depending on the `protein_filename` extension).
Author-email: Matsvei Tsishyn <matsvei.tsishyn@protonmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/MatsveiTsishyn/fetchprotein
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENCE
Dynamic: license-file


# fetchprotein

[![PyPi Version](https://img.shields.io/pypi/v/fetchprotein.svg)](https://pypi.org/project/fetchprotein/) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)

A Python package to fetch a protein 3D Structure / MSA / FASTA file from the **PDB**, **UniProt** or **AlphaFold-DB** (depending on the `protein_filename` extension).

Supports extensions:
- `pdb`: for 3D structure from PDB or AlphaFold-DB
- `cif`: for 3D structure from PDB or AlphaFold-DB
- `fasta`: for FASTA from PDB or UniProt
- `a3m`: for MSA from AlphaFold-DB (API is currently unavailable)

## Installation and Usage

Install with `pip`:
```bash
pip install fetchprotein
```

CLI usage:
```bash
fetchprotein --help
fetchprotein 6m0j.pdb
fetchprotein Q9LW00.cif
fetchprotein Q9LW00.a3m # might be currently unavailable
fetchprotein Q9LW00.fasta
fetchprotein 6m0j.fasta
```

Python usage:  
**WARNING**: Fetch for AlphaFold-DB MSA is currently unavailable.
```python
# Imports
from fetchprotein.fetch import fetchprotein
from fetchprotein.fetch import fetch_structure, fetch_sequence, fetch_msa

# Use generic fetch function
path = fetchprotein('6M0J.pdb', output_dir='./test_data/')     # fetch 3D structure from PDB
path = fetchprotein('Q9LW00.cif', output_dir='./test_data/')   # fetch 3D structure from AlphaFold-DB
path = fetchprotein('Q9LW00.a3m', output_dir='./test_data/')   # fetch MSA from AlphaFold-DB
path = fetchprotein('Q9LW00.fasta', output_dir='./test_data/') # fetch FASTA from UniProt
path = fetchprotein('6M0J.fasta', output_dir='./test_data/')   # fetch FASTA from PDB

# Use specific fetch functions
path = fetch_structure('6M0J', extension="cif", output_dir='./test_data/')
path = fetch_structure('Q9LW00', extension="pdb", output_dir='./test_data/')

path = fetch_sequence('6M0J', extension="fasta", output_dir='./test_data/')
path = fetch_sequence('Q9LW00', extension="fasta", output_dir='./test_data/')

path = fetch_msa('Q9LW00', extension="a3m", output_dir='./test_data/')
```
