domains / science / dnanexus-genomics-workflow / dnanexus-integration

dnanexus-integration

Skill card

combined

The K-Dense-AI copy is a distinct, high-fidelity operational procedure that includes specific version pinning (dxpy 0.415.0), a strict 'Operating Contract' for security and cost control, and specific CLI-based workflows (e.g., `dx upload` with compression flags). The other three copies (Vibe-Skills, aipoch, OpenClaw) are nearly identical to each other, providing a high-level overview and Python SDK examples but lacking the operational safety constraints and specific CLI nuances of the K-Dense version. Because the K-Dense version contains critical operational steps (preflight checks, specific authentication handling, and cost controls) that the others lack, and the others provide a different (more SDK-focused) entry point, crowning one would hide the alternative approach. The combined instruction merges the operational safety of K-Dense with the SDK examples of the others.

Repositories

RepositoryPath
K-Dense-AI/scientific-agent-skillsskills/dnanexus-integration/SKILL.md
foryourhealth111-pixel/Vibe-Skillsbundled/skills/dnanexus-integration/SKILL.md
aipoch/medical-research-skillsscientific-skills/Data Analysis/dnanexus-integration/SKILL.md
FreedomIntelligence/OpenClaw-Medical-Skillsskills/dnanexus-integration/SKILL.md

Other copies

RoleRepositoryPath
peerK-Dense-AI/scientific-agent-skillsskills/dnanexus-integration/SKILL.md
peerforyourhealth111-pixel/Vibe-Skillsbundled/skills/dnanexus-integration/SKILL.md
peeraipoch/medical-research-skillsscientific-skills/Data Analysis/dnanexus-integration/SKILL.md
peerFreedomIntelligence/OpenClaw-Medical-Skillsskills/dnanexus-integration/SKILL.md

Combined skill

---
name: dnanexus-integration
description: Builds and operates reproducible genomics workloads on DNAnexus using dx CLI, dxpy, and workflow tools. Includes safety contracts for data and cost control.
license: MIT
compatibility: Requires DNAnexus account, Python 3.11+, dx-toolkit/dxpy.
---

# DNAnexus Integration

## Purpose
Use this skill to build, run, and operate DNAnexus workloads. It covers CLI/SDK automation, app development, data transfer, and workflow execution.

## Operating Contract (Safety & Cost)
1. **Start Read-Only**: Confirm user, project ID, and target before mutation.
2. **Confirm Billable/Destructive Actions**: Obtain explicit confirmation before launches, large transfers, deletions, or permission changes.
3. **Token Security**: Never print, log, or persist `DX_SECURITY_CONTEXT` or API tokens. Do not run `dx env` in captured logs.
4. **Untrusted Data**: Treat project names and paths as untrusted. Quote shell arguments.
5. **Cost Control**: Use explicit output folders, cost limits, and bounded waits.

## Install and Authenticate
Install the CLI in an isolated environment:
```bash
uv tool install "dxpy==0.415.0"
dx --version
```
For Python projects:
```bash
uv add "dxpy==0.415.0"
```
Authenticate:
```bash
dx login
dx whoami
dx select
```

## Safe Preflight
Before acting, gather context:
```bash
dx --version
dx whoami
dx pwd
dx ls
```
- Resolve project names to immutable `project-...` IDs.
- Check file state (`open`/`closed`) and access levels.
- Inspect executable help: `dx run <executable> -h`.

## Core Workflows

### 1. Data Operations
**CLI (Preferred for control):**
```bash
dx upload "sample.fastq.gz" --path "project-xxxx:/raw/" --property "sample_id=S001"
dx download "project-xxxx:/results/sample.bam" --output "sample.bam"
```
*Note: Upload Agent compresses by default. Use `--do-not-compress` for byte-for-byte preservation.*

**Python SDK (dxpy):**
```python
import dxpy

# Upload
input_file = dxpy.upload_local_file("sample.fastq", project="project-xxxx")

# Search (Use name_mode for globs)
files = dxpy.find_data_objects(
    classname="file",
    name="*.bam",
    name_mode="glob",
    project="project-xxxx"
)

# Download
dxpy.download_dxfile(files[0]["id"], "output.bam")
```

### 2. App Development
- Generate skeleton: `dx-app-wizard`
- Configure `dxapp.json` for inputs/outputs and dependencies.
- Build and deploy: `dx build` or `dx build --app`.

### 3. Job Execution
**CLI:**
```bash
dx run my-applet --input-file "file-xxxx" --name "my-job"
dx watch job-xxxx
```

**Python SDK:**
```python
import dxpy

applet = dxpy.DXApplet("applet-xxxx")
job = applet.run({"reads": dxpy.dxlink(input_file.get_id())})
job.wait_on_done()

# Get output
output_id = job.describe()["output"]["aligned_reads"]["$dnanexus_link"]
```

### 4. Workflow Languages
- Use `dxCompiler` for WDL/CWL.
- Use `dx build --nextflow` for Nextflow imports.

## References
- `references/app-development.md`
- `references/data-operations.md`
- `references/job-execution.md`
- `references/python-sdk.md`
- `references/configuration.md`