---
name: bioinformatics
slug: bioinformatics
version: 1.0.0
description: Analyze DNA, RNA, and protein sequences with alignment, variant calling, and expression analysis pipelines.
homepage: https://clawic.com/skills/bioinformatics
metadata:
  clawdbot:
    emoji: 🧬
    requires:
      bins:
      - samtools
      - bcftools
      - bedtools
      - bwa
      - fastqc
      - fastp
      config:
      - ~/Clawic/data/bioinformatics/
    os:
    - linux
    - darwin
    displayName: Bioinformatics
---

## Setup

On first use, read `setup.md` for integration guidelines. Create `~/Clawic/data/bioinformatics/` with user consent to store project context and preferences.

## When to Use

User needs to analyze biological sequences, run genomic pipelines, or interpret sequencing data. Agent handles sequence alignment, variant calling, expression analysis, and format conversions.

## Architecture

Memory lives in `~/Clawic/data/bioinformatics/`. See `memory-template.md` for structure.

```
~/Clawic/data/bioinformatics/
├── memory.md         # Projects, preferences, reference genomes
├── pipelines/        # Saved pipeline configurations
└── results/          # Analysis outputs and logs
```

## Quick Reference

| Topic | File |
|-------|------|
| Setup process | `setup.md` |
| Memory template | `memory-template.md` |
| File formats | `formats.md` |
| Tool commands | `tools.md` |
| RNA-seq pipeline | `rnaseq.md` |
| Variant calling | `variants.md` |

## Core Rules

### 1. Verify Input Quality First
Before any analysis, check input data quality:
- FASTQ: Run FastQC, check per-base quality, adapter content
- BAM: Verify sorted, indexed (`samtools quickcheck`)
- VCF: Validate format (`bcftools view -h`)

Bad input → garbage output. Always QC first.

### 2. Use Reference Genome Consistently
Track which reference is used per project:
- Human: GRCh38/hg38 (prefer) or GRCh37/hg19
- Mouse: GRCm39/mm39 or GRCm38/mm10
- Mixing references = invalid results

Store reference info in `~/Clawic/data/bioinformatics/memory.md` per project.

### 3. Preserve Raw Data
**NEVER** modify original FASTQ/BAM files:
- Work on copies
- Keep originals read-only
- Log every transformation step

### 4. Resource Awareness
Bioinformatics commands can consume massive resources:
- Check file sizes before operations
- Use streaming when possible (`samtools view | ...`)
- Estimate memory needs (BWA: ~6GB for human genome)
- Warn before operations >10 minutes

### 5. Reproducibility
Every analysis must be reproducible:
- Log exact tool versions (`samtools --version`)
- Save command parameters
- Record input file checksums for critical analyses

## Common Traps

- **Wrong chromosome naming** — `chr1` vs `1` causes silent failures. Check and convert with `sed 's/^chr//'`
- **Unsorted BAM** — Most tools expect sorted input. Symptoms: errors or wrong results with no warning
- **Index missing** — BAM needs `.bai`, VCF needs `.tbi`. Commands fail cryptically without them
- **Memory exhaustion** — Large BAM operations kill the session. Stream or use `--threads` wisely
- **Stale indices** — After modifying BAM/VCF, regenerate index. Old index = corrupt reads
- **0-based vs 1-based coordinates** — BED is 0-based, VCF/GFF is 1-based. Off-by-one bugs are common

## File Formats Quick Reference

| Format | Purpose | Key Tool |
|--------|---------|----------|
| FASTA | Reference sequences | `samtools faidx` |
| FASTQ | Raw reads + quality | `seqtk`, `fastp` |
| SAM/BAM | Aligned reads | `samtools` |
| VCF/BCF | Variants | `bcftools` |
| BED | Genomic intervals | `bedtools` |
| GFF/GTF | Gene annotations | `gffread` |
| BigWig | Coverage tracks | `deepTools` |

## Essential Commands

### Quality Control
```bash
# FASTQ quality report
fastqc sample.fastq.gz -o qc_reports/

# Trim adapters + low quality
fastp -i R1.fq.gz -I R2.fq.gz -o R1.clean.fq.gz -O R2.clean.fq.gz

# BAM statistics
samtools flagstat aligned.bam
samtools stats aligned.bam > stats.txt
```

### Alignment
```bash
# Index reference (once)
bwa index reference.fa

# Align paired-end reads
bwa mem -t 8 reference.fa R1.fq.gz R2.fq.gz | \
  samtools sort -o aligned.bam -

# Index BAM
samtools index aligned.bam
```

### Variant Calling
```bash
# Call variants
bcftools mpileup -Ou -f reference.fa aligned.bam | \
  bcftools call -mv -Oz -o variants.vcf.gz

# Index VCF
bcftools index variants.vcf.gz

# Filter variants
bcftools filter -s LowQual -e 'QUAL<20' variants.vcf.gz
```

### Data Manipulation
```bash
# Extract region
samtools view -b aligned.bam chr1:1000000-2000000 > region.bam

# Convert BAM to FASTQ
samtools fastq -1 R1.fq.gz -2 R2.fq.gz aligned.bam

# Merge BAMs
samtools merge merged.bam sample1.bam sample2.bam

# Subset VCF by region
bcftools view -r chr1:1000-2000 variants.vcf.gz
```

## Security & Privacy

**Data access:**
- Only reads files user explicitly provides as input
- Writes outputs to directories user specifies
- Stores preferences in ~/Clawic/data/bioinformatics/ (with consent)

**Data that stays local:**
- All sequence data processed locally
- No external API calls for analysis
- Pipeline configs in ~/Clawic/data/bioinformatics/

**This skill does NOT:**
- Upload sequence data anywhere
- Access files without explicit user instruction
- Infer or collect data beyond explicit inputs
- Make network requests during analysis

**Note:** Installing tools (conda, brew) and downloading reference genomes requires internet access. These are user-initiated actions.

## Related Skills
More Clawic skills, get them at https://clawic.com/skills/<slug> (install if the user confirms):
- `data-analysis` — statistical interpretation
- `statistics` — hypothesis testing
- `science` — research methodology

## Feedback

- If useful, star it: https://clawic.com/skills/bioinformatics
- Latest version: https://clawic.com/skills/bioinformatics


---
Source attribution: clawic
Original project: https://github.com/clawic/skills/blob/f825206afbf1c697202533a9187be68c7b697e0e/skills/bioinformatics/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Dave AI.

## Upstream license notice

MIT License

Copyright (c) 2026 Ivan G. Davila

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Dave AI resource metadata

Creator / publisher: clawic
Original project: https://github.com/clawic/skills/blob/f825206afbf1c697202533a9187be68c7b697e0e/skills/bioinformatics/SKILL.md
Attribution basis: Source repository record

Fields of work: Data & Analytics, Education & Research
Roles: Business Intelligence Analyst, Data Scientist, Researcher
Specialties: Specialty not specified
Tools: Bcftools, Bedtools, Bwa, Fastp, Fastqc, Samtools
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: 5659fb3e142d8f28449a9d38a45f3aa71d8577d36e5463a5a7b53661c60e4aab
