https://github.com/broadinstitute/g2papi
Python Client Library for the G2P Portal API
Science Score: 57.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 10 DOI reference(s) in README -
✓Academic publication links
Links to: pubmed.ncbi, ncbi.nlm.nih.gov, nature.com -
○Academic email domains
-
✓Institutional organization owner
Organization broadinstitute has institutional domain (www.broadinstitute.org) -
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.4%) to scientific vocabulary
Keywords
Repository
Python Client Library for the G2P Portal API
Basic Info
- Host: GitHub
- Owner: broadinstitute
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://g2p.broadinstitute.org
- Size: 4.35 MB
Statistics
- Stars: 12
- Watchers: 7
- Forks: 2
- Open Issues: 3
- Releases: 0
Topics
Metadata Files
README.md
g2papi
g2papi is a Python library and command-line tool designed to interact with the Genomics 2 Protein Portal (G2P) API provided by the Broad Institute of MIT and Harvard. It allows users to retrieve mappings between protein isoforms, transcripts, and PDB structures for a gene, as well as protein feature tables for a gene.
- Access the swagger definition and endpoints at: https://g2p.broadinstitute.org/api-docs/
- Access methods via the G2P Bio Integration Suite: https://github.com/broadinstitute/g2p-bis
- Access Interactive Visualizations via the G2P portal: https://g2p.broadinstitute.org/
How to cite
If you use this API, please cite the paper:
- Kwon, S., Safer, J., Nguyen, D.T. et al. Genomics 2 Proteins portal: a resource and discovery tool for linking genetic screening outputs to protein sequences and structures. Nat Methods 21, 1947–1957 (2024), https://doi.org/10.1101/2024.01.02.573913
or, if you prefer the BibTeX format:
@article{kwon_genomics_2024,
author = {Kwon, Seulki and Safer, Jordan and Nguyen, Duyen T. and Hoksza, David and May, Patrick and Arbesfeld, Jeremy A. and Rubin, Alan F. and Campbell, Arthur J. and Burgin, Alex and Iqbal, Sumaiya},
title = {Genomics 2 Proteins portal: a resource and discovery tool for linking genetic screening outputs to protein sequences and structures},
journal = {Nature Methods},
volume = {21},
pages = {1947--1957},
year = {2024},
month = oct,
issn = {1548-7105},
doi = {10.1038/s41592-024-02409-0},
url = {https://doi.org/10.1038/s41592-024-02409-0},
}
Installation
First, ensure that you have Python and pip installed on your system.
Installing with PyPi
pip install g2papi
Installing from source
Clone this repository to your local machine and navigate into the cloned directory:
git clone https://github.com/broadinstitute/g2papi.git
cd g2papi
To install g2papi, run:
pip install .
This will install the g2papi package and its dependencies.
Usage
As a Python Library
You can import g2papi in your Python scripts to retrieve data from the G2P API directly. Here are some examples:
Calling the G2P3D API to get the Gene-Transcript-Protein Isoform-Structure mapping
```python import g2papi
Get gene-transcript-protein isoform-protein structure map as a pandas dataframe
genetranscriptproteinisoformstruct = g2papi.getgenetranscriptproteinisoformstructure('BRCA1', 'P38398') print(genetranscriptproteinisoform_struct[['UniProt Isoform','Ensembl Transcript Id', 'RefSeq mRNA Id']].head())
```
Output:
UniProt Isoform Ensembl Transcript Id RefSeq mRNA Id
0 P38398-1(*) ENST00000357654(*) NM_001407611
1 P38398-1(*) ENST00000357654(*) NM_001407616
2 P38398-1(*) ENST00000357654(*) NM_001407624
3 P38398-1(*) ENST00000357654(*) NM_001407637
4 P38398-1(*) ENST00000357654(*) NM_001407641
Getting Protein Features
```python import g2papi
Get protein features as a pandas dataframe
proteinfeatures = g2papi.getproteinfeatures('BRCA1', 'P38398') proteinfeatures.fillna('-', inplace=True) print(protein_features[[ 'residueId', 'AA', 'AlphaFold confidence (pLDDT)', 'Active site (UniProt)' ]].head())
```
Output:
residueId AA AlphaFold confidence (pLDDT) Active site (UniProt)
0 1 M 41.59 -
1 2 D 45.81 -
2 3 L 48.11 -
3 4 S 63.99 -
4 5 A 61.73 -
Getting Isoform Alignment
```python import g2papi
Get isoform sequence alignment between canonical and alternative isoforms
isoformalignment = g2papi.getisoformsequencealignment( 'LDLR', # Gene name 'P01130-1', # Canonical isoform UniProt ID 'P01130-2' # Alternative isoform UniProt ID )
Display the first few rows
print(isoform_alignment.head()) ```
Output:
residueId AA Aligned residueId (P01130-2) Aligned AA (P01130-2)
1 M 1 M
2 G 2 G
3 P 3 P
4 W 4 W
5 G 5 G
As a Command-Line Tool
g2papi can also be used as a command-line tool to retrieve information directly to your terminal or output files.
Getting Gene-Transcript-Protein Isoform-Structure Map with the G2P3D API
g2papi get-gene-transcript-protein-isoform-structure-map --geneName BRCA1 --uniprotId P38398
Getting Protein Features
g2papi get-protein-features --geneName BRCA1 --uniprotId P38398
The above commands will print the results to your terminal. If you wish to save the output to a file, you can redirect the output:
g2papi get-gene-transcript-protein-isoform-structure-map --geneName BRCA1 --uniprotId P38398 > transcript_map.tsv
g2papi get-protein-features --geneName BRCA1 --uniprotId P38398 > protein_features.tsv
System Requirements
The package was developed and tested on Python 3.9.12, and is designed to run on a computer that can run Python3 and has a working internet connection. The library was installed and tested on Ubuntu Linux 20.04 and Mac OSX Ventura, 13.5.1.
Set up time (total time to set up and run: approximately 5 minutes)
Installation and execution steps run in approximately real time. 3 installation steps each run in less than 5 seconds, and execution time takes less than 5 seconds for genes with under 2000 residues.
Owner
- Name: Broad Institute
- Login: broadinstitute
- Kind: organization
- Location: Cambridge, MA
- Website: http://www.broadinstitute.org/
- Twitter: broadinstitute
- Repositories: 1,083
- Profile: https://github.com/broadinstitute
Broad Institute of MIT and Harvard
GitHub Events
Total
- Watch event: 9
- Push event: 20
- Pull request event: 1
- Fork event: 2
Last Year
- Watch event: 9
- Push event: 20
- Pull request event: 1
- Fork event: 2
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 2
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 2
- Total pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 2
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 2
- Pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- ignaciojci (1)
- sroener (1)
Pull Request Authors
- ivanmilevtues (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 17 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 5
- Total maintainers: 1
pypi.org: g2papi
A python client and CLI for easy access to G2P portal APIs
- Documentation: https://g2papi.readthedocs.io/
- License: mit
-
Latest release: 1.0.4
published almost 2 years ago
Rankings
Maintainers (1)
Dependencies
- pandas *
- requests *