nota-america/forgecat-agent-profiles / profiles/anthropics/knowledge-work-plugins/anthropics_knowledge-work-plugins_bio-research/for-forgecat/skills/nextflow-development
nextflow-development
UnverifiedRun 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.
| File | Kind | Size |
|---|---|---|
| LICENSE.txt | markdown | 10.0 KB |
| SKILL.md | skill md | 8.7 KB |
| references/geo-sra-acquisition.md | markdown | 13.8 KB |
| references/installation.md | markdown | 1.8 KB |
| references/pipelines/atacseq.md | markdown | 4.1 KB |
| references/pipelines/rnaseq.md | markdown | 3.5 KB |
| references/pipelines/sarek.md | markdown | 3.9 KB |
| references/troubleshooting.md | markdown | 3.3 KB |
| scripts/check_environment.py | script | 13.8 KB |
| scripts/config/genomes.yaml | config | 3.4 KB |
| scripts/config/pipelines/atacseq.yaml | config | 5.0 KB |
| scripts/config/pipelines/rnaseq.yaml | config | 4.1 KB |
| scripts/config/pipelines/sarek.yaml | config | 6.1 KB |
| scripts/detect_data_type.py | script | 9.7 KB |
| scripts/generate_samplesheet.py | script | 15.1 KB |
| scripts/manage_genomes.py | script | 16.3 KB |
| scripts/sra_geo_fetch.py | script | 24.4 KB |
| scripts/utils/__init__.py | script | 1.7 KB |
| scripts/utils/file_discovery.py | script | 5.0 KB |
| scripts/utils/ncbi_utils.py | script | 27.8 KB |
| scripts/utils/sample_inference.py | script | 7.7 KB |
| scripts/utils/validators.py | script | 8.2 KB |
scripts/utils/file_discovery.py
View on GitHub"""
File discovery utilities for FASTQ, BAM, and CRAM files.
This module provides functions to recursively discover sequencing data files
in a directory structure.
"""
import os
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, List, Optional
@dataclass
class FileInfo:
"""Information about a discovered file."""
path: str
name: str
stem: str
extension: str
size: int
file_type: str # fastq, bam, cram
def __repr__(self):
return f"FileInfo({self.name}, type={self.file_type})"
# Supported file extensions by type
EXTENSIONS = {
"fastq": [".fastq.gz", ".fq.gz", ".fastq", ".fq"],
"bam": [".bam"],
"cram": [".cram"],
}
# Index file extensions
INDEX_EXTENSIONS = {
"bam": [".bam.bai", ".bai"],
"cram": [".cram.crai", ".crai"],
}
def discover_files(
directory: str,
file_type: str = "fastq",
follow_symlinks: bool = True
) -> List[FileInfo]:
"""
Recursively discover files of specified type.
Args:
directory: Root directory to search
file_type: One of 'fastq', 'bam', 'cram'
follow_symlinks: Whether to follow symbolic links
Returns:
List of FileInfo objects sorted by path
"""
if file_type not in EXTENSIONS:
raise ValueError(f"Unknown file type: {file_type}. Supported: {list(EXTENSIONS.keys())}")
directory = os.path.abspath(directory)
if not os.path.isdir(directory):
raise ValueError(f"Not a directory: {directory}")
extensions = EXTENSIONS[file_type]
files = []
seen_paths = set() # Avoid duplicates from symlinks
for root, _, filenames in os.walk(directory, followlinks=follow_symlinks):
for filename in filenames:
# Check each extension
for ext in extensions:
if filename.lower().endswith(ext.lower()):
full_path = os.path.join(root, filename)
# Resolve to handle symlinks
try:
real_path = os.path.realpath(full_path)
except OSError:
real_path = full_path
if real_path in seen_paths:
continue
seen_paths.add(real_path)
try:
size = os.path.getsize(full_path)
except OSError:
size = 0
# Extract stem (remove extension)
stem = filename
for e in extensions:
if stem.lower().endswith(e.lower()):
stem = stem[:-len(e)]
break
files.append(FileInfo(
path=full_path,
name=filename,
stem=stem,
extension=ext,
size=size,
file_type=file_type
))
break # Found matching extension, no need to check others
return sorted(files, key=lambda f: f.path)
def count_files_by_type(directory: str) -> Dict[str, int]:
"""
Count files by type in directory.
Args:
directory: Directory to scan
Returns:
Dict mapping file_type to count
"""
counts = {}
for file_type in EXTENSIONS:
try:
files = discover_files(directory, file_type)
counts[file_type] = len(files)
except (ValueError, PermissionError):
counts[file_type] = 0
return counts
def find_index_file(alignment_file: str) -> Optional[str]:
"""
Find index file for a BAM or CRAM file.
Args:
alignment_file: Path to BAM or CRAM file
Returns:
Path to index file if found, None otherwise
"""
path = Path(alignment_file)
# Determine file type
if path.suffix.lower() == ".bam":
index_exts = INDEX_EXTENSIONS["bam"]
elif path.suffix.lower() == ".cram":
index_exts = INDEX_EXTENSIONS["cram"]
else:
return None
# Try common index file patterns
for ext in index_exts:
# Pattern: file.bam.bai or file.bai
if ext.startswith(".bam") or ext.startswith(".cram"):
candidate = Path(str(path) + ext.split(".")[-1])
else:
candidate = path.with_suffix(ext)
if candidate.exists():
return str(candidate)
# Also try: file.bam -> file.bam.bai
candidate = Path(str(path) + "." + ext.lstrip("."))
if candidate.exists():
return str(candidate)
return None
def detect_input_type(directory: str) -> str:
"""
Auto-detect predominant input file type in directory.
Prioritizes: FASTQ > BAM > CRAM
Args:
directory: Directory to scan
Returns:
Detected file type ('fastq', 'bam', or 'cram')
"""
counts = count_files_by_type(directory)
# Prioritize by preference
for file_type in ["fastq", "bam", "cram"]:
if counts.get(file_type, 0) > 0:
return file_type
return "fastq" # Default
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |