Python SDK for Valthos API
Project description
Valthos Python SDK
Python SDK for the Valthos bioinformatics platform.
Installation
pip install valthos-sdk
Quick Start
Authentication
First, authenticate with your Valthos account:
import valthos_sdk
# Interactive login (prompts for credentials)
session = valthos_sdk.login()
# Or provide credentials directly
session = valthos_sdk.login(root_domain="valthos.com", token="your-personal-access-token")
Credentials are stored securely in ~/.valthos/credentials.
Working with Workspaces
# List your workspaces
workspaces = session.list_workspaces()
for ws in workspaces:
print(f"{ws.name}: {ws.status}")
# Get a specific workspace
workspace = session.workspace(name="My Project")
# Create a new workspace
workspace = session.create_workspace(name="New Analysis", description="My analysis project")
File Operations
# Upload a file
workspace.add('/local/path/data.csv', 'data/input.csv')
# List workspace contents
files = workspace.list()
for f in files:
print(f"{f.path} - {f.size} bytes")
# Create folders
workspace.create_folder('results')
# Copy, rename, delete
workspace.copy('data.csv', 'backup/data.csv')
workspace.rename('old_name.txt', 'new_name.txt')
workspace.delete('temporary_file.txt')
Analysis Tools
Run bioinformatics analyses through the tools interface:
# Fitness analysis
fitness = workspace.tools.Fitness(
input_path='proteins.parquet',
output_path='results/fitness.parquet'
)
# Validate inputs
validation = fitness.validate()
if validation['status'] == 'valid':
# Get runtime estimate
estimate = fitness.estimate()
print(f"Estimated time: {estimate['estimated_time_minutes']} minutes")
# Run the analysis
result = fitness.run()
print(f"Job ID: {result['job_id']}")
# Sequence profiling
profiler = workspace.tools.SequenceProfiling(
input='protein.fasta',
output='results/profile.json',
methods=["world"]
)
# Genome profiling
genome_profiler = workspace.tools.GenomeProfiling(
input='genome.fasta',
output='results/genome_profile.json',
min_orf_length=90
)
API Reference
Session Methods
session.list_workspaces(status=None, limit=None, offset=None)- List workspacessession.workspace(name=None, rid=None)- Get a workspace by name or IDsession.create_workspace(name, description=None)- Create a new workspacesession.archive_workspace(name=None, rid=None)- Archive a workspace
Workspace Methods
workspace.add(local_path, workspace_path=None)- Upload a fileworkspace.list(path=None, offset=None, limit=None)- List contentsworkspace.create_folder(path)- Create a folderworkspace.rename(old_path, new_path)- Rename/move a file or folderworkspace.copy(source_path, dest_path)- Copy a fileworkspace.delete(path)- Delete a file or folder
Available Tools
Fitness- Protein fitness inference using ESM2-based modelsSequenceProfiling- Multi-method analysis of protein sequencesGenomeProfiling- ORF detection and protein profiling from genomesSequenceSearch- MMseqs2-based protein similarity search
Error Handling
from valthos import (
ValthosError,
AuthenticationError,
TokenExpiredError,
APIError,
WorkspaceNotFoundError,
FileUploadError
)
try:
workspace = session.workspace(name="NonExistent")
except WorkspaceNotFoundError:
print("Workspace not found")
except AuthenticationError:
print("Please login again")
Requirements
- Python 3.8+
- requests
- pydantic
License
MIT License - see LICENSE 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
valthos_sdk-0.1.0.tar.gz
(24.4 kB
view details)
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 valthos_sdk-0.1.0.tar.gz.
File metadata
- Download URL: valthos_sdk-0.1.0.tar.gz
- Upload date:
- Size: 24.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0067a898425749a706516d1b3ea8a770bc5646441765f08bfcd98c08e45753a4
|
|
| MD5 |
b594152b512241467f250404356e3a94
|
|
| BLAKE2b-256 |
b1ae9e37536de67c7b36011d18afdb6511733a6b926ce87bb7b394d317c1de65
|
File details
Details for the file valthos_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: valthos_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b4273fe2459194ee6d4ab367f528c0d88ea8f4a28d34f3f5671d2920297489f
|
|
| MD5 |
d2528108dbdd1934ffcfff4734e63506
|
|
| BLAKE2b-256 |
9b7e6151b82d9841053d7f801214e95a0624c85719fcebf5f55b83e7b5465072
|