Generated banner for Nextflow Development
Generated logo for Nextflow Development

Nextflow Development

AnthropicOfficialPublished by Anthropic

  • Skill
  • Workflow
  • Science and research
  • Apache-2.0
  • Medium risk
  • Has scripts

From the author

Run nf-core bioinformatics pipelines (rnaseq, sarek, atacseq) on sequencing data. Use when analyzing RNA-seq, WGS/WES, or ATAC-seq data—either local FASTQs or public datasets from GEO/SRA. Triggers on nf-core, Nextflow, FASTQ analysis, variant calling, gene expression, differential expression, GEO reanalysis, GSE/GSM/SRR accessions, or samplesheet creation.
— the description by Anthropic

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured workflow for researchers to execute nf-core bioinformatics pipelines. It guides users through environment validation, data acquisition from public repositories like GEO/SRA or local sources, samplesheet generation, and pipeline execution. It supports standard omics analyses including gene expression, variant calling, and chromatin accessibility, while ensuring the computing environment is correctly configured with Docker and Nextflow.

What it does

  • Validates system requirements including Docker, Nextflow, and Java versions.
  • Fetches and prepares public sequencing data from GEO/SRA accessions.
  • Automates the creation and validation of pipeline-specific samplesheets.
  • Executes nf-core pipelines for RNA-seq, Sarek, and ATAC-seq workflows.
  • Manages reference genome downloads and configuration.
  • Verifies analysis outputs and pipeline completion logs.

When to use it

  • When you need to perform large-scale omics analysis on local FASTQ files.
  • When reanalyzing public datasets from GEO/SRA.
  • When you require a standardized, reproducible pipeline for RNA-seq, WGS/WES, or ATAC-seq.
  • When setting up a new bioinformatics environment for nf-core pipeline execution.

Advantages

  • Standardizes bioinformatics workflows for non-specialists.
  • Reduces manual errors in samplesheet creation and environment setup.
  • Provides clear decision points for pipeline selection and configuration.
  • Includes built-in validation steps to ensure pipeline success.
  • Simplifies the integration of public data into local analysis pipelines.

Usage examples

“Run the rnaseq pipeline on my local FASTQ files.”
The agent will check your environment, help you generate a samplesheet, confirm the genome, and execute the nf-core/rnaseq pipeline.
“Analyze the public dataset GSE110004.”
The agent will fetch the study metadata, download the relevant FASTQ files, create the necessary samplesheet, and prepare the pipeline for execution.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/anthropics/nextflow-development/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip nextflow-development.zip -d .agents/skills

Documentation by Anthropic

nf-core Pipeline Deployment

Run nf-core bioinformatics pipelines on local or public sequencing data.

Target users: Bench scientists and researchers without specialized bioinformatics training who need to run large-scale omics analyses—differential expression, variant calling, or chromatin accessibility analysis.

Workflow Checklist

- [ ] Step 0: Acquire data (if from GEO/SRA)
- [ ] Step 1: Environment check (MUST pass)
- [ ] Step 2: Select pipeline (confirm with user)
- [ ] Step 3: Run test profile (MUST pass)
- [ ] Step 4: Create samplesheet
- [ ] Step 5: Configure & run (confirm genome with user)
- [ ] Step 6: Verify outputs

Step 0: Acquire Data (GEO/SRA Only)

Skip this step if user has local FASTQ files.

For public datasets, fetch from GEO/SRA first. See references/geo-sra-acquisition.md for the full workflow.

Quick start:

# 1. Get study info
python scripts/sra_geo_fetch.py info GSE110004

# 2. Download (interactive mode)
python scripts/sra_geo_fetch.py download GSE110004 -o ./fastq -i

# 3. Generate samplesheet
python scripts/sra_geo_fetch.py samplesheet GSE110004 --fastq-dir ./fastq -o samplesheet.csv

DECISION POINT: After fetching study info, confirm with user:

  • Which sample subset to download (if multiple data types)

  • Suggested genome and pipeline

Then continue to Step 1.


Step 1: Environment Check

Run first. Pipeline will fail without passing environment.

python scripts/check_environment.py

All critical checks must pass. If any fail, provide fix instructions:

Docker issues
ProblemFix
Not installedInstall from https://docs.docker.com/get-docker/
Permission deniedsudo usermod -aG docker $USER then re-login
Daemon not runningsudo systemctl start docker
Nextflow issues
ProblemFix
Not installedcurl -s https://get.nextflow.io | bash && mv nextflow ~/bin/
Version < 23.04nextflow self-update
Java issues
ProblemFix
Not installed / < 11sudo apt install openjdk-11-jdk

Do not proceed until all checks pass. For HPC/Singularity, see references/troubleshooting.md.


