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
python3 -m 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: LatchBio Integration4---5# LatchBio Integration67## Overview89Latch 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.1011## Core Capabilities1213The Latch platform provides four main areas of functionality:1415### 1. Workflow Creation and Deployment16- Define serverless workflows using Python decorators17- Support for native Python, Nextflow, and Snakemake pipelines18- Automatic containerization with Docker19- Auto-generated no-code user interfaces20- Version control and reproducibility2122### 2. Data Management23- Cloud storage abstractions (LatchFile, LatchDir)24- Structured data organization with Registry (Projects → Tables → Records)25- Type-safe data operations with links and enums26- Automatic file transfer between local and cloud27- Glob pattern matching for file selection2829### 3. Resource Configuration30- Pre-configured task decorators (@small_task, @large_task, @small_gpu_task, @large_gpu_task)31- Custom resource specifications (CPU, memory, GPU, storage)32- GPU support (K80, V100, A100)33- Timeout and storage configuration34- Cost optimization strategies3536### 4. Verified Workflows37- Production-ready pre-built pipelines38- Bulk RNA-seq, DESeq2, pathway analysis39- AlphaFold and ColabFold for protein structure prediction40- Single-cell tools (ArchR, scVelo, emptyDropsR)41- CRISPR analysis, phylogenetics, and more4243## Quick Start4445### Installation and Setup4647```bash48# Install Latch SDK49python3 -m uv pip install latch5051# Login to Latch52latch login5354# Initialize a new workflow55latch init my-workflow5657# Register workflow to platform58latch register my-workflow59```6061**Prerequisites:**62- Docker installed and running63- Latch account credentials64- Python 3.8+6566### Basic Workflow Example6768```python69from latch import workflow, small_task70from latch.types import LatchFile7172@small_task73def process_file(input_file: LatchFile) -> LatchFile:74 """Process a single file"""75 # Processing logic76 return output_file7778@workflow79def my_workflow(input_file: LatchFile) -> LatchFile:80 """81 My bioinformatics workflow8283 Args:84 input_file: Input data file85 """86 return process_file(input_file=input_file)87```8889## When to Use This Skill9091This skill should be used when encountering any of the following scenarios:9293**Workflow Development:**94- "Create a Latch workflow for RNA-seq analysis"95- "Deploy my pipeline to Latch"96- "Convert my Nextflow pipeline to Latch"97- "Add GPU support to my workflow"98- Working with `@workflow`, `@task` decorators99100**Data Management:**101- "Organize my sequencing data in Latch Registry"102- "How do I use LatchFile and LatchDir?"103- "Set up sample tracking in Latch"104- Working with `latch:///` paths105106**Resource Configuration:**107- "Configure GPU for AlphaFold on Latch"108- "My task is running out of memory"109- "How do I optimize workflow costs?"110- Working with task decorators111112**Verified Workflows:**113- "Run AlphaFold on Latch"114- "Use DESeq2 for differential expression"115- "Available pre-built workflows"116- Using `latch.verified` module117118## Detailed Documentation119120This skill includes comprehensive reference documentation organized by capability:121122### references/workflow-creation.md123**Read this for:**124- Creating and registering workflows125- Task definition and decorators126- Supporting Python, Nextflow, Snakemake127- Launch plans and conditional sections128- Workflow execution (CLI and programmatic)129- Multi-step and parallel pipelines130- Troubleshooting registration issues131132**Key topics:**133- `latch init` and `latch register` commands134- `@workflow` and `@task` decorators135- LatchFile and LatchDir basics136- Type annotations and docstrings137- Launch plans with preset parameters138- Conditional UI sections139140### references/data-management.md141**Read this for:**142- Cloud storage with LatchFile and LatchDir143- Registry system (Projects, Tables, Records)144- Linked records and relationships145- Enum and typed columns146- Bulk operations and transactions147- Integration with workflows148- Account and workspace management149150**Key topics:**151- `latch:///` path format152- File transfer and glob patterns153- Creating and querying Registry tables154- Column types (string, number, file, link, enum)155- Record CRUD operations156- Workflow-Registry integration157158### references/resource-configuration.md159**Read this for:**160- Task resource decorators161- Custom CPU, memory, GPU configuration162- GPU types (K80, V100, A100)163- Timeout and storage settings164- Resource optimization strategies165- Cost-effective workflow design166- Monitoring and debugging167168**Key topics:**169- `@small_task`, `@large_task`, `@small_gpu_task`, `@large_gpu_task`170- `@custom_task` with precise specifications171- Multi-GPU configuration172- Resource selection by workload type173- Platform limits and quotas174175### references/verified-workflows.md176**Read this for:**177- Pre-built production workflows178- Bulk RNA-seq and DESeq2179- AlphaFold and ColabFold180- Single-cell analysis (ArchR, scVelo)181- CRISPR editing analysis182- Pathway enrichment183- Integration with custom workflows184185**Key topics:**186- `latch.verified` module imports187- Available verified workflows188- Workflow parameters and options189- Combining verified and custom steps190- Version management191192## Common Workflow Patterns193194### Complete RNA-seq Pipeline195196```python197from latch import workflow, small_task, large_task198from latch.types import LatchFile, LatchDir199200@small_task201def quality_control(fastq: LatchFile) -> LatchFile:202 """Run FastQC"""203 return qc_output204205@large_task206def alignment(fastq: LatchFile, genome: str) -> LatchFile:207 """STAR alignment"""208 return bam_output209210@small_task211def quantification(bam: LatchFile) -> LatchFile:212 """featureCounts"""213 return counts214215@workflow216def rnaseq_pipeline(217 input_fastq: LatchFile,218 genome: str,219 output_dir: LatchDir220) -> LatchFile:221 """RNA-seq analysis pipeline"""222 qc = quality_control(fastq=input_fastq)223 aligned = alignment(fastq=qc, genome=genome)224 return quantification(bam=aligned)225```226227### GPU-Accelerated Workflow228229```python230from latch import workflow, small_task, large_gpu_task231from latch.types import LatchFile232233@small_task234def preprocess(input_file: LatchFile) -> LatchFile:235 """Prepare data"""236 return processed237238@large_gpu_task239def gpu_computation(data: LatchFile) -> LatchFile:240 """GPU-accelerated analysis"""241 return results242243@workflow244def gpu_pipeline(input_file: LatchFile) -> LatchFile:245 """Pipeline with GPU tasks"""246 preprocessed = preprocess(input_file=input_file)247 return gpu_computation(data=preprocessed)248```249250### Registry-Integrated Workflow251252```python253from latch import workflow, small_task254from latch.registry.table import Table255from latch.registry.record import Record256from latch.types import LatchFile257258@small_task259def process_and_track(sample_id: str, table_id: str) -> str:260 """Process sample and update Registry"""261 # Get sample from registry262 table = Table.get(table_id=table_id)263 records = Record.list(table_id=table_id, filter={"sample_id": sample_id})264 sample = records[0]265266 # Process267 input_file = sample.values["fastq_file"]268 output = process(input_file)269270 # Update registry271 sample.update(values={"status": "completed", "result": output})272 return "Success"273274@workflow275def registry_workflow(sample_id: str, table_id: str):276 """Workflow integrated with Registry"""277 return process_and_track(sample_id=sample_id, table_id=table_id)278```279280## Best Practices281282### Workflow Design2831. Use type annotations for all parameters2842. Write clear docstrings (appear in UI)2853. Start with standard task decorators, scale up if needed2864. Break complex workflows into modular tasks2875. Implement proper error handling288289### Data Management2906. Use consistent folder structures2917. Define Registry schemas before bulk entry2928. Use linked records for relationships2939. Store metadata in Registry for traceability294295### Resource Configuration29610. Right-size resources (don't over-allocate)29711. Use GPU only when algorithms support it29812. Monitor execution metrics and optimize29913. Design for parallel execution when possible300301### Development Workflow30214. Test locally with Docker before registration30315. Use version control for workflow code30416. Document resource requirements30517. Profile workflows to determine actual needs306307## Troubleshooting308309### Common Issues310311**Registration Failures:**312- Ensure Docker is running313- Check authentication with `latch login`314- Verify all dependencies in Dockerfile315- Use `--verbose` flag for detailed logs316317**Resource Problems:**318- Out of memory: Increase memory in task decorator319- Timeouts: Increase timeout parameter320- Storage issues: Increase ephemeral storage_gib321322**Data Access:**323- Use correct `latch:///` path format324- Verify file exists in workspace325- Check permissions for shared workspaces326327**Type Errors:**328- Add type annotations to all parameters329- Use LatchFile/LatchDir for file/directory parameters330- Ensure workflow return type matches actual return331332## Additional Resources333334- **Official Documentation**: https://docs.latch.bio335- **GitHub Repository**: https://github.com/latchbio/latch336- **Slack Community**: Join Latch SDK workspace337- **API Reference**: https://docs.latch.bio/api/latch.html338- **Blog**: https://blog.latch.bio339340## Support341342For issues or questions:3431. Check documentation links above3442. Search GitHub issues3453. Ask in Slack community3464. Contact support@latch.bio