An API for the Chaparral platform
Project description
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
Authorization
header. - 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.
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
File details
Details for the file chaparralapi-0.1.1.tar.gz
.
File metadata
- Download URL: chaparralapi-0.1.1.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c997f5c6228c25550aa76da08d0dc244f8449482a198c9e884e2e3462084b8b |
|
MD5 | 52909b066bab86f3a6da02361617640c |
|
BLAKE2b-256 | bc80c9b8cd1348be6595c101ea7697c586604c452bc8b350b38880555c651e74 |
File details
Details for the file chaparralapi-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: chaparralapi-0.1.1-py3-none-any.whl
- Upload date:
- Size: 23.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87163613bc40f03f88fbd6878066a19e18985f65aab5770e24379dd7f297c6a3 |
|
MD5 | 66456eac428983f51002e2f3a53e63fe |
|
BLAKE2b-256 | b1d996726d5fba9af3a5a0c12a1dffce43c979f374d8c1f03e737b599b311ec3 |