Step 2: Select Pipeline

DECISION POINT: Confirm with user before proceeding.

Data TypePipelineVersionGoal
RNA-seqrnaseq3.22.2Gene expression
WGS/WESsarek3.7.1Variant calling
ATAC-seqatacseq2.1.2Chromatin accessibility

Auto-detect from data:

python scripts/detect_data_type.py /path/to/data

For pipeline-specific details:


Step 3: Run Test Profile

Validates environment with small data. MUST pass before real data.

nextflow run nf-core/<pipeline> -r <version> -profile test,docker --outdir test_output
PipelineCommand
rnaseqnextflow run nf-core/rnaseq -r 3.22.2 -profile test,docker --outdir test_rnaseq
sareknextflow run nf-core/sarek -r 3.7.1 -profile test,docker --outdir test_sarek
atacseqnextflow run nf-core/atacseq -r 2.1.2 -profile test,docker --outdir test_atacseq

Verify:

ls test_output/multiqc/multiqc_report.html
grep "Pipeline completed successfully" .nextflow.log

If test fails, see references/troubleshooting.md.


Step 4: Create Samplesheet

Generate automatically
python scripts/generate_samplesheet.py /path/to/data <pipeline> -o samplesheet.csv

The script:

  • Discovers FASTQ/BAM/CRAM files

  • Pairs R1/R2 reads

  • Infers sample metadata

  • Validates before writing

For sarek: Script prompts for tumor/normal status if not auto-detected.

Validate existing samplesheet
python scripts/generate_samplesheet.py --validate samplesheet.csv <pipeline>
Samplesheet formats

rnaseq:

sample,fastq_1,fastq_2,strandedness
SAMPLE1,/abs/path/R1.fq.gz,/abs/path/R2.fq.gz,auto

sarek:

patient,sample,lane,fastq_1,fastq_2,status
patient1,tumor,L001,/abs/path/tumor_R1.fq.gz,/abs/path/tumor_R2.fq.gz,1
patient1,normal,L001,/abs/path/normal_R1.fq.gz,/abs/path/normal_R2.fq.gz,0

atacseq:

sample,fastq_1,fastq_2,replicate
CONTROL,/abs/path/ctrl_R1.fq.gz,/abs/path/ctrl_R2.fq.gz,1

Step 5: Configure & Run

5a. Check genome availability
python scripts/manage_genomes.py check <genome>
# If not installed:
python scripts/manage_genomes.py download <genome>

Common genomes: GRCh38 (human), GRCh37 (legacy), GRCm39 (mouse), R64-1-1 (yeast), BDGP6 (fly)

5b. Decision points

DECISION POINT: Confirm with user:

  1. Genome: Which reference to use

  2. Pipeline-specific options:

    • rnaseq: aligner (star_salmon recommended, hisat2 for low memory)

    • sarek: tools (haplotypecaller for germline, mutect2 for somatic)

    • atacseq: read_length (50, 75, 100, or 150)

5c. Run pipeline
nextflow run nf-core/<pipeline> \
    -r <version> \
    -profile docker \
    --input samplesheet.csv \
    --outdir results \
    --genome <genome> \
    -resume

Key flags:

  • -r: Pin version

  • -profile docker: Use Docker (or singularity for HPC)

  • --genome: iGenomes key

  • -resume: Continue from checkpoint

Resource limits (if needed):

--max_cpus 8 --max_memory '32.GB' --max_time '24.h'

Step 6: Verify Outputs

Check completion
ls results/multiqc/multiqc_report.html
grep "Pipeline completed successfully" .nextflow.log
Key outputs by pipeline

rnaseq:

  • results/star_salmon/salmon.merged.gene_counts.tsv - Gene counts

  • results/star_salmon/salmon.merged.gene_tpm.tsv - TPM values

