LatchBio Integration
Overview
Latch is a Python framework for building and deploying bioinformatics workflows as serverless pipelines. Built on Flyte, create workflows with @workflow/@task decorators, manage cloud data with LatchFile/LatchDir, configure resources, and integrate Nextflow/Snakemake pipelines.
Core Capabilities
The Latch platform provides four main areas of functionality:
1. Workflow Creation and Deployment
- Define serverless workflows using Python decorators
- Support for native Python, Nextflow, and Snakemake pipelines
- Automatic containerization with Docker
- Auto-generated no-code user interfaces
- Version control and reproducibility
2. Data Management
- Cloud storage abstractions (LatchFile, LatchDir)
- Structured data organization with Registry (Projects → Tables → Records)
- Type-safe data operations with links and enums
- Automatic file transfer between local and cloud
- Glob pattern matching for file selection
3. Resource Configuration
- Pre-configured task decorators (@small_task, @large_task, @small_gpu_task, @large_gpu_task)
- Custom resource specifications (CPU, memory, GPU, storage)
- GPU support (K80, V100, A100)
- Timeout and storage configuration
- Cost optimization strategies
4. Verified Workflows
- Production-ready pre-built pipelines
- Bulk RNA-seq, DESeq2, pathway analysis
- AlphaFold and ColabFold for protein structure prediction
- Single-cell tools (ArchR, scVelo, emptyDropsR)
- CRISPR analysis, phylogenetics, and more
Quick Start
Installation and Setup
# Install Latch SDK
uv pip install latch
# Login to Latch
latch login
# Initialize a new workflow
latch init my-workflow
# Register workflow to platform
latch register my-workflow
Prerequisites:
- Docker installed and running
- Latch account credentials
- Python 3.8+
Basic Workflow Example
from latch import workflow, small_task
from latch.types import LatchFile
@small_task
def process_file(input_file: LatchFile) -> LatchFile:
"""Process a single file"""
# Processing logic
return output_file
@workflow
def my_workflow(input_file: LatchFile) -> LatchFile:
"""
My bioinformatics workflow
Args:
input_file: Input data file
"""
return process_file(input_file=input_file)
When to Use This Skill
This skill should be used when encountering any of the following scenarios:
Workflow Development:
- "Create a Latch workflow for RNA-seq analysis"
- "Deploy my pipeline to Latch"
- "Convert my Nextflow pipeline to Latch"
- "Add GPU support to my workflow"
- Working with
@workflow, @task decorators
Data Management:
- "Organize my sequencing data in Latch Registry"
- "How do I use LatchFile and LatchDir?"
- "Set up sample tracking in Latch"
- Working with
latch:/// paths
Resource Configuration:
- "Configure GPU for AlphaFold on Latch"
- "My task is running out of memory"
- "How do I optimize workflow costs?"
- Working with task decorators
Verified Workflows:
- "Run AlphaFold on Latch"
- "Use DESeq2 for differential expression"
- "Available pre-built workflows"
- Using
latch.verified module
Detailed Documentation
This skill includes comprehensive reference documentation organized by capability:
references/workflow-creation.md
Read this for:
- Creating and registering workflows
- Task definition and decorators
- Supporting Python, Nextflow, Snakemake
- Launch plans and conditional sections
- Workflow execution (CLI and programmatic)
- Multi-step and parallel pipelines
- Troubleshooting registration issues
Key topics:
latch init and latch register commands
@workflow and @task decorators
- LatchFile and LatchDir basics
- Type annotations and docstrings
- Launch plans with preset parameters
- Conditional UI sections
references/data-management.md
Read this for:
- Cloud storage with LatchFile and LatchDir
- Registry system (Projects, Tables, Records)
- Linked records and relationships
- Enum and typed columns
- Bulk operations and transactions
- Integration with workflows
- Account and workspace management
Key topics:
latch:/// path format
- File transfer and glob patterns
- Creating and querying Registry tables
- Column types (string, number, file, link, enum)
- Record CRUD operations
- Workflow-Registry integration
references/resource-configuration.md
Read this for:
- Task resource decorators
- Custom CPU, memory, GPU configuration
- GPU types (K80, V100, A100)
- Timeout and storage settings
- Resource optimization strategies
- Cost-effective workflow design
- Monitoring and debugging
Key topics:
@small_task, @large_task, @small_gpu_task, @large_gpu_task
@custom_task with precise specifications
- Multi-GPU configuration
- Resource selection by workload type
- Platform limits and quotas
references/verified-workflows.md
Read this for:
- Pre-built production workflows
- Bulk RNA-seq and DESeq2
- AlphaFold and ColabFold
- Single-cell analysis (ArchR, scVelo)
- CRISPR editing analysis
- Pathway enrichment
- Integration with custom workflows
Key topics:
latch.verified module imports
- Available verified workflows
- Workflow parameters and options
- Combining verified and custom steps
- Version management
Common Workflow Patterns
Complete RNA-seq Pipeline
from latch import workflow, small_task, large_task
from latch.types import LatchFile, LatchDir
@small_task
def quality_control(fastq: LatchFile) -> LatchFile:
"""Run FastQC"""
return qc_output
@large_task
def alignment(fastq: LatchFile, genome: str) -> LatchFile:
"""STAR alignment"""
return bam_output
@small_task
def quantification(bam: LatchFile) -> LatchFile:
"""featureCounts"""
return counts
@workflow
def rnaseq_pipeline(
input_fastq: LatchFile,
genome: str,
output_dir: LatchDir
) -> LatchFile:
"""RNA-seq analysis pipeline"""
qc = quality_control(fastq=input_fastq)
aligned = alignment(fastq=qc, genome=genome)
return quantification(bam=aligned)
GPU-Accelerated Workflow
from latch import workflow, small_task, large_gpu_task
from latch.types import LatchFile
@small_task
def preprocess(input_file: LatchFile) -> LatchFile:
"""Prepare data"""
return processed
@large_gpu_task
def gpu_computation(data: LatchFile) -> LatchFile:
"""GPU-accelerated analysis"""
return results
@workflow
def gpu_pipeline(input_file: LatchFile) -> LatchFile:
"""Pipeline with GPU tasks"""
preprocessed = preprocess(input_file=input_file)
return gpu_computation(data=preprocessed)
Registry-Integrated Workflow
from latch import workflow, small_task
from latch.registry.table import Table
from latch.registry.record import Record
from latch.types import LatchFile
@small_task
def process_and_track(sample_id: str, table_id: str) -> str:
"""Process sample and update Registry"""
# Get sample from registry
table = Table.get(table_id=table_id)
records = Record.list(table_id=table_id, filter={"sample_id": sample_id})
sample = records[0]
# Process
input_file = sample.values["fastq_file"]
output = process(input_file)
# Update registry
sample.update(values={"status": "completed", "result": output})
return "Success"
@workflow
def registry_workflow(sample_id: str, table_id: str):
"""Workflow integrated with Registry"""
return process_and_track(sample_id=sample_id, table_id=table_id)
Best Practices
Workflow Design
- Use type annotations for all parameters
- Write clear docstrings (appear in UI)
- Start with standard task decorators, scale up if needed
- Break complex workflows into modular tasks
- Implement proper error handling
Data Management
- Use consistent folder structures
- Define Registry schemas before bulk entry
- Use linked records for relationships
- Store metadata in Registry for traceability
Resource Configuration
- Right-size resources (don't over-allocate)
- Use GPU only when algorithms support it
- Monitor execution metrics and optimize
- Design for parallel execution when possible
Development Workflow
- Test locally with Docker before registration
- Use version control for workflow code
- Document resource requirements
- Profile workflows to determine actual needs
Troubleshooting
Common Issues
Registration Failures:
- Ensure Docker is running
- Check authentication with
latch login
- Verify all dependencies in Dockerfile
- Use
--verbose flag for detailed logs
Resource Problems:
- Out of memory: Increase memory in task decorator
- Timeouts: Increase timeout parameter
- Storage issues: Increase ephemeral storage_gib
Data Access:
- Use correct
latch:/// path format
- Verify file exists in workspace
- Check permissions for shared workspaces
Type Errors:
- Add type annotations to all parameters
- Use LatchFile/LatchDir for file/directory parameters
- Ensure workflow return type matches actual return
Additional Resources
Support
For issues or questions:
- Check documentation links above
- Search GitHub issues
- Ask in Slack community
- Contact support@latch.bio
1---2name: latchbio-integration3description: Latch platform for bioinformatics workflows. Build pipelines with Latch SDK, @workflow/@task decorators, deploy serverless workflows, LatchFile/LatchDir, Nextflow/Snakemake integration.4license: Unknown5---6
7# LatchBio Integration
8
9## Overview
10
11Latch is a Python framework for building and deploying bioinformatics workflows as serverless pipelines. Built on Flyte, create workflows with @workflow/@task decorators, manage cloud data with LatchFile/LatchDir, configure resources, and integrate Nextflow/Snakemake pipelines.
12
13## Core Capabilities
14
15The Latch platform provides four main areas of functionality:
16
17### 1. Workflow Creation and Deployment
18- Define serverless workflows using Python decorators
19- Support for native Python, Nextflow, and Snakemake pipelines
20- Automatic containerization with Docker
21- Auto-generated no-code user interfaces
22- Version control and reproducibility
23
24### 2. Data Management
25- Cloud storage abstractions (LatchFile, LatchDir)
26- Structured data organization with Registry (Projects → Tables → Records)
27- Type-safe data operations with links and enums
28- Automatic file transfer between local and cloud
29- Glob pattern matching for file selection
30
31### 3. Resource Configuration
32- Pre-configured task decorators (@small_task, @large_task, @small_gpu_task, @large_gpu_task)
33- Custom resource specifications (CPU, memory, GPU, storage)
34- GPU support (K80, V100, A100)
35- Timeout and storage configuration
36- Cost optimization strategies
37
38### 4. Verified Workflows
39- Production-ready pre-built pipelines
40- Bulk RNA-seq, DESeq2, pathway analysis
41- AlphaFold and ColabFold for protein structure prediction
42- Single-cell tools (ArchR, scVelo, emptyDropsR)
43- CRISPR analysis, phylogenetics, and more
44
45## Quick Start
46
47### Installation and Setup
48
49```bash
50# Install Latch SDK
51uv pip install latch
52
53# Login to Latch
54latch login
55
56# Initialize a new workflow
57latch init my-workflow
58
59# Register workflow to platform
60latch register my-workflow
61```
62
63**Prerequisites:**
64- Docker installed and running
65- Latch account credentials
66- Python 3.8+
67
68### Basic Workflow Example
69
70```python
71from latch import workflow, small_task
72from latch.types import LatchFile
73
74@small_task
75def process_file(input_file: LatchFile) -> LatchFile:
76 """Process a single file"""
77 # Processing logic
78 return output_file
79
80@workflow
81def my_workflow(input_file: LatchFile) -> LatchFile:
82 """
83 My bioinformatics workflow
84
85 Args:
86 input_file: Input data file
87 """
88 return process_file(input_file=input_file)
89```
90
91## When to Use This Skill
92
93This skill should be used when encountering any of the following scenarios:
94
95**Workflow Development:**
96- "Create a Latch workflow for RNA-seq analysis"
97- "Deploy my pipeline to Latch"
98- "Convert my Nextflow pipeline to Latch"
99- "Add GPU support to my workflow"
100- Working with `@workflow`, `@task` decorators
101
102**Data Management:**
103- "Organize my sequencing data in Latch Registry"
104- "How do I use LatchFile and LatchDir?"
105- "Set up sample tracking in Latch"
106- Working with `latch:///` paths
107
108**Resource Configuration:**
109- "Configure GPU for AlphaFold on Latch"
110- "My task is running out of memory"
111- "How do I optimize workflow costs?"
112- Working with task decorators
113
114**Verified Workflows:**
115- "Run AlphaFold on Latch"
116- "Use DESeq2 for differential expression"
117- "Available pre-built workflows"
118- Using `latch.verified` module
119
120## Detailed Documentation
121
122This skill includes comprehensive reference documentation organized by capability:
123
124### references/workflow-creation.md
125**Read this for:**
126- Creating and registering workflows
127- Task definition and decorators
128- Supporting Python, Nextflow, Snakemake
129- Launch plans and conditional sections
130- Workflow execution (CLI and programmatic)
131- Multi-step and parallel pipelines
132- Troubleshooting registration issues
133
134**Key topics:**
135- `latch init` and `latch register` commands
136- `@workflow` and `@task` decorators
137- LatchFile and LatchDir basics
138- Type annotations and docstrings
139- Launch plans with preset parameters
140- Conditional UI sections
141
142### references/data-management.md
143**Read this for:**
144- Cloud storage with LatchFile and LatchDir
145- Registry system (Projects, Tables, Records)
146- Linked records and relationships
147- Enum and typed columns
148- Bulk operations and transactions
149- Integration with workflows
150- Account and workspace management
151
152**Key topics:**
153- `latch:///` path format
154- File transfer and glob patterns
155- Creating and querying Registry tables
156- Column types (string, number, file, link, enum)
157- Record CRUD operations
158- Workflow-Registry integration
159
160### references/resource-configuration.md
161**Read this for:**
162- Task resource decorators
163- Custom CPU, memory, GPU configuration
164- GPU types (K80, V100, A100)
165- Timeout and storage settings
166- Resource optimization strategies
167- Cost-effective workflow design
168- Monitoring and debugging
169
170**Key topics:**
171- `@small_task`, `@large_task`, `@small_gpu_task`, `@large_gpu_task`
172- `@custom_task` with precise specifications
173- Multi-GPU configuration
174- Resource selection by workload type
175- Platform limits and quotas
176
177### references/verified-workflows.md
178**Read this for:**
179- Pre-built production workflows
180- Bulk RNA-seq and DESeq2
181- AlphaFold and ColabFold
182- Single-cell analysis (ArchR, scVelo)
183- CRISPR editing analysis
184- Pathway enrichment
185- Integration with custom workflows
186
187**Key topics:**
188- `latch.verified` module imports
189- Available verified workflows
190- Workflow parameters and options
191- Combining verified and custom steps
192- Version management
193
194## Common Workflow Patterns
195
196### Complete RNA-seq Pipeline
197
198```python
199from latch import workflow, small_task, large_task
200from latch.types import LatchFile, LatchDir
201
202@small_task
203def quality_control(fastq: LatchFile) -> LatchFile:
204 """Run FastQC"""
205 return qc_output
206
207@large_task
208def alignment(fastq: LatchFile, genome: str) -> LatchFile:
209 """STAR alignment"""
210 return bam_output
211
212@small_task
213def quantification(bam: LatchFile) -> LatchFile:
214 """featureCounts"""
215 return counts
216
217@workflow
218def rnaseq_pipeline(
219 input_fastq: LatchFile,
220 genome: str,
221 output_dir: LatchDir
222) -> LatchFile:
223 """RNA-seq analysis pipeline"""
224 qc = quality_control(fastq=input_fastq)
225 aligned = alignment(fastq=qc, genome=genome)
226 return quantification(bam=aligned)
227```
228
229### GPU-Accelerated Workflow
230
231```python
232from latch import workflow, small_task, large_gpu_task
233from latch.types import LatchFile
234
235@small_task
236def preprocess(input_file: LatchFile) -> LatchFile:
237 """Prepare data"""
238 return processed
239
240@large_gpu_task
241def gpu_computation(data: LatchFile) -> LatchFile:
242 """GPU-accelerated analysis"""
243 return results
244
245@workflow
246def gpu_pipeline(input_file: LatchFile) -> LatchFile:
247 """Pipeline with GPU tasks"""
248 preprocessed = preprocess(input_file=input_file)
249 return gpu_computation(data=preprocessed)
250```
251
252### Registry-Integrated Workflow
253
254```python
255from latch import workflow, small_task
256from latch.registry.table import Table
257from latch.registry.record import Record
258from latch.types import LatchFile
259
260@small_task
261def process_and_track(sample_id: str, table_id: str) -> str:
262 """Process sample and update Registry"""
263 # Get sample from registry
264 table = Table.get(table_id=table_id)
265 records = Record.list(table_id=table_id, filter={"sample_id": sample_id})
266 sample = records[0]
267
268 # Process
269 input_file = sample.values["fastq_file"]
270 output = process(input_file)
271
272 # Update registry
273 sample.update(values={"status": "completed", "result": output})
274 return "Success"
275
276@workflow
277def registry_workflow(sample_id: str, table_id: str):
278 """Workflow integrated with Registry"""
279 return process_and_track(sample_id=sample_id, table_id=table_id)
280```
281
282## Best Practices
283
284### Workflow Design
2851. Use type annotations for all parameters
2862. Write clear docstrings (appear in UI)
2873. Start with standard task decorators, scale up if needed
2884. Break complex workflows into modular tasks
2895. Implement proper error handling
290
291### Data Management
2926. Use consistent folder structures
2937. Define Registry schemas before bulk entry
2948. Use linked records for relationships
2959. Store metadata in Registry for traceability
296
297### Resource Configuration
29810. Right-size resources (don't over-allocate)
29911. Use GPU only when algorithms support it
30012. Monitor execution metrics and optimize
30113. Design for parallel execution when possible
302
303### Development Workflow
30414. Test locally with Docker before registration
30515. Use version control for workflow code
30616. Document resource requirements
30717. Profile workflows to determine actual needs
308
309## Troubleshooting
310
311### Common Issues
312
313**Registration Failures:**
314- Ensure Docker is running
315- Check authentication with `latch login`
316- Verify all dependencies in Dockerfile
317- Use `--verbose` flag for detailed logs
318
319**Resource Problems:**
320- Out of memory: Increase memory in task decorator
321- Timeouts: Increase timeout parameter
322- Storage issues: Increase ephemeral storage_gib
323
324**Data Access:**
325- Use correct `latch:///` path format
326- Verify file exists in workspace
327- Check permissions for shared workspaces
328
329**Type Errors:**
330- Add type annotations to all parameters
331- Use LatchFile/LatchDir for file/directory parameters
332- Ensure workflow return type matches actual return
333
334## Additional Resources
335
336- **Official Documentation**: https://docs.latch.bio
337- **GitHub Repository**: https://github.com/latchbio/latch
338- **Slack Community**: Join Latch SDK workspace
339- **API Reference**: https://docs.latch.bio/api/latch.html
340- **Blog**: https://blog.latch.bio
341
342## Support
343
344For issues or questions:
3451. Check documentation links above
3462. Search GitHub issues
3473. Ask in Slack community
3484. Contact support@latch.bio
349