A Python client for the FPBase REST API
Project description
FPBase Client
A Python client for the FPBase REST API with local SQLite caching.
Installation
git clone https://github.com/joemans3/fpbase-client.git
cd fpbase-client
pip install -e .
Basic Usage
from fpbase_client import FPBaseAPI, find_proteins_by_name, find_spectra_by_name
# Using the API client directly
api = FPBaseAPI()
proteins = api.search_by_name("GFP") # Partial match
proteins = api.search_by_name("EGFP", partial_match=False) # Exact match
# Using the local database (faster, works offline)
proteins = find_proteins_by_name("GFP") # Partial match
proteins = find_proteins_by_name("EGFP", exact=True) # Exact match
# Advanced API queries
# For advanced users who need more specific queries, use get_proteins() with filters
proteins = api.get_proteins(
name__icontains='green',
default_state__qy__gte=0.7,
default_state__brightness__gte=0.5
)
# Find spectra
spectra = find_spectra_by_name("EGFP", exact=True)
# returns a list of dictionaries with the following keys:
# name, slug, spectra
# spectra is a list of dictionaries with the following keys:
# state, ec, max, data: (state name in string, exctinction coefficient in M^-1 cm^-1, wavelength at max excitation or emission based on state, List[List[float, float]] representing the wavelength and intensity of the spectrum (note: intensity is from 0-1))
# Get all data
all_proteins = api.get_all_proteins()
all_spectra = api.get_all_spectra()
# Reinstall local database
from fpbase_client import reinstall_DB
reinstall_DB() # This will delete and repopulate the local cache
Available Methods
API Methods
search_by_name(name, partial_match=True): Search proteins by nameget_proteins(**kwargs): Advanced protein search with filtersget_all_proteins(): Get all proteinsget_all_spectra(): Get all spectra
Local Database Methods
find_proteins_by_name(name, exact=False): Search proteins by name using local cachefind_spectra_by_name(name, exact=False): Search spectra by name using local cachereinstall_DB(): Delete and repopulate the local database cache
Advanced Search Fields
The get_proteins() method supports various fields and lookups (see FPBase API docs):
name: icontains, iendswith, istartswith, iexactseq: icontains, iendswith, istartswith, cdna_containsdefault_state__ex_max: around, range, lte, gte, exactdefault_state__em_max: around, range, lte, gte, exactdefault_state__lifetime: gte, lte, range, exact- And many more...
Example:
proteins = api.get_proteins(
name__icontains='green',
default_state__qy__gte=0.7,
primary_reference__year__gte=2020
)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fpbase_client-0.1.2.tar.gz.
File metadata
- Download URL: fpbase_client-0.1.2.tar.gz
- Upload date:
- Size: 43.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7402edcdfe8875e8078fe2707bd1055e568326b9e8a47e5d49c6d4f1e8851a02
|
|
| MD5 |
59e68fb2f8d61bd912ad68423f5522e6
|
|
| BLAKE2b-256 |
9b2e792b69b54180b883ec120b73ded279232ff3c2a63da519a703b51812ad11
|
Provenance
The following attestation bundles were made for fpbase_client-0.1.2.tar.gz:
Publisher:
publish.yml on joemans3/fpbase-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fpbase_client-0.1.2.tar.gz -
Subject digest:
7402edcdfe8875e8078fe2707bd1055e568326b9e8a47e5d49c6d4f1e8851a02 - Sigstore transparency entry: 147470788
- Sigstore integration time:
-
Permalink:
joemans3/fpbase-client@aae98f0887fe04e6b543578c4a6c81d8ecdd77e7 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/joemans3
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aae98f0887fe04e6b543578c4a6c81d8ecdd77e7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fpbase_client-0.1.2-py3-none-any.whl.
File metadata
- Download URL: fpbase_client-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c032aefdda368077594ba6517003c707062995d011f1bd62856c86e042e9b5f
|
|
| MD5 |
0179e397d167c1916de75bfd10aa3e91
|
|
| BLAKE2b-256 |
d6bd5d115e7ce181b0dc81fe372e0fb3bcf34dea24c453f7b32ad2458808e37f
|
Provenance
The following attestation bundles were made for fpbase_client-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on joemans3/fpbase-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fpbase_client-0.1.2-py3-none-any.whl -
Subject digest:
5c032aefdda368077594ba6517003c707062995d011f1bd62856c86e042e9b5f - Sigstore transparency entry: 147470790
- Sigstore integration time:
-
Permalink:
joemans3/fpbase-client@aae98f0887fe04e6b543578c4a6c81d8ecdd77e7 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/joemans3
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aae98f0887fe04e6b543578c4a6c81d8ecdd77e7 -
Trigger Event:
push
-
Statement type: