HappyR
R tools to interact with hap.py output
Install / Use
/learn @Illumina/HappyRREADME
happyR
Tools to help analyse your hap.py results in R. See the documentation for usage and examples.
Install
devtools::install_github("Illumina/happyR")
Demo
This example walks through a comparison of samples prepared using PCR-Free versus Nano library preps with 2 replicates per group.
library(happyR)
library(tidyverse, quietly = TRUE)
# groups are defined either by a CSV or data.frame with three
# required columns: a label for each group (group_id), a unique
# label per replicate (replicate_id) and a path to the respective
# pre-computed hap.py output (happy_prefix)
extdata_dir <- system.file("extdata", package = "happyR")
# these extdata files are supplied with the package
samplesheet <- tibble::tribble(
~group_id, ~replicate_id, ~happy_prefix,
"PCR-Free", "NA12878-I30", paste(extdata_dir, "NA12878-I30_S1", sep = "/"),
"PCR-Free", "NA12878-I33", paste(extdata_dir, "NA12878-I33_S1", sep = "/"),
"Nano", "NA12878-R1", paste(extdata_dir, "NA12878-R1_S1", sep = "/"),
"Nano", "NA12878-R2", paste(extdata_dir, "NA12878-R2_S1", sep = "/")
)
# here the above table is used to read hap.py output files from disk
# and attach the group + replicate metadata
hap_samplesheet <- read_samplesheet_(samplesheet)
# extract summary PASS performance for each replicate and plot
summary <- extract_results(hap_samplesheet$results, table = "summary") %>%
inner_join(samplesheet, by = "happy_prefix") %>%
filter(Filter == "PASS")
ggplot(data = summary, aes(x = METRIC.Recall, y = METRIC.Precision, color = group_id, shape = Type)) +
geom_point() + theme_minimal() +
xlim(NA, 1) + ylim(NA, 1) +
scale_color_brewer(palette = "Set2") +
labs(x = "Recall", y = "Precision", color = "Prep") +
ggtitle("PCR-Free vs. Nano variant calling",
"PCR treatment reduces indel calling performance")
<img src="examples/README-usage-1.png" style="display: block; margin: auto;" />
System requirements
Originally developed for R v3.4.0. Tests are run using the most recent available R versions (incl. devel) on Ubuntu (Trusty) and OS X (El Capitan) platforms. happyR has not been tested on Windows. Dependencies are listed in DESCRIPTION.
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
342.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
