Chaparral Python API
This Python package is a wrapper for the Chaparral API. It provides a simple and convenient interface for interacting with the Chaparral platform.
Note: Currently, it supports a limited number of API endpoints. More endpoints will be added in future releases.
Installation
To install the package, use pip:
pip install chaparralapi
Example Usage
Here's a quick example of how to use the Chaparral API client:
from chaparralapi import Client
token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
api = Client(token)
# Fetch and print all projects
print(api.get_projects())
# Fetch and print organization details
print(api.get_organization())
# Fetch and print all FASTA databases
print(api.get_databases())
Obtaining the API Token
To get your Chaparral API token, follow these steps:
- Go to the Chaparral website.
- Open the browser's developer tools (usually F12 or right-click and select "Inspect").
- Navigate to the "Network" tab.
- Look for a REST API call and inspect its headers.
- Copy the token from the
Authorizationheader. - The token will be valid for 8 hours.
Sure, here is the updated README to include the new endpoints in the Client class:
Endpoints
This section describes the endpoints available in the Client class for interacting with the Chaparral API.
Project Endpoints
-
Get All Projects:
get_projects() -> List[Project]- Retrieves a list of all projects.
-
Get Project by ID:
get_project(project_id: str) -> Project- Retrieves a specific project by its ID.
-
Create Project:
create_project(name: str, description: str) -> Project- Creates a new project.
-
Update Project:
update_project(project_id: str, name: str, description: str, tags: List[str]) -> Project- Updates an existing project.
-
Delete Project:
delete_project(project_id: str) -> None- Deletes a project by its ID.
-
Tag Projects:
tag_projects(project_ids: List[str], tags: List[str]) -> List[Project]- Adds tags to multiple projects.
-
Get Projects by Tag:
get_projects_by_tag(tag: str) -> List[Project]- Retrieves projects that have a specific tag.
Organization Endpoints
-
Get Organization:
get_organization() -> Organization- Retrieves the details of the organization.
-
Update Organization:
update_organization(organization_id: str, name: str) -> Organization- Updates the organization's name.
-
Invite to Organization:
invite_to_organization(email: str) -> None- Invites a new member to the organization.
-
Get Resource Usage:
get_resource_usage() -> OrganizationUsage- Retrieves the resource usage of the organization.
Database Endpoints
-
Get All Databases:
get_databases() -> List[Database]- Retrieves a list of all databases.
-
Get Database by ID:
get_database(database_id: str) -> Database- Retrieves a specific database by its ID.
-
Update Database:
update_database(database_id: str, name: str, organism: str, decoy_tag: Optional[str]) -> Database- Updates an existing database.
-
Create Database:
create_database(database_bytes: bytes, filename: str) -> Database- Creates a new database.
-
Delete Database:
delete_database(database_id: str) -> None- Deletes a database by its ID.
Search Result Endpoints
-
Get All Search Results:
get_search_results() -> List[SearchResult]- Retrieves a list of all search results.
-
Get Search Result by ID:
get_search_result(search_result_id: str) -> Optional[SearchResult]- Retrieves a specific search result by its ID.
-
Get Search Result Download:
get_search_result_download(search_result_id: str) -> SearchResultDownload- Retrieves the download URLs for a specific search result.
-
Fetch Config JSON:
fetch_config_json(search_result_id: str) -> str- Fetches the config JSON file for a specific search result.
-
Fetch Matched Fragments Parquet:
fetch_matched_fragments_parquet(search_result_id: str) -> str- Fetches the matched fragments parquet file for a specific search result.
-
Fetch Peptide CSV:
fetch_peptide_csv(search_result_id: str) -> str- Fetches the peptide CSV file for a specific search result.
-
Fetch Proteins CSV:
fetch_proteins_csv(search_result_id: str) -> str- Fetches the proteins CSV file for a specific search result.
-
Fetch Results JSON:
fetch_results_json(search_result_id: str) -> str- Fetches the results JSON file for a specific search result.
-
Fetch Results Parquet:
fetch_results_parquet(search_result_id: str) -> str- Fetches the results parquet file for a specific search result.
QC Endpoints
-
Get QC Scores:
get_qc_scores(search_result_id: str) -> List[QcScore]- Retrieves the QC scores for a specific search result.
-
Get QC IDs:
get_qc_ids(search_result_id: str) -> List[QcId]- Retrieves the QC IDs for a specific search result.
-
Get QC Precursors:
get_qc_precursors(search_result_id: str) -> List[QcPrecursor]- Retrieves the QC precursors for a specific search result.
User Profile Endpoints
-
Get User Profile:
get_user_profile() -> Profile- Retrieves the user's profile information.
-
Update User Profile:
update_user_profile(first_name: str, last_name: str) -> Profile- Updates the user's profile information.
Project File Endpoints
-
Get Project Files:
get_project_files(project_id: str) -> List[ProjectFile]- Retrieves the files for a specific project.
-
Get Project File:
get_project_file(project_id: str, file_id: str) -> ProjectFile- Retrieves a specific file from a project by its ID.
-
Upload Project File:
upload_project_file(project_id: str, file_bytes: bytes, filename: str)- Uploads a file to a specific project.
Search Submission Endpoints
- Submit Search:
submit_search(project_id: str, search_settings: Dict) -> None- Submits a search request for a specific project.
Metadata
Release files for chaparralapi 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chaparralapi-0.1.1.tar.gz | 17.6 kB | Without provenance | Details for chaparralapi-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chaparralapi-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for chaparralapi-0.1.1-py3-none-any.whl |
Total release size: 41.2 kB
Release files / chaparralapi-0.1.1.tar.gz
| Download URL | chaparralapi-0.1.1.tar.gz |
|---|---|
| Size | 17.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c997f5c6228c25550aa76da08d0dc244f8449482a198c9e884e2e3462084b8b
|
|
BLAKE2b-256 checksum How to use checksums |
bc80c9b8cd1348be6595c101ea7697c586604c452bc8b350b38880555c651e74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Release files / chaparralapi-0.1.1-py3-none-any.whl
| Download URL | chaparralapi-0.1.1-py3-none-any.whl |
|---|---|
| Size | 23.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
87163613bc40f03f88fbd6878066a19e18985f65aab5770e24379dd7f297c6a3
|
|
BLAKE2b-256 checksum How to use checksums |
b1d996726d5fba9af3a5a0c12a1dffce43c979f374d8c1f03e737b599b311ec3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Security for chaparralapi 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.