sarek:

  • results/variant_calling/*/ - VCF files

  • results/preprocessing/recalibrated/ - BAM files

atacseq:

  • results/macs2/narrowPeak/ - Peak calls

  • results/bwa/mergedLibrary/bigwig/ - Coverage tracks


Quick Reference

For common exit codes and fixes, see references/troubleshooting.md.

Resume failed run
nextflow run nf-core/<pipeline> -resume

References


Disclaimer

This skill is provided as a prototype example demonstrating how to integrate nf-core bioinformatics pipelines into Claude Code for automated analysis workflows. The current implementation supports three pipelines (rnaseq, sarek, and atacseq), serving as a foundation that enables the community to expand support to the full set of nf-core pipelines.

It is intended for educational and research purposes and should not be considered production-ready without appropriate validation for your specific use case. Users are responsible for ensuring their computing environment meets pipeline requirements and for verifying analysis results.

Anthropic does not guarantee the accuracy of bioinformatics outputs, and users should follow standard practices for validating computational analyses. This integration is not officially endorsed by or affiliated with the nf-core community.

Attribution

When publishing results, cite the appropriate pipeline. Citations are available in each nf-core repository's CITATIONS.md file (e.g., https://github.com/nf-core/rnaseq/blob/3.22.2/CITATIONS.md).

Licenses

Files

scripts/utils/sample_inference.py

"""
Sample name and metadata inference from filenames.

This module extracts sample information, detects tumor/normal status,
and matches R1/R2 read pairs from sequencing file names.
"""

import os
import re
from typing import Dict, List, Optional, Tuple


# R1/R2 patterns with priority scores (higher = more confident)
R1_PATTERNS = [
    (r'_R1_\d{3}', 10),      # _R1_001 (Illumina standard)
    (r'_R1[_.]', 8),         # _R1. or _R1_
    (r'\.R1[_.]', 8),        # .R1. or .R1_
    (r'_1[_.]', 5),          # _1. or _1_
    (r'_R1\.f', 6),          # _R1.fastq
    (r'_1\.f', 4),           # _1.fastq
]

R2_PATTERNS = [
    (r'_R2_\d{3}', 10),      # _R2_001 (Illumina standard)
    (r'_R2[_.]', 8),         # _R2. or _R2_
    (r'\.R2[_.]', 8),        # .R2. or .R2_
    (r'_2[_.]', 5),          # _2. or _2_
    (r'_R2\.f', 6),          # _R2.fastq
    (r'_2\.f', 4),           # _2.fastq
]

# Tumor/normal keywords
TUMOR_KEYWORDS = [
    r'\btumou?r\b',
    r'\bmetastasis\b',
    r'\bmet\b',
    r'\bprimary\b',
    r'\bcancer\b',
    r'\bmalignant\b',
    r'[-_]T[-_]',
    r'[-_]T\d*$',
    r'^T\d*[-_]',
]

NORMAL_KEYWORDS = [
    r'\bnormal\b',
    r'\bgermline\b',
    r'\bblood\b',
    r'\bpbmc\b',
    r'\bcontrol\b',
    r'\bhealthy\b',
    r'\bmatched\b',
    r'[-_]N[-_]',
    r'[-_]N\d*$',
    r'^N\d*[-_]',
]

# Lane pattern
LANE_PATTERN = r'[_.]L(\d{3})[_.]'

# Patient/sample extraction patterns
PATIENT_PATTERNS = [
    r'^(P\d+)[-_]',           # P001_sample
    r'^(patient\d+)[-_]',     # patient1_sample
    r'^(TCGA-\w+-\w+)',       # TCGA format
    r'^([A-Z]{2,3}\d{3,})[-_]',  # AB123_sample
]

# Replicate patterns
REPLICATE_PATTERNS = [
    r'[_.]rep(\d+)',          # _rep1, .rep2
    r'[_.]replicate(\d+)',    # _replicate1
    r'[_.]R(\d+)[_.]',        # _R1_ (but not R1/R2 for reads!)
    r'[-_](\d+)$',            # sample_1 (last resort)
]


def extract_sample_info(filepath: str) -> Dict[str, str]:
    """
    Extract sample metadata from filepath.

    Args:
        filepath: Path to sequencing file

    Returns:
        Dict with: sample, patient, lane (if detectable)
    """
    filename = os.path.basename(filepath)

    # Remove extensions
    stem = filename
    for ext in ['.fastq.gz', '.fq.gz', '.fastq', '.fq', '.bam', '.cram', '.bai', '.crai']:
        if stem.lower().endswith(ext):
            stem = stem[:-len(ext)]
            break

    info = {}

    # Extract lane
    lane_match = re.search(LANE_PATTERN, stem)
    info['lane'] = f"L{lane_match.group(1)}" if lane_match else "L001"

    # Remove lane from stem
    clean_stem = re.sub(LANE_PATTERN, '_', stem)

    # Remove R1/R2 indicators and everything after
    for pattern, _ in R1_PATTERNS + R2_PATTERNS:
        clean_stem = re.sub(pattern + r'.*', '', clean_stem, flags=re.IGNORECASE)

    # Clean up trailing/multiple underscores and dots
    clean_stem = re.sub(r'[_.-]+$', '', clean_stem)
    clean_stem = re.sub(r'[_.-]{2,}', '_', clean_stem)

    # Try to extract patient ID
    for pattern in PATIENT_PATTERNS:
        match = re.match(pattern, clean_stem, re.IGNORECASE)
        if match:
            info['patient'] = match.group(1)
            break

    # Sample is the cleaned stem
    info['sample'] = clean_stem if clean_stem else filename.split('.')[0]

    # Default patient to sample if not extracted
    if 'patient' not in info:
        info['patient'] = info['sample']

    return info


def infer_tumor_normal_status(sample_name: str) -> Optional[int]:
    """
    Infer tumor (1) or normal (0) status from sample name.

    Args:
        sample_name: Sample identifier

    Returns:
        1 for tumor, 0 for normal, None if cannot determine
    """
    name_lower = sample_name.lower()

    # Check tumor indicators
    for pattern in TUMOR_KEYWORDS:
        if re.search(pattern, name_lower, re.IGNORECASE):
            return 1

    # Check normal indicators
    for pattern in NORMAL_KEYWORDS:
        if re.search(pattern, name_lower, re.IGNORECASE):
            return 0

    return None


def extract_replicate_number(sample_name: str) -> Optional[int]:
    """
    Extract replicate number from sample name.

    Args:
        sample_name: Sample identifier

    Returns:
        Replicate number if found, None otherwise
    """
    for pattern in REPLICATE_PATTERNS:
        match = re.search(pattern, sample_name, re.IGNORECASE)
        if match:
            try:
                return int(match.group(1))
            except ValueError:
                continue
    return None


def _get_pattern_score(filename: str, patterns: List[Tuple[str, int]]) -> int:
    """Get highest matching pattern score."""
    max_score = 0
    for pattern, score in patterns:
        if re.search(pattern, filename, re.IGNORECASE):
            max_score = max(max_score, score)
    return max_score


def _get_sample_key(filepath: str) -> str:
    """Generate a key for grouping related files."""
    info = extract_sample_info(filepath)
    sample = info['sample']
    lane = info.get('lane', 'L001')

    # Include lane in key for multi-lane samples
    if lane != "L001":
        return f"{sample}_{lane}"
    return sample


def match_read_pairs(files) -> Dict[str, Dict]:
    """
    Match R1/R2 read pairs using scored pattern matching.

    Args:
        files: List of FileInfo objects (from file_discovery)

    Returns:
        Dict mapping sample_key to {'r1': path, 'r2': path, 'info': dict}
    """
    # Classify files
    r1_files = []
    r2_files = []

    for file in files:
        filename = file.name if hasattr(file, 'name') else os.path.basename(str(file))
        filepath = file.path if hasattr(file, 'path') else str(file)

        r1_score = _get_pattern_score(filename, R1_PATTERNS)
        r2_score = _get_pattern_score(filename, R2_PATTERNS)

        if r2_score > r1_score and r2_score > 0:
            r2_files.append((filepath, r2_score))
        elif r1_score > 0:
            r1_files.append((filepath, r1_score))
        else:
            # No clear indicator - assume R1 (single-end or non-standard naming)
            r1_files.append((filepath, 0))

    # Build pairs by matching sample keys
    pairs = {}

    # Process R1 files first
    for r1_path, score in r1_files:
        key = _get_sample_key(r1_path)
        info = extract_sample_info(r1_path)

        if key not in pairs:
            pairs[key] = {
                'r1': r1_path,
                'r2': None,
                'info': info,
                'score': score
            }
        else:
            # Multiple R1 files for same sample (should not happen)
            pairs[key]['r1'] = r1_path

    # Match R2 files
    for r2_path, score in r2_files:
        key = _get_sample_key(r2_path)
        info = extract_sample_info(r2_path)

        if key in pairs:
            pairs[key]['r2'] = r2_path
        else:
            # R2 without matching R1
            pairs[key] = {
                'r1': None,
                'r2': r2_path,
                'info': info,
                'score': score
            }

    return pairs


def infer_patient_groupings(sample_names: List[str]) -> Dict[str, str]:
    """
    Infer patient groupings from sample names.

    Groups samples that share a common prefix pattern.

    Args:
        sample_names: List of sample identifiers

    Returns:
        Dict mapping sample_name to patient_id
    """
    patient_map = {}

    for sample in sample_names:
        # Try to find a patient pattern
        for pattern in PATIENT_PATTERNS:
            match = re.match(pattern, sample, re.IGNORECASE)
            if match:
                patient_map[sample] = match.group(1)
                break

        if sample not in patient_map:
            # Default: each sample is its own patient
            patient_map[sample] = sample

    return patient_map

Requirements and compatibility

Written for: Claude Code, Claude apps

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs network access, Needs Python

Security

What our scanner noticed· Medium risk

  • Instructions that use the network
  • Downloads piped into a shell
  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Anthropic
Publisher
Anthropic (Official)
Source
anthropics/knowledge-work-plugins · bio-research/skills/nextflow-development · commit e050c2e
Licence
Apache License 2.0 (redistribution allowed)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Anthropic or Anthropic.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download nextflow-development.zip