Metadata-Version: 2.4
Name: omicslab
Version: 1.1.0
Summary: Python SDK and CLI for the RIVER (OmicsLab) Platform
Project-URL: Homepage, https://platform.riverxdata.com
Project-URL: Repository, https://github.com/gianglabs/omicslab-platform
Author: RIVER Platform Team
License-Expression: GPL-3.0
Keywords: bioinformatics,cli,hpc,omics
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.12
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic>=2
Requires-Dist: python-dotenv>=1
Requires-Dist: questionary>=2.1
Requires-Dist: rich>=13
Requires-Dist: typer>=0.15
Requires-Dist: websocket-client>=1.8
Description-Content-Type: text/markdown

# OmicsLab SDK

Python SDK and CLI for the **RIVER (OmicsLab) Platform**.

- **CLI**: `omicslab` (alias `omx`) — interact with the platform from your terminal
- **Python SDK**: `omicslab.Client` — integrate programmatically

## Installation

```bash
pip install omicslab
```

Or from source:

```bash
git clone https://github.com/gianglabs/omicslab-platform
cd omicslab-platform/sdk
pip install -e .
```

## Quick Start

### 1. Authenticate

Create an API token in the web UI (**Settings → API Tokens**), then:

```bash
omicslab auth login --token omx_abc123...
```

### 2. Set your context

```bash
# Interactive mode — picks org, workspace, and folder
omicslab use

# Or set explicitly
omicslab use --org-id <org_id> --workspace-id <ws_id> --prefix data/
```

### 3. Navigate storage like a filesystem

```bash
omicslab ls                          # list files
omicslab cd results/                 # change folder
omicslab pwd                         # show current folder
omicslab upload ./data.csv           # upload a file
omicslab download results/output.txt # download a file
omicslab rm old_file.txt             # delete a file
omicslab mv source.txt dest.txt      # move/rename
```

### 4. Launch a job

```bash
omicslab jobs launch --workspace <ws_id> --analysis <id> --compute <id> --params '{"threads": 8}'
omicslab jobs list --workspace <ws_id>
omicslab jobs logs <job_id> --workspace <ws_id>
```

## CLI Reference
| Command group | Description | Examples |
|---|---|---|
| `auth` | Login/logout | `omicslab auth login --token ...` |
| `token` | API token management | `create`, `list`, `revoke` |
| `orgs` | Organization CRUD | `list`, `create`, `get`, `update`, `delete`, `members` |
| `ws` | Workspace management | `list`, `create`, `get`, `update`, `delete`, `members` |
| `jobs` | Launch & manage jobs | `launch`, `list`, `get`, `logs`, `terminate` |
| `analysis` | Analysis tool catalog | `list`, `create`, `get`, `update`, `delete`, `pin`, `schema`, `tags` |
| `studio` | Studio tool catalog | `list`, `create`, `get`, `update`, `delete`, `pin`, `schema`, `tags` |
| `use` | Set active context | Interactive or `--org-id`, `--workspace-id`, `--prefix` |
| — | File commands | `ls`, `cd`, `pwd`, `rm`, `mv`, `upload`, `download`, `env`, `whoami` |

## Python SDK

```python
from omicslab import Client

client = Client()  # reads OMICSLAB_TOKEN env or config

# List workspaces
workspaces = client.workspaces.list()

# Launch a job
job = client.jobs.launch_analysis(
    workspace_id="...",
    analysis_id="...",
    compute_id="...",
    params={"threads": 8},
)

# Storage operations
files = client.storage.list("workspace_id", prefix="data/")
url = client.storage.get_upload_url("workspace_id", "data/input.fastq")
```

## Environment Variables

| Variable | Purpose |
|---|---|
| `OMICSLAB_TOKEN` | API token (overrides config file) |
| `OMICSLAB_BASE_URL` | API base URL (default: `https://platform.omicslab.io/api`) |

Configuration is stored at `~/.omicslab/config.json` and supports multiple named profiles.
