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: Latch platform for bioinformatics workflows. Build pipelines with Latch SDK, @workflow/@task decorators, deploy serverless workflows, LatchFile/LatchDir, Nextflow/Snakemake integration.4license: Unknown5metadata:6 source: https://skillmd.com/skills/levalencia/latchbio-integration7 skill-author: K-Dense Inc.8---910# LatchBio Integration1112## Overview1314Latch 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.1516## Core Capabilities1718The Latch platform provides four main areas of functionality:1920### 1. Workflow Creation and Deployment21- Define serverless workflows using Python decorators22- Support for native Python, Nextflow, and Snakemake pipelines23- Automatic containerization with Docker24- Auto-generated no-code user interfaces25- Version control and reproducibility2627### 2. Data Management28- Cloud storage abstractions (LatchFile, LatchDir)29- Structured data organization with Registry (Projects → Tables → Records)30- Type-safe data operations with links and enums31- Automatic file transfer between local and cloud32- Glob pattern matching for file selection3334### 3. Resource Configuration35- Pre-configured task decorators (@small_task, @large_task, @small_gpu_task, @large_gpu_task)36- Custom resource specifications (CPU, memory, GPU, storage)37- GPU support (K80, V100, A100)38- Timeout and storage configuration39- Cost optimization strategies4041### 4. Verified Workflows42- Production-ready pre-built pipelines43- Bulk RNA-seq, DESeq2, pathway analysis44- AlphaFold and ColabFold for protein structure prediction45- Single-cell tools (ArchR, scVelo, emptyDropsR)46- CRISPR analysis, phylogenetics, and more4748## Quick Start4950### Installation and Setup5152```bash53# Install Latch SDK54python3 -m uv pip install latch5556# Login to Latch57latch login5859# Initialize a new workflow60latch init my-workflow6162# Register workflow to platform63latch register my-workflow64```6566**Prerequisites:**67- Docker installed and running68- Latch account credentials69- Python 3.8+7071### Basic Workflow Example7273```python74from latch import workflow, small_task75from latch.types import LatchFile7677@small_task78def process_file(input_file: LatchFile) -> LatchFile:79 """Process a single file"""80 # Processing logic81 return output_file8283@workflow84def my_workflow(input_file: LatchFile) -> LatchFile:85 """86 My bioinformatics workflow8788 Args:89 input_file: Input data file90 """91 return process_file(input_file=input_file)92```9394## When to Use This Skill9596This skill should be used when encountering any of the following scenarios:9798**Workflow Development:**99- "Create a Latch workflow for RNA-seq analysis"100- "Deploy my pipeline to Latch"101- "Convert my Nextflow pipeline to Latch"102- "Add GPU support to my workflow"103- Working with `@workflow`, `@task` decorators104105**Data Management:**106- "Organize my sequencing data in Latch Registry"107- "How do I use LatchFile and LatchDir?"108- "Set up sample tracking in Latch"109- Working with `latch:///` paths110111**Resource Configuration:**112- "Configure GPU for AlphaFold on Latch"113- "My task is running out of memory"114- "How do I optimize workflow costs?"115- Working with task decorators116117**Verified Workflows:**118- "Run AlphaFold on Latch"119- "Use DESeq2 for differential expression"120- "Available pre-built workflows"121- Using `latch.verified` module122123## Detailed Documentation124125This skill includes comprehensive reference documentation organized by capability:126127### references/workflow-creation.md128**Read this for:**129- Creating and registering workflows130- Task definition and decorators131- Supporting Python, Nextflow, Snakemake132- Launch plans and conditional sections133- Workflow execution (CLI and programmatic)134- Multi-step and parallel pipelines135- Troubleshooting registration issues136137**Key topics:**138- `latch init` and `latch register` commands139- `@workflow` and `@task` decorators140- LatchFile and LatchDir basics141- Type annotations and docstrings142- Launch plans with preset parameters143- Conditional UI sections144145### references/data-management.md146**Read this for:**147- Cloud storage with LatchFile and LatchDir148- Registry system (Projects, Tables, Records)149- Linked records and relationships150- Enum and typed columns151- Bulk operations and transactions152- Integration with workflows153- Account and workspace management154155**Key topics:**156- `latch:///` path format157- File transfer and glob patterns158- Creating and querying Registry tables159- Column types (string, number, file, link, enum)160- Record CRUD operations161- Workflow-Registry integration162163### references/resource-configuration.md164**Read this for:**165- Task resource decorators166- Custom CPU, memory, GPU configuration167- GPU types (K80, V100, A100)168- Timeout and storage settings169- Resource optimization strategies170- Cost-effective workflow design171- Monitoring and debugging172173**Key topics:**174- `@small_task`, `@large_task`, `@small_gpu_task`, `@large_gpu_task`175- `@custom_task` with precise specifications176- Multi-GPU configuration177- Resource selection by workload type178- Platform limits and quotas179180### references/verified-workflows.md181**Read this for:**182- Pre-built production workflows183- Bulk RNA-seq and DESeq2184- AlphaFold and ColabFold185- Single-cell analysis (ArchR, scVelo)186- CRISPR editing analysis187- Pathway enrichment188- Integration with custom workflows189190**Key topics:**191- `latch.verified` module imports192- Available verified workflows193- Workflow parameters and options194- Combining verified and custom steps195- Version management196197## Common Workflow Patterns198199### Complete RNA-seq Pipeline200201```python202from latch import workflow, small_task, large_task203from latch.types import LatchFile, LatchDir204205@small_task206def quality_control(fastq: LatchFile) -> LatchFile:207 """Run FastQC"""208 return qc_output209210@large_task211def alignment(fastq: LatchFile, genome: str) -> LatchFile:212 """STAR alignment"""213 return bam_output214215@small_task216def quantification(bam: LatchFile) -> LatchFile:217 """featureCounts"""218 return counts219220@workflow221def rnaseq_pipeline(222 input_fastq: LatchFile,223 genome: str,224 output_dir: LatchDir225) -> LatchFile:226 """RNA-seq analysis pipeline"""227 qc = quality_control(fastq=input_fastq)228 aligned = alignment(fastq=qc, genome=genome)229 return quantification(bam=aligned)230```231232### GPU-Accelerated Workflow233234```python235from latch import workflow, small_task, large_gpu_task236from latch.types import LatchFile237238@small_task239def preprocess(input_file: LatchFile) -> LatchFile:240 """Prepare data"""241 return processed242243@large_gpu_task244def gpu_computation(data: LatchFile) -> LatchFile:245 """GPU-accelerated analysis"""246 return results247248@workflow249def gpu_pipeline(input_file: LatchFile) -> LatchFile:250 """Pipeline with GPU tasks"""251 preprocessed = preprocess(input_file=input_file)252 return gpu_computation(data=preprocessed)253```254255### Registry-Integrated Workflow256257```python258from latch import workflow, small_task259from latch.registry.table import Table260from latch.registry.record import Record261from latch.types import LatchFile262263@small_task264def process_and_track(sample_id: str, table_id: str) -> str:265 """Process sample and update Registry"""266 # Get sample from registry267 table = Table.get(table_id=table_id)268 records = Record.list(table_id=table_id, filter={"sample_id": sample_id})269 sample = records[0]270271 # Process272 input_file = sample.values["fastq_file"]273 output = process(input_file)274275 # Update registry276 sample.update(values={"status": "completed", "result": output})277 return "Success"278279@workflow280def registry_workflow(sample_id: str, table_id: str):281 """Workflow integrated with Registry"""282 return process_and_track(sample_id=sample_id, table_id=table_id)283```284285## Best Practices286287### Workflow Design2881. Use type annotations for all parameters2892. Write clear docstrings (appear in UI)2903. Start with standard task decorators, scale up if needed2914. Break complex workflows into modular tasks2925. Implement proper error handling293294### Data Management2956. Use consistent folder structures2967. Define Registry schemas before bulk entry2978. Use linked records for relationships2989. Store metadata in Registry for traceability299300### Resource Configuration30110. Right-size resources (don't over-allocate)30211. Use GPU only when algorithms support it30312. Monitor execution metrics and optimize30413. Design for parallel execution when possible305306### Development Workflow30714. Test locally with Docker before registration30815. Use version control for workflow code30916. Document resource requirements31017. Profile workflows to determine actual needs311312## Troubleshooting313314### Common Issues315316**Registration Failures:**317- Ensure Docker is running318- Check authentication with `latch login`319- Verify all dependencies in Dockerfile320- Use `--verbose` flag for detailed logs321322**Resource Problems:**323- Out of memory: Increase memory in task decorator324- Timeouts: Increase timeout parameter325- Storage issues: Increase ephemeral storage_gib326327**Data Access:**328- Use correct `latch:///` path format329- Verify file exists in workspace330- Check permissions for shared workspaces331332**Type Errors:**333- Add type annotations to all parameters334- Use LatchFile/LatchDir for file/directory parameters335- Ensure workflow return type matches actual return336337## Additional Resources338339- **Official Documentation**: https://docs.latch.bio340- **GitHub Repository**: https://github.com/latchbio/latch341- **Slack Community**: Join Latch SDK workspace342- **API Reference**: https://docs.latch.bio/api/latch.html343- **Blog**: https://blog.latch.bio344345## Support346347For issues or questions:3481. Check documentation links above3492. Search GitHub issues3503. Ask in Slack community3514. Contact support@latch.bio352