Skip to content

Instantly share code, notes, and snippets.

@ohofmann
Created February 12, 2016 15:21
Show Gist options
  • Save ohofmann/c2b81c97a9a37e3c646a to your computer and use it in GitHub Desktop.
Save ohofmann/c2b81c97a9a37e3c646a to your computer and use it in GitHub Desktop.
qc = read.table(file.path(path_results, "metrics", "metrics.tsv"),
header=T, sep="\t", check.names=F,
colClasses=list("sample"="character"))
rownames(qc) = qc$sample
qc$Mapped_reads_pct = as.numeric(gsub("%", "", qc$Mapped_reads_pct))
qc$Duplicates_pct = as.numeric(gsub("%", "", qc$Duplicates_pct))
metrics = c("sample", "Total_reads" ,"Mapped_reads_pct", "Duplicates_pct",
"offtarget",
"%GC", "Sequence_length", "Median_insert_size")
if (is.null(qc$offtarget)) {
qc$offtarget <- rep (0, length(qc$sample))
} else {
qc$offtarget = qc$offtarget/qc$Total_reads
}
qc$Mapped_reads_pct <- qc$Mapped_reads_pct / 100
qc$Duplicates_pct <- qc$Duplicates_pct / 100
datatable(qc[, metrics],
rownames=FALSE,
options=list(dom = 't')) %>%
formatPercentage('Mapped_reads_pct', 1) %>%
formatPercentage('Duplicates_pct', 1) %>%
formatPercentage('offtarget', 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment