Now produces an expanded table at the start, as well
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@6017 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
e8738f95c5
commit
a37e9bdbd4
28
R/exomeQC.R
28
R/exomeQC.R
|
|
@ -74,6 +74,27 @@ summaryTable <- function(metricsBySites, metricsBySample) {
|
||||||
return(table)
|
return(table)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sampleSummaryTable <- function(metricsBySample) {
|
||||||
|
# SNP summary statistics
|
||||||
|
raw <- melt(metricsBySamples, id.vars=c("Novelty", "Sample"), measure.vars=c("nProcessedLoci", "nSNPs", "tiTvRatio", "nIndels", "deletionInsertionRatio"))
|
||||||
|
table = cast(raw, Novelty ~ variable, mean)
|
||||||
|
table$nSNPs <- round(table$nSNPs, 0)
|
||||||
|
table$nIndels <- round(table$nIndels, 0)
|
||||||
|
table$tiTvRatio <- round(table$tiTvRatio, 2)
|
||||||
|
table$deletionInsertionRatio <- round(table$deletionInsertionRatio, 2)
|
||||||
|
colnames(table) <- c("Novelty", "Target size (bp)", "No. SNPs", "Ti/Tv", "No. Indels", "deletion/insertion ratio")
|
||||||
|
return(table)
|
||||||
|
}
|
||||||
|
|
||||||
|
overallSummaryTable <- function(metricsBySites, metricsBySamples) {
|
||||||
|
sitesSummary <- as.data.frame(summaryTable(metricsBySites, metricsBySamples))
|
||||||
|
sitesSummary$Metric.Type <- "Sites"
|
||||||
|
sampleSummary <- as.data.frame(sampleSummaryTable(metricsBySamples))
|
||||||
|
sampleSummary$Metric.Type <- "Per-sample avg."
|
||||||
|
# that last item puts the metric.type second in the list
|
||||||
|
return(rbind(sitesSummary, sampleSummary)[, c(1,7,2,3,4,5,6)])
|
||||||
|
}
|
||||||
|
|
||||||
summaryPlots <- function(metricsBySites) {
|
summaryPlots <- function(metricsBySites) {
|
||||||
name = "SNP and Indel count by novelty and allele frequency"
|
name = "SNP and Indel count by novelty and allele frequency"
|
||||||
molten = melt(subset(metricsBySites$byAC$CountVariants, Novelty != "all" & AC > 0), id.vars=c("Novelty", "AC"), measure.vars=c(c("nSNPs", "nIndels")))
|
molten = melt(subset(metricsBySites$byAC$CountVariants, Novelty != "all" & AC > 0), id.vars=c("Novelty", "AC"), measure.vars=c(c("nSNPs", "nIndels")))
|
||||||
|
|
@ -255,8 +276,10 @@ if ( ! is.na(outputPDF) ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Table of overall counts and quality
|
# Table of overall counts and quality
|
||||||
textplot(as.data.frame(summaryTable(metricsBySites)), show.rownames=F)
|
textplot(overallSummaryTable(metricsBySites), show.rownames=F)
|
||||||
title(paste("Overall summary metrics for project", ProjectName), cex=3)
|
title(paste("Summary metrics for project", ProjectName), cex=3)
|
||||||
|
# textplot(as.data.frame(sampleSummaryTable(metricsBySamples)), show.rownames=F)
|
||||||
|
# title(paste("Summary metrics per sample for project", ProjectName), cex=3)
|
||||||
|
|
||||||
summaryPlots(metricsBySites)
|
summaryPlots(metricsBySites)
|
||||||
perSamplePlots(metricsBySamples)
|
perSamplePlots(metricsBySamples)
|
||||||
|
|
@ -265,4 +288,3 @@ if ( ! is.na(outputPDF) ) {
|
||||||
dev.off()
|
dev.off()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue