reporting/rmarkdown-reports/SKILL.md
Create reproducible bioinformatics analysis reports with R Markdown including code, results, and visualizations in HTML, PDF, or Word format. Use when generating analysis reports with RMarkdown.
npx skillsauth add GPTomics/bioSkills bio-reporting-rmarkdown-reportsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Reference examples tested with: rmarkdown 2.25+, knitr 1.45+, DESeq2 1.42+, ggplot2 3.5+
Before using code patterns, verify installed versions match. If versions differ:
packageVersion('<pkg>') then ?function_name to verify parametersIf code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
"Create an R Markdown report" -> Write reproducible R-based documents combining code chunks, results, and narrative that render to HTML/PDF/Word.
rmarkdown::render('report.Rmd'), or Knit button in RStudio---
title: "RNA-seq Analysis Report"
author: "Your Name"
date: "`r Sys.Date()`"
output:
html_document:
toc: true
toc_float: true
code_folding: hide
theme: cosmo
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(
echo = TRUE,
message = FALSE,
warning = FALSE,
fig.width = 10,
fig.height = 6,
fig.align = 'center'
)
library(tidyverse)
library(DESeq2)
library(pheatmap)
```
```{r analysis, echo=TRUE, results='hide'}
# echo: show code
# results: 'hide', 'asis', 'markup'
# include: FALSE hides chunk entirely
# eval: FALSE shows code but doesn't run
# cache: TRUE caches results
```
---
title: "Sample Report"
params:
sample_id: "sample1"
count_file: "counts.csv"
fdr_threshold: 0.05
---
```{r}
counts <- read.csv(params$count_file)
sample <- params$sample_id
fdr <- params$fdr_threshold
```
# Render with parameters
rmarkdown::render('report.Rmd', params = list(sample_id = 'sample2', fdr_threshold = 0.01))
# Batch render
samples <- c('sample1', 'sample2', 'sample3')
for (s in samples) {
rmarkdown::render('report.Rmd', params = list(sample_id = s),
output_file = paste0(s, '_report.html'))
}
```{r}
# Basic kable table
knitr::kable(head(results), caption = 'Top DE genes')
# Interactive table with DT
library(DT)
datatable(results, filter = 'top', options = list(pageLength = 10))
# Formatted table with kableExtra
library(kableExtra)
results %>%
head(10) %>%
kable() %>%
kable_styling(bootstrap_options = c('striped', 'hover')) %>%
row_spec(which(results$padj < 0.01), bold = TRUE, color = 'red')
```
```{r volcano-plot, fig.cap="Volcano plot of differential expression"}
ggplot(results, aes(log2FoldChange, -log10(pvalue))) +
geom_point(aes(color = padj < 0.05)) +
theme_minimal()
```
We identified `r sum(res$padj < 0.05, na.rm=TRUE)` significantly
DE genes (FDR < 0.05) out of `r nrow(res)` tested.
---
title: "Main Report"
---
```{r child='methods.Rmd'}
```
```{r child='results.Rmd'}
```
---
output:
pdf_document:
toc: true
number_sections: true
fig_caption: true
latex_engine: xelatex
---
## Results {.tabset}
### PCA Plot
```{r}
plotPCA(vsd, intgroup = 'condition')
```
### Heatmap
```{r}
pheatmap(assay(vsd)[top_genes, ])
```
```{r deseq-analysis, cache=TRUE, cache.extra=tools::md5sum('counts.csv')}
# Cached unless counts.csv changes
dds <- DESeqDataSetFromMatrix(counts, metadata, ~ condition)
dds <- DESeq(dds)
```
```{r downstream, dependson='deseq-analysis'}
# Re-runs when deseq-analysis cache changes
res <- results(dds)
```
---
output:
html_document:
css: custom.css
---
/* custom.css */
body { font-family: 'Helvetica', sans-serif; }
h1 { color: #2c3e50; }
.figure { margin: 20px auto; }
---
title: "RNA-seq Analysis Report"
author: "Bioinformatics Core"
date: "`r Sys.Date()`"
output:
html_document:
toc: true
toc_float: true
code_folding: hide
params:
count_file: "counts.csv"
metadata_file: "metadata.csv"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE)
library(DESeq2)
library(tidyverse)
library(pheatmap)
library(DT)
```
## Data Overview
```{r load-data}
counts <- read.csv(params$count_file, row.names = 1)
metadata <- read.csv(params$metadata_file, row.names = 1)
```
Loaded `r nrow(counts)` genes across `r ncol(counts)` samples.
## Differential Expression
```{r de-analysis, cache=TRUE}
dds <- DESeqDataSetFromMatrix(counts, metadata, ~ condition)
dds <- DESeq(dds)
res <- results(dds) %>% as.data.frame() %>% arrange(padj)
```
## Results
```{r results-table}
datatable(res %>% filter(padj < 0.05), options = list(pageLength = 10))
```
tools
--- name: bio-phasing-imputation-foundations description: Frames the phasing/imputation pipeline before any tool runs: phasing and imputation are one Li-Stephens copying HMM (recombination is the transition, mutation the emission, the genetic map and Ne set the rates), imputation's honest output is a dosage with a self-estimated quality (INFO/R2/DR2) not a hard genotype, and the stages are ordered and each fails silently (QC, align build and strand to the panel, phase, impute per chromosome, fil
tools
Chooses the enrichment generation before any tool runs, mapping the input shape to a method class - a pre-selected gene list plus a background to over-representation analysis (ORA, hypergeometric), a ranked statistic for all genes to gene set enrichment (GSEA), a signed signaling topology to pathway-topology (SPIA) - then making the null explicit (competitive vs self-contained, gene vs subject sampling) and running a trustworthiness checklist (testable-gene universe, FDR, redundancy collapse, leading-edge check, version reporting). Covers why every clusterProfiler GSEA is the inter-gene-correlation-uncorrected competitive null, why the background not the gene list decides ORA significance, and why no method is universally best. Use when deciding ORA vs GSEA vs topology, which gene-set DB, whether a result is trustworthy, or which null a tool computes. For ORA see go-enrichment, GSEA see gsea, databases kegg-pathways/reactome-pathways/wikipathways; the ranking comes from differential-expression/de-results.
testing
End-to-end GWAS workflow from VCF to association results. Covers PLINK QC, population structure correction, and association testing for case-control or quantitative traits. Use when running genome-wide association studies.
development
Orchestrates the full path from differential expression results to redundancy-collapsed functional enrichment: choose ORA vs GSEA, convert gene IDs per method, run enrichGO/enrichKEGG/enrichPathway/enrichWP or gseGO/gseKEGG (clusterProfiler, ReactomePA, rWikiPathways), and visualize. Routes the ORA-vs-GSEA generation fork and the null/universe/reproducibility theory to pathway-analysis/enrichment-foundations. Use when a DESeq2/edgeR/limma result must become enriched GO terms, KEGG/Reactome/WikiPathways pathways, or a GSEA leading edge; when deciding whether a ranking exists for all genes (GSEA, named decreasing vector) or only a pre-selected list (ORA plus a defensible background universe); or when assembling DE-to-pathway end to end. The DE list and ranking statistic come from differential-expression/de-results; per-method nuance lives in the pathway-analysis skills.