Fixes the test that was failing due to gsalib build failure

This commit is contained in:
Geraldine Van der Auwera 2015-03-17 04:26:03 -04:00
parent c374d126d7
commit a75e1d4ce4
10 changed files with 155 additions and 20 deletions

View File

@ -1,9 +1,9 @@
gsa.reshape.concordance.table <- function(data, table.name="GenotypeConcordance_Counts", sample.name="ALL") {
gsa.reshape.concordance.table <- function(report, table.name="GenotypeConcordance_Counts", sample.name="ALL") {
if (!is.null(table.name)) {
data <- data[[table.name]]
data <- report[[table.name]]
}
if (is.null(data)) {
return NULL
if (is.null(table.name)) {
data <- report
}
d <- data[data$Sample==sample.name,2:(length(data[1,])-1)]

View File

@ -0,0 +1,20 @@
#:GATKReport.v1.0:2
#:GATKTable:true:2:9:%.18E:%.15f:;
#:GATKTable:ErrorRatePerCycle:The error rate per sequenced position in the reads
cycle errorrate.61PA8.7 qualavg.61PA8.7
0 7.451835696110506E-3 25.474613284804366
1 2.362777171937477E-3 29.844949954504095
2 9.087604507451836E-4 32.875909752547310
3 5.452562704471102E-4 34.498999090081895
4 9.087604507451836E-4 35.148316651501370
5 5.452562704471102E-4 36.072234352256190
6 5.452562704471102E-4 36.121724890829700
7 5.452562704471102E-4 36.191048034934500
8 5.452562704471102E-4 36.003457059679770
#:GATKTable:false:2:3:%s:%c:;
#:GATKTable:ExampleTable:This is an old-style table
key column
1:1000 T
1:1001 A
1:1002 C

View File

@ -0,0 +1,30 @@
#:GATKReport.v1.1:5
#:GATKTable:20:2:%s:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:;
#:GATKTable:GenotypeConcordance_CompProportions:Per-sample concordance tables: proportions of genotypes called in comp
Sample NO_CALL_HOM_REF NO_CALL_HET NO_CALL_HOM_VAR HOM_REF_HOM_REF HOM_REF_HET HOM_REF_HOM_VAR HET_HOM_REF HET_HET HET_HOM_VAR HOM_VAR_HOM_REF HOM_VAR_HET HOM_VAR_HOM_VAR UNAVAILABLE_HOM_REF UNAVAILABLE_HET UNAVAILABLE_HOM_VAR MIXED_HOM_REF MIXED_HET MIXED_HOM_VAR Mismatching_Alleles
ALL 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.007 0.000 0.000 0.001 0.013 0.000 0.992 0.986 0.000 0.000 0.000 0.000
NA12878 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.007 0.000 0.000 0.001 0.013 0.000 0.992 0.986 0.000 0.000 0.000 0.000
#:GATKTable:38:2:%s:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:;
#:GATKTable:GenotypeConcordance_Counts:Per-sample concordance tables: comparison counts
Sample NO_CALL_NO_CALL NO_CALL_HOM_REF NO_CALL_HET NO_CALL_HOM_VAR NO_CALL_UNAVAILABLE NO_CALL_MIXED HOM_REF_NO_CALL HOM_REF_HOM_REF HOM_REF_HET HOM_REF_HOM_VAR HOM_REF_UNAVAILABLE HOM_REF_MIXED HET_NO_CALL HET_HOM_REF HET_HET HET_HOM_VAR HET_UNAVAILABLE HET_MIXED HOM_VAR_NO_CALL HOM_VAR_HOM_REF HOM_VAR_HET HOM_VAR_HOM_VAR HOM_VAR_UNAVAILABLE HOM_VAR_MIXED UNAVAILABLE_NO_CALL UNAVAILABLE_HOM_REF UNAVAILABLE_HET UNAVAILABLE_HOM_VAR UNAVAILABLE_UNAVAILABLE UNAVAILABLE_MIXED MIXED_NO_CALL MIXED_HOM_REF MIXED_HET MIXED_HOM_VAR MIXED_UNAVAILABLE MIXED_MIXED Mismatching_Alleles
ALL 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13463 90 3901 0 0 0 2935 18144 4448 0 0 0 2053693 1326112 11290 0 0 0 0 0 0 0 16
NA12878 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13463 90 3901 0 0 0 2935 18144 4448 0 0 0 2053693 1326112 11290 0 0 0 0 0 0 0 16
#:GATKTable:20:2:%s:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:;
#:GATKTable:GenotypeConcordance_EvalProportions:Per-sample concordance tables: proportions of genotypes called in eval
Sample HOM_REF_NO_CALL HOM_REF_HOM_REF HOM_REF_HET HOM_REF_HOM_VAR HOM_REF_UNAVAILABLE HOM_REF_MIXED HET_NO_CALL HET_HOM_REF HET_HET HET_HOM_VAR HET_UNAVAILABLE HET_MIXED HOM_VAR_NO_CALL HOM_VAR_HOM_REF HOM_VAR_HET HOM_VAR_HOM_VAR HOM_VAR_UNAVAILABLE HOM_VAR_MIXED Mismatching_Alleles
ALL 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.771 0.005 0.224 0.000 0.000 0.000 0.115 0.711 0.174 0.000 0.000
NA06989 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.771 0.005 0.224 0.000 0.000 0.000 0.115 0.711 0.174 0.000 0.000
#:GATKTable:4:2:%s:%.3f:%.3f:%.3f:;
#:GATKTable:GenotypeConcordance_Summary:Per-sample summary statistics: NRS, NRD, and OGC
Sample Non-Reference Sensitivity Non-Reference Discrepancy Overall_Genotype_Concordance
ALL 0.010 0.087 0.913
NA06989 0.010 0.087 0.913
#:GATKTable:6:1:%d:%d:%d:%d:%d:%d:;
#:GATKTable:SiteConcordance_Summary:Site-level summary statistics
ALLELES_MATCH EVAL_SUPERSET_TRUTH EVAL_SUBSET_TRUTH ALLELES_DO_NOT_MATCH EVAL_ONLY TRUTH_ONLY
34632 0 0 16 8349 3391095

View File

@ -15,7 +15,7 @@ The path to the GATKReport file.
}
}
\details{
The GATKReport format replaces the multi-file output format used by many GATK tools and provides a single, consolidated file format. This format accommodates multiple tables and is still R-loadable through this function.
The GATKReport format replaces the multi-file output format used previously by many GATK tools and provides a single, consolidated file format. This format accommodates multiple tables and is still R-loadable through this function.
}
\value{
Returns a LIST object, where each key is the TableName and the value is the data.frame object with the contents of the table. If multiple tables with the same name exist, each one after the first will be given names of TableName.v1, TableName.v2, ..., TableName.vN.
@ -30,7 +30,7 @@ Kiran Garimella
This function accepts different versions of the GATKReport format by making internal calls to gsa.read.gatkreportv0() or gsa.read.gatkreportv1() as appropriate.
}
\examples{
test_file = system.file("inst", "extdata", "test_gatkreport.table", package = "gsalib");
test_file = system.file("extdata", "test_gatkreport.table", package = "gsalib");
report = gsa.read.gatkreport(test_file);
}
\keyword{ manip }

View File

@ -0,0 +1,26 @@
\name{gsa.read.gatkreportv0}
\alias{gsa.read.gatkreportv0}
\title{
Function to read in an old-style GATKReport
}
\description{
This function reads in data from a version 0.x GATKReport. It should not be called directly; instead, use gsa.read.gatkreport()
}
\usage{
gsa.read.gatkreportv0(lines)
}
\arguments{
\item{lines}{
The lines read in from the input file.
}
}
\value{
Returns a LIST object, where each key is the TableName and the value is the data.frame object with the contents of the table. If multiple tables with the same name exist, each one after the first will be given names of TableName.v1, TableName.v2, ..., TableName.vN.
}
\references{
http://www.broadinstitute.org/gatk/guide/article?id=1244
}
\author{
Kiran Garimella
}
\keyword{ manip }

View File

@ -0,0 +1,26 @@
\name{gsa.read.gatkreportv1}
\alias{gsa.read.gatkreportv1}
\title{
Function to read in a new-style GATKReport
}
\description{
This function reads in data from a version 1.x GATKReport. It should not be called directly; instead, use gsa.read.gatkreport()
}
\usage{
gsa.read.gatkreportv1(lines)
}
\arguments{
\item{lines}{
The lines read in from the input file.
}
}
\value{
Returns a LIST object, where each key is the TableName and the value is the data.frame object with the contents of the table. If multiple tables with the same name exist, each one after the first will be given names of TableName.v1, TableName.v2, ..., TableName.vN.
}
\references{
http://www.broadinstitute.org/gatk/guide/article?id=1244
}
\author{
Kiran Garimella
}
\keyword{ manip }

View File

@ -7,17 +7,17 @@ Reshape a Concordance Table
Given a GATKReport generated by GenotypeConcordance (as output by \code{gsa.read.gatkreport}), this function reshapes the concordance for a specified sample into a matrix with the EvalGenotypes in rows and the CompGenotypes in columns (see the documentation for GenotypeConcordance for the definition of Eval and Comp)
}
\usage{
gsa.reshape.concordance.table(x, table="GenotypeConcordance_Counts", sample.name="ALL")
gsa.reshape.concordance.table(report, table.name="GenotypeConcordance_Counts", sample.name="ALL")
}
\arguments{
\item{x}{
A GATKReport as output by \code{gsa.read.gatkreport}. If \code{table} is \code{NULL}, \code{x} is assumed to be the vector of concordance values to reshape.
\item{report}{
A GATKReport as output by \code{gsa.read.gatkreport}. If \code{table.name} is \code{NULL}, \code{report} is assumed to be the vector of concordance values to reshape.
}
\item{table}{
The table name in the GATKReport to reshape. Defaults to "GenotypeConcordance_Counts", but could also be one of the proportion tables ("GenotypeConcordance_EvalProportions", "GenotypeConcordance_CompProportions"). This value can also be \code{NULL}, in which case \code{x} is reshaped directly.
\item{table.name}{
The table name in the GATKReport to reshape. Defaults to "GenotypeConcordance_Counts", but could also be one of the proportion tables ("GenotypeConcordance_EvalProportions", "GenotypeConcordance_CompProportions"). This value can also be \code{NULL}, in which case \code{report} is reshaped directly.
}
\item{sample.name}{
The sample name within \code{table} to use.
The sample name within \code{table.name} to use.
}
}
\value{
@ -31,18 +31,18 @@ Phillip Dexheimer
\code{\link{gsa.read.gatkreport}}
}
\examples{
test_file = system.file("inst", "extdata", "test_gatkreport.table", package = "gsalib")
test_file = system.file("extdata", "test_genconcord.table", package = "gsalib")
report = gsa.read.gatkreport(test_file)
gsa.reshape.concordance.table(report)
## Output looks like:
## CompGenotypes
## CompGenotypes
##EvalGenotypes NO_CALL HOM_REF HET HOM_VAR UNAVAILABLE MIXED
## NO_CALL 0 0 0 0 0 0
## HOM_REF 0 2 0 0 0 0
## HET 0 3 0 0 0 0
## HOM_VAR 0 2 0 0 0 0
## UNAVAILABLE 0 0 0 0 0 0
## MIXED 0 0 0 0 0 0
## NO_CALL 0 0 0 0 0 0
## HOM_REF 0 0 0 0 0 0
## HET 0 0 13463 90 3901 0
## HOM_VAR 0 0 2935 18144 4448 0
## UNAVAILABLE 0 0 2053693 1326112 11290 0
## MIXED 0 0 0 0 0 0
}
\keyword{ manip }

View File

@ -0,0 +1,7 @@
\name{gsalib-internal}
\title{Internal gsalib objects}
\alias{.gsa.assignGATKTableToEnvironment}
\alias{.gsa.splitFixedWidth}
\description{Internal gsalib objects.}
\details{These are not to be called by the user.}
\keyword{internal}

View File

@ -0,0 +1,13 @@
\name{gatkreport_test_v1.table}
\docType{data}
\alias{gatkreport_test_v1.table}
\title{Test table for version 1.x GATKReport}
\description{
This is a new-style GATKReport.
}
\usage{gatkreport_test_v1.table}
\format{Text document containing multiple tables}
\source{GSA test data, Broad Institute}
\references{
http://www.broadinstitute.org/gatk/guide/article?id=1244
}

View File

@ -0,0 +1,13 @@
\name{genotype_concordance_test.table}
\docType{data}
\alias{genotype_concordance_test.table}
\title{Test table for Genotype Concordance Table Reshape}
\description{
This is a GATKReport output by GenotypeConcordance.
}
\usage{genotype_concordance_test.table}
\format{Text document containing multiple tables}
\source{GSA test data, Broad Institute}
\references{
http://www.broadinstitute.org/gatk/guide/article?id=1244
}