bio-epidemiological-genomics-transmission-inference
Infer pathogen transmission networks and identify likely transmission pairs using TransPhylo and outbreak reconstruction algorithms. Estimate who-infected-whom from genomic and epidemiological data. Use when investigating outbreak transmission chains or identifying superspreaders.
Best use case
bio-epidemiological-genomics-transmission-inference is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Infer pathogen transmission networks and identify likely transmission pairs using TransPhylo and outbreak reconstruction algorithms. Estimate who-infected-whom from genomic and epidemiological data. Use when investigating outbreak transmission chains or identifying superspreaders.
Teams using bio-epidemiological-genomics-transmission-inference should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/bio-epidemiological-genomics-transmission-inference/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How bio-epidemiological-genomics-transmission-inference Compares
| Feature / Agent | bio-epidemiological-genomics-transmission-inference | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Infer pathogen transmission networks and identify likely transmission pairs using TransPhylo and outbreak reconstruction algorithms. Estimate who-infected-whom from genomic and epidemiological data. Use when investigating outbreak transmission chains or identifying superspreaders.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
## Version Compatibility
Reference examples tested with: BioPython 1.83+, TreeTime 0.11+, matplotlib 3.8+, numpy 1.26+, pandas 2.2+, scanpy 1.10+
Before using code patterns, verify installed versions match. If versions differ:
- Python: `pip show <package>` then `help(module.function)` to check signatures
- R: `packageVersion('<pkg>')` then `?function_name` to verify parameters
If code throws ImportError, AttributeError, or TypeError, introspect the installed
package and adapt the example to match the actual API rather than retrying.
# Transmission Inference
**"Infer who infected whom in my outbreak"** → Reconstruct transmission networks from genomic and epidemiological data to identify transmission pairs, superspreaders, and unsampled cases.
- R: `TransPhylo::inferTTree()` for Bayesian transmission tree inference
## TransPhylo in R
```r
library(TransPhylo)
library(ape)
# Load dated phylogeny (from BEAST/TreeTime)
tree <- read.nexus('dated_tree.nexus')
# Convert to TransPhylo format
ptree <- ptreeFromPhylo(tree, dateLastSample = 2020.5)
# Estimate transmission tree
# Uses MCMC to sample from posterior distribution
res <- inferTTree(
ptree,
mcmcIterations = 100000,
startNeg = 0.1, # Initial within-host effective population
startOff.r = 2, # Initial R0 estimate
startOff.p = 0.5, # Initial sampling probability
startPi = 0.9, # Initial probability of being sampled
dateT = 2020.6 # End of outbreak observation
)
# Extract consensus transmission tree
ttree <- extractTTree(res)
# Get transmission pairs
pairs <- ttree$ttree[, c('infector', 'infectee', 'time')]
```
## Prepare Data
```python
def prepare_for_transphylo(dated_tree_file, sample_dates, output_prefix):
'''Prepare inputs for TransPhylo analysis
Requirements:
- Time-scaled phylogeny (from TreeTime or BEAST)
- Sample collection dates
- Tips must have matching names
TransPhylo estimates:
- Who infected whom
- Unsampled cases in the transmission chain
- R0 and generation time
'''
from Bio import Phylo
import pandas as pd
tree = Phylo.read(dated_tree_file, 'nexus')
# Verify all tips have dates
dates_df = pd.read_csv(sample_dates, sep='\t')
tip_names = {clade.name for clade in tree.get_terminals()}
dated_names = set(dates_df['name'])
missing = tip_names - dated_names
if missing:
print(f'Warning: {len(missing)} tips without dates: {missing}')
return {'tree': dated_tree_file, 'dates': sample_dates}
```
## Interpret Results
```r
# Analyze TransPhylo output
# Get median transmission tree
med_tree <- medTTree(res)
# Plot transmission tree
plot(med_tree)
# Get R0 estimate
r0_samples <- res$record[, 'off.r']
cat('R0 estimate:', median(r0_samples), '\n')
cat('95% CI:', quantile(r0_samples, c(0.025, 0.975)), '\n')
# Identify superspreaders
# Count number infected by each case
infections_per_case <- table(med_tree$ttree[, 'infector'])
superspreaders <- names(infections_per_case[infections_per_case > 3])
```
## Python Alternative: outbreaker2 Wrapper
**Goal:** Infer likely transmission pairs from genomic distance and collection dates without requiring a dated phylogeny.
**Approach:** For each pair of samples, check that the potential infector was sampled earlier, that the time interval is compatible with the generation time, and that the SNP distance is consistent with direct transmission.
```python
def infer_transmission_simple(distance_matrix, dates, generation_time=5):
'''Simplified transmission inference
Uses genomic distance and collection dates to infer likely
transmission pairs. Less sophisticated than TransPhylo but
doesn't require dated phylogeny.
Criteria for transmission pair (A -> B):
1. A collected before B
2. Genomic distance consistent with direct transmission
3. Time difference compatible with generation time
'''
import pandas as pd
import numpy as np
n = len(dates)
transmission_pairs = []
for i in range(n):
for j in range(n):
if i == j:
continue
time_diff = dates[j] - dates[i] # Days between collection
# Potential infector must be sampled first
if time_diff <= 0:
continue
# Check if time difference is compatible
# Generation time: time between infection of case and infection of secondary
# Serial interval: time between symptom onset (often used as proxy)
if time_diff > generation_time * 3: # Too much time
continue
# Check genomic distance
snp_diff = distance_matrix[i, j]
# Expected SNPs = rate * time
# For most pathogens, direct transmission = 0-5 SNP difference
expected_snps = (time_diff / 365) * 10 # Rough estimate
if snp_diff <= max(5, expected_snps * 2):
transmission_pairs.append({
'infector': i,
'infectee': j,
'snp_distance': snp_diff,
'days_between': time_diff,
'confidence': 'high' if snp_diff <= 2 else 'moderate'
})
return pd.DataFrame(transmission_pairs)
```
## Network Visualization
**Goal:** Visualize the inferred transmission chain as a directed network graph showing who infected whom.
**Approach:** Build a directed NetworkX graph from transmission pairs and render it with spring layout, directional arrows, and labeled nodes.
```python
def plot_transmission_network(pairs_df, metadata=None):
'''Visualize transmission network
Uses networkx to create directed graph of transmissions.
'''
import networkx as nx
import matplotlib.pyplot as plt
G = nx.DiGraph()
for _, row in pairs_df.iterrows():
G.add_edge(row['infector'], row['infectee'],
weight=row.get('confidence', 1))
# Layout
pos = nx.spring_layout(G)
# Draw
plt.figure(figsize=(12, 8))
nx.draw(G, pos, with_labels=True, node_color='lightblue',
node_size=500, arrows=True, arrowsize=20)
plt.title('Transmission Network')
return plt.gcf()
```
## Superspreader Analysis
```python
def identify_superspreaders(transmission_pairs, threshold=3):
'''Identify superspreading events
Superspreader: Individual who infected many others
Threshold typically 80/20 rule: 20% of cases cause 80% of transmission
Common threshold: >3 secondary cases
'''
from collections import Counter
infector_counts = Counter(transmission_pairs['infector'])
superspreaders = {k: v for k, v in infector_counts.items() if v >= threshold}
total_transmissions = sum(infector_counts.values())
ss_transmissions = sum(superspreaders.values())
print(f'Superspreaders (>{threshold} secondary cases):')
for ss, count in sorted(superspreaders.items(), key=lambda x: -x[1]):
print(f' Case {ss}: {count} secondary infections')
print(f'\nSuperspreading contribution: {ss_transmissions/total_transmissions:.1%}')
return superspreaders
```
## Related Skills
- epidemiological-genomics/phylodynamics - Generate dated trees
- epidemiological-genomics/pathogen-typing - Identify outbreak clones
- data-visualization/interactive-visualization - Visualize transmissionRelated Skills
tooluniverse-epigenomics
Production-ready genomics and epigenomics data processing for BixBench questions. Handles methylation array analysis (CpG filtering, differential methylation, age-related CpG detection, chromosome-level density), ChIP-seq peak analysis (peak calling, motif enrichment, coverage stats), ATAC-seq chromatin accessibility, multi-omics integration (expression + methylation correlation), and genome-wide statistics. Pure Python computation (pandas, scipy, numpy, pysam, statsmodels) plus ToolUniverse annotation tools (Ensembl, ENCODE, SCREEN, JASPAR, ReMap, RegulomeDB, ChIPAtlas). Supports BED, BigWig, methylation beta-value matrices, Illumina manifest files, and multi-sample clinical data. Use when processing methylation data, ChIP-seq peaks, ATAC-seq signals, or answering questions about CpG sites, differential methylation, chromatin accessibility, histone marks, or epigenomic statistics.
claw-metagenomics
Shotgun metagenomics profiling — taxonomy, resistome, and functional pathways
bio-single-cell-trajectory-inference
Infer developmental trajectories and pseudotime from single-cell RNA-seq data using Monocle3, Slingshot, and scVelo for RNA velocity analysis. Use when inferring developmental trajectories or pseudotime.
bio-proteomics-protein-inference
Protein grouping and inference from peptide identifications. Use when resolving protein ambiguity from shared peptides. Handles protein groups and protein-level FDR control using parsimony and probabilistic approaches.
bio-metagenomics-visualization
Visualize metagenomic profiles using R (phyloseq, microbiome) and Python (matplotlib, seaborn). Create stacked bar plots, heatmaps, PCA plots, and diversity analyses. Use when creating publication-quality figures from MetaPhlAn, Bracken, or other taxonomic profiling output.
bio-metagenomics-strain-tracking
Track bacterial strains using MASH, sourmash, fastANI, and inStrain. Compare genomes, detect contamination, and monitor strain-level variation. Use when needing sub-species resolution for outbreak tracking, transmission analysis, or within-host strain dynamics.
bio-metagenomics-metaphlan
Marker gene-based taxonomic profiling using MetaPhlAn 4. Provides accurate species-level relative abundances using clade-specific markers. Use when accurate taxonomic profiling is needed and computational resources are limited, or for comparison with HMP/other MetaPhlAn studies.
bio-metagenomics-kraken
Taxonomic classification of metagenomic reads using Kraken2. Fast k-mer based classification against RefSeq database. Use when performing initial taxonomic classification of shotgun metagenomic reads before abundance estimation with Bracken.
bio-metagenomics-functional-profiling
Profile functional potential of metagenomes using HUMAnN3 and similar tools. Use when obtaining pathway abundances, gene family counts, or functional annotations from metagenomic data.
bio-metagenomics-amr-detection
Detect antimicrobial resistance genes using AMRFinderPlus, ResFinder, and CARD. Screen isolates and metagenomes for resistance determinants. Use when characterizing resistance profiles in clinical isolates, surveillance samples, or metagenomic data.
bio-metagenomics-abundance
Species abundance estimation using Bracken with Kraken2 output. Redistributes reads from higher taxonomic levels to species for more accurate estimates. Use when accurate species-level abundances are needed from Kraken2 classification output.
bio-epidemiological-genomics-variant-surveillance
Assign pathogen lineages and track variants using Nextclade and pangolin for viral surveillance. Monitor variant prevalence and identify emerging variants of concern. Use when classifying viral sequences, tracking lineage dynamics, or monitoring for variants of concern.