From 8cf09f6ce070407e97be634d8b21958218ca0187 Mon Sep 17 00:00:00 2001 From: Frank Austin Nothaft Date: Sun, 18 Jun 2017 14:47:43 -0700 Subject: [PATCH] [ADAM-1570] Upgrade to bdg-formats 0.11.1. Resolves #1570. --- .../converters/VariantContextConverter.scala | 24 ++++++++++++------- .../gvcf_multiallelic/multiallelic.vcf | 6 ++--- adam-core/src/test/resources/sorted.lex.vcf | 12 +++++----- adam-core/src/test/resources/sorted.vcf | 12 +++++----- .../VariantContextConverterSuite.scala | 13 ++++------ pom.xml | 2 +- 6 files changed, 37 insertions(+), 32 deletions(-) diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/converters/VariantContextConverter.scala b/adam-core/src/main/scala/org/bdgenomics/adam/converters/VariantContextConverter.scala index 6b9b8e0306..ffdcf0fcd6 100644 --- a/adam-core/src/main/scala/org/bdgenomics/adam/converters/VariantContextConverter.scala +++ b/adam-core/src/main/scala/org/bdgenomics/adam/converters/VariantContextConverter.scala @@ -255,6 +255,14 @@ class VariantContextConverter( */ private def jFloat(f: Float): java.lang.Float = f + /** + * Converts a Scala double to a Java double. + * + * @param f Scala double precision floating point value. + * @return Java double precision floating point value. + */ + private def jDouble(f: Double): java.lang.Double = f + /** * Converts a GATK variant context into one or more ADAM variant context(s). * @@ -818,7 +826,7 @@ class VariantContextConverter( val pl = g.getPL try { val likelihoods = gIndices.map(idx => { - jFloat(PhredUtils.phredToLogProbability(pl(idx)).toFloat) + jDouble(PhredUtils.phredToLogProbability(pl(idx))) }).toList gb.setGenotypeLikelihoods(likelihoods) } catch { @@ -838,7 +846,7 @@ class VariantContextConverter( if (g.hasPL) { val pl = g.getPL gb.setNonReferenceLikelihoods(gIndices.map(idx => { - jFloat(PhredUtils.phredToLogProbability(pl(idx)).toFloat) + jDouble(PhredUtils.phredToLogProbability(pl(idx))) }).toList) } else { gb @@ -968,8 +976,8 @@ class VariantContextConverter( plCalculator(copyNumber) } - private[converters] def nonRefPls(gls: java.util.List[java.lang.Float], - nls: java.util.List[java.lang.Float]): Array[Int] = { + private[converters] def nonRefPls(gls: java.util.List[java.lang.Double], + nls: java.util.List[java.lang.Double]): Array[Int] = { require(gls.length == nls.length, "Genotype likelihoods (%s) and non-reference likelihoods (%s) disagree on copy number".format( gls.mkString(","), nls.mkString(","))) @@ -979,12 +987,12 @@ class VariantContextConverter( val array = Array.fill(elements) { Int.MinValue } (0 to copyNumber).foreach(idx => { - array(idx) = PhredUtils.logProbabilityToPhred(gls.get(idx).toDouble) + array(idx) = PhredUtils.logProbabilityToPhred(gls.get(idx)) }) var cnIdx = copyNumber + 1 (1 to copyNumber).foreach(idx => { - array(cnIdx + 1) = PhredUtils.logProbabilityToPhred(nls.get(idx).toDouble) + array(cnIdx + 1) = PhredUtils.logProbabilityToPhred(nls.get(idx)) cnIdx += (copyNumber - idx) }) @@ -1004,11 +1012,11 @@ class VariantContextConverter( } gb.noPL } else { - gb.PL(nls.map(l => PhredUtils.logProbabilityToPhred(l.toDouble)) + gb.PL(nls.map(l => PhredUtils.logProbabilityToPhred(l)) .toArray) } } else if (nls.isEmpty) { - gb.PL(gls.map(l => PhredUtils.logProbabilityToPhred(l.toDouble)) + gb.PL(gls.map(l => PhredUtils.logProbabilityToPhred(l)) .toArray) } else { gb.PL(nonRefPls(gls, nls)) diff --git a/adam-core/src/test/resources/gvcf_multiallelic/multiallelic.vcf b/adam-core/src/test/resources/gvcf_multiallelic/multiallelic.vcf index 7aedffffc7..9c3c988566 100644 --- a/adam-core/src/test/resources/gvcf_multiallelic/multiallelic.vcf +++ b/adam-core/src/test/resources/gvcf_multiallelic/multiallelic.vcf @@ -136,6 +136,6 @@ chr22 16157521 . C . . END=16157602 GT:DP:GQ:MIN_DP:PL 0/0:4:9:2:0,0,45 chr22 16157603 . G C, . . DP=1;MLEAC=1;MLEAF=0.5;MQ=59.0;MQ0=0 GT:AD:DP:GQ:PL 1/1:0,1:1:3:41,3,0,-2147483648,41,41 chr22 16157604 . G . . END=16157639 GT:DP:GQ:MIN_DP:PL 0/0:2:0:1:0,0,0 -chr22 18030096 . TAAA T, . . BaseQRankSum=-0.133;ClippingRankSum=-1.438;DP=114;MLEAC=0;MLEAF=0.0;MQ=69.72;MQ0=0;MQRankSum=-0.686;ReadPosRankSum=-0.013 GT:AD:DP:GQ:PL ./.:13,3:50:86:2147483647,2147483647,2147483647,-2147483648,2147483647,2147483647 -chr22 18030096 . TAAA TA, . . BaseQRankSum=-0.133;ClippingRankSum=-1.438;DP=114;MLEAC=1;MLEAF=0.5;MQ=69.72;MQ0=0;MQRankSum=-0.686;ReadPosRankSum=-0.013 GT:AD:DP:GQ:PL 1/.:13,17:50:86:2147483647,86,2147483647,-2147483648,2147483647,2147483647 -chr22 18030096 . TAAA TAA, . . BaseQRankSum=-0.133;ClippingRankSum=-1.438;DP=114;MLEAC=1;MLEAF=0.5;MQ=69.72;MQ0=0;MQRankSum=-0.686;ReadPosRankSum=-0.013 GT:AD:DP:GQ:PL ./1:13,17:50:86:2147483647,137,281,-2147483648,2147483647,2147483647 +chr22 18030096 . TAAA T, . . BaseQRankSum=-0.133;ClippingRankSum=-1.438;DP=114;MLEAC=0;MLEAF=0.0;MQ=69.72;MQ0=0;MQRankSum=-0.686;ReadPosRankSum=-0.013 GT:AD:DP:GQ:PL ./.:13,3:50:86:602,508,1628,-2147483648,467,659 +chr22 18030096 . TAAA TA, . . BaseQRankSum=-0.133;ClippingRankSum=-1.438;DP=114;MLEAC=1;MLEAF=0.5;MQ=69.72;MQ0=0;MQRankSum=-0.686;ReadPosRankSum=-0.013 GT:AD:DP:GQ:PL 1/.:13,17:50:86:602,86,553,-2147483648,467,659 +chr22 18030096 . TAAA TAA, . . BaseQRankSum=-0.133;ClippingRankSum=-1.438;DP=114;MLEAC=1;MLEAF=0.5;MQ=69.72;MQ0=0;MQRankSum=-0.686;ReadPosRankSum=-0.013 GT:AD:DP:GQ:PL ./1:13,17:50:86:602,137,281,-2147483648,467,659 diff --git a/adam-core/src/test/resources/sorted.lex.vcf b/adam-core/src/test/resources/sorted.lex.vcf index d5dee41dc0..2109b6f50b 100644 --- a/adam-core/src/test/resources/sorted.lex.vcf +++ b/adam-core/src/test/resources/sorted.lex.vcf @@ -66,9 +66,9 @@ ##contig= ##contig= #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT NA12878 NA12891 NA12892 -1 14397 . CTGT C . IndelQD AC=2;AF=0.333;AN=6;BaseQRankSum=1.8;ClippingRankSum=0.138;DP=69;FS=7.786;MLEAC=2;MLEAF=0.333;MQ=26.84;MQ0=0;MQRankSum=-1.906;QD=1.55;ReadPosRankSum=0.384 GT:AD:DP:FT:GQ:PL 0/1:16,4:20:rd:99:120,0,2147483647 0/1:8,2:10:dp;rd:60:60,0,414 0/0:39,0:39:PASS:99:0,116,2147483647 -1 14522 . G A . VQSRTrancheSNP99.95to100.00 AC=2;AF=0.333;AN=6;BaseQRankSum=2.044;ClippingRankSum=-2.196;DP=48;FS=13.179;MLEAC=2;MLEAF=0.333;MQ=25.89;MQ0=0;MQRankSum=-0.063;QD=8.87;ReadPosRankSum=0.952;VQSLOD=-3.333;culprit=MQ GT:AD:DP:FT:GQ:PL 0/1:10,5:15:dp:99:99,0,2147483647 0/1:2,5:7:dp;rd:34:128,0,34 0/0:26,0:26:PASS:78:0,78,2147483647 -1 63735 rs201888535 CCTA C . PASS AC=1;AF=0.167;AN=6;BaseQRankSum=1.138;ClippingRankSum=0.448;DB;DP=176;FS=13.597;MLEAC=1;MLEAF=0.167;MQ=31.06;MQ0=0;MQRankSum=0.636;QD=9.98;ReadPosRankSum=-1.18 GT:AD:DP:FT:GQ:PL 0/0:27,0:27:PASS:79:0,79,2147483647 0/0:40,0:40:PASS:99:0,117,2147483647 0/1:23,74:97:rd:99:2147483647,0,2147483647 -13 752721 rs3131972 A G . PASS AC=6;AF=1.0;AN=6;DB;DP=69;FS=0.0;MLEAC=6;MLEAF=1.0;MQ=60.0;MQ0=0;POSITIVE_TRAIN_SITE;QD=31.67;VQSLOD=18.94;culprit=QD GT:AD:DP:FT:GQ:PL 1/1:0,27:27:PASS:81:2147483647,81,0 1/1:0,19:19:dp:57:2147483647,57,0 1/1:0,22:22:PASS:66:2147483647,66,0 -13 752791 . A G . PASS AC=6;AF=1.0;AN=6;DB;DP=69;FS=0.0;MLEAC=6;MLEAF=1.0;MQ=60.0;MQ0=0;POSITIVE_TRAIN_SITE;QD=31.67;VQSLOD=18.94;culprit=QD GT:AD:DP:FT:GQ:PL:SB 1/1:0,27:27:PASS:81:2147483647,81,0:0,1,2,3 1/1:0,19:19:dp:57:2147483647,57,0:4,5,6,7 1/1:0,22:22:PASS:66:2147483647,66,0:2,3,4,5 -2 19190 . GC G . PASS AC=3;AF=0.5;AN=6;BaseQRankSum=4.157;ClippingRankSum=3.666;DP=74;FS=37.037;MLEAC=3;MLEAF=0.5;MQ=22.26;MQ0=0;MQRankSum=0.195;QD=16.04;ReadPosRankSum=-4.072 GT:AD:DP:FT:GQ:PL 0/1:8,14:22:PASS:99:416,0,2147483647 0/1:18,13:31:PASS:99:353,0,2147483647 0/1:5,15:20:rd:99:2147483647,0,107 +1 14397 . CTGT C . IndelQD AC=2;AF=0.333;AN=6;BaseQRankSum=1.8;ClippingRankSum=0.138;DP=69;FS=7.786;MLEAC=2;MLEAF=0.333;MQ=26.84;MQ0=0;MQRankSum=-1.906;QD=1.55;ReadPosRankSum=0.384 GT:AD:DP:FT:GQ:PL 0/1:16,4:20:rd:99:120,0,827 0/1:8,2:10:dp;rd:60:60,0,414 0/0:39,0:39:PASS:99:0,116,2114 +1 14522 . G A . VQSRTrancheSNP99.95to100.00 AC=2;AF=0.333;AN=6;BaseQRankSum=2.044;ClippingRankSum=-2.196;DP=48;FS=13.179;MLEAC=2;MLEAF=0.333;MQ=25.89;MQ0=0;MQRankSum=-0.063;QD=8.87;ReadPosRankSum=0.952;VQSLOD=-3.333;culprit=MQ GT:AD:DP:FT:GQ:PL 0/1:10,5:15:dp:99:99,0,2147483647 0/1:2,5:7:dp;rd:34:128,0,34 0/0:26,0:26:PASS:78:0,78,783 +1 63735 rs201888535 CCTA C . PASS AC=1;AF=0.167;AN=6;BaseQRankSum=1.138;ClippingRankSum=0.448;DB;DP=176;FS=13.597;MLEAC=1;MLEAF=0.167;MQ=31.06;MQ0=0;MQRankSum=0.636;QD=9.98;ReadPosRankSum=-1.18 GT:AD:DP:FT:GQ:PL 0/0:27,0:27:PASS:79:0,79,1425 0/0:40,0:40:PASS:99:0,117,2120 0/1:23,74:97:rd:99:3034,0,942 +13 752721 rs3131972 A G . PASS AC=6;AF=1.0;AN=6;DB;DP=69;FS=0.0;MLEAC=6;MLEAF=1.0;MQ=60.0;MQ0=0;POSITIVE_TRAIN_SITE;QD=31.67;VQSLOD=18.94;culprit=QD GT:AD:DP:FT:GQ:PL 1/1:0,27:27:PASS:81:1021,81,0 1/1:0,19:19:dp:57:661,57,0 1/1:0,22:22:PASS:66:831,66,0 +13 752791 . A G . PASS AC=6;AF=1.0;AN=6;DB;DP=69;FS=0.0;MLEAC=6;MLEAF=1.0;MQ=60.0;MQ0=0;POSITIVE_TRAIN_SITE;QD=31.67;VQSLOD=18.94;culprit=QD GT:AD:DP:FT:GQ:PL:SB 1/1:0,27:27:PASS:81:1021,81,0:0,1,2,3 1/1:0,19:19:dp:57:661,57,0:4,5,6,7 1/1:0,22:22:PASS:66:831,66,0:2,3,4,5 +2 19190 . GC G . PASS AC=3;AF=0.5;AN=6;BaseQRankSum=4.157;ClippingRankSum=3.666;DP=74;FS=37.037;MLEAC=3;MLEAF=0.5;MQ=22.26;MQ0=0;MQRankSum=0.195;QD=16.04;ReadPosRankSum=-4.072 GT:AD:DP:FT:GQ:PL 0/1:8,14:22:PASS:99:416,0,2147483647 0/1:18,13:31:PASS:99:353,0,503 0/1:5,15:20:rd:99:457,0,107 diff --git a/adam-core/src/test/resources/sorted.vcf b/adam-core/src/test/resources/sorted.vcf index bb3344f837..8db8c79b7d 100644 --- a/adam-core/src/test/resources/sorted.vcf +++ b/adam-core/src/test/resources/sorted.vcf @@ -66,9 +66,9 @@ ##contig= ##contig= #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT NA12878 NA12891 NA12892 -1 14397 . CTGT C . IndelQD AC=2;AF=0.333;AN=6;BaseQRankSum=1.8;ClippingRankSum=0.138;DP=69;FS=7.786;MLEAC=2;MLEAF=0.333;MQ=26.84;MQ0=0;MQRankSum=-1.906;QD=1.55;ReadPosRankSum=0.384 GT:AD:DP:FT:GQ:PL 0/1:16,4:20:rd:99:120,0,2147483647 0/1:8,2:10:dp;rd:60:60,0,414 0/0:39,0:39:PASS:99:0,116,2147483647 -1 14522 . G A . VQSRTrancheSNP99.95to100.00 AC=2;AF=0.333;AN=6;BaseQRankSum=2.044;ClippingRankSum=-2.196;DP=48;FS=13.179;MLEAC=2;MLEAF=0.333;MQ=25.89;MQ0=0;MQRankSum=-0.063;QD=8.87;ReadPosRankSum=0.952;VQSLOD=-3.333;culprit=MQ GT:AD:DP:FT:GQ:PL 0/1:10,5:15:dp:99:99,0,2147483647 0/1:2,5:7:dp;rd:34:128,0,34 0/0:26,0:26:PASS:78:0,78,2147483647 -1 63735 rs201888535 CCTA C . PASS AC=1;AF=0.167;AN=6;BaseQRankSum=1.138;ClippingRankSum=0.448;DB;DP=176;FS=13.597;MLEAC=1;MLEAF=0.167;MQ=31.06;MQ0=0;MQRankSum=0.636;QD=9.98;ReadPosRankSum=-1.18 GT:AD:DP:FT:GQ:PL 0/0:27,0:27:PASS:79:0,79,2147483647 0/0:40,0:40:PASS:99:0,117,2147483647 0/1:23,74:97:rd:99:2147483647,0,2147483647 -2 19190 . GC G . PASS AC=3;AF=0.5;AN=6;BaseQRankSum=4.157;ClippingRankSum=3.666;DP=74;FS=37.037;MLEAC=3;MLEAF=0.5;MQ=22.26;MQ0=0;MQRankSum=0.195;QD=16.04;ReadPosRankSum=-4.072 GT:AD:DP:FT:GQ:PL 0/1:8,14:22:PASS:99:416,0,2147483647 0/1:18,13:31:PASS:99:353,0,2147483647 0/1:5,15:20:rd:99:2147483647,0,107 -13 752721 rs3131972 A G . PASS AC=6;AF=1.0;AN=6;DB;DP=69;FS=0.0;MLEAC=6;MLEAF=1.0;MQ=60.0;MQ0=0;POSITIVE_TRAIN_SITE;QD=31.67;VQSLOD=18.94;culprit=QD GT:AD:DP:FT:GQ:PL 1/1:0,27:27:PASS:81:2147483647,81,0 1/1:0,19:19:dp:57:2147483647,57,0 1/1:0,22:22:PASS:66:2147483647,66,0 -13 752791 . A G . PASS AC=6;AF=1.0;AN=6;DB;DP=69;FS=0.0;MLEAC=6;MLEAF=1.0;MQ=60.0;MQ0=0;POSITIVE_TRAIN_SITE;QD=31.67;VQSLOD=18.94;culprit=QD GT:AD:DP:FT:GQ:PL:SB 1/1:0,27:27:PASS:81:2147483647,81,0:0,1,2,3 1/1:0,19:19:dp:57:2147483647,57,0:4,5,6,7 1/1:0,22:22:PASS:66:2147483647,66,0:2,3,4,5 +1 14397 . CTGT C . IndelQD AC=2;AF=0.333;AN=6;BaseQRankSum=1.8;ClippingRankSum=0.138;DP=69;FS=7.786;MLEAC=2;MLEAF=0.333;MQ=26.84;MQ0=0;MQRankSum=-1.906;QD=1.55;ReadPosRankSum=0.384 GT:AD:DP:FT:GQ:PL 0/1:16,4:20:rd:99:120,0,827 0/1:8,2:10:dp;rd:60:60,0,414 0/0:39,0:39:PASS:99:0,116,2114 +1 14522 . G A . VQSRTrancheSNP99.95to100.00 AC=2;AF=0.333;AN=6;BaseQRankSum=2.044;ClippingRankSum=-2.196;DP=48;FS=13.179;MLEAC=2;MLEAF=0.333;MQ=25.89;MQ0=0;MQRankSum=-0.063;QD=8.87;ReadPosRankSum=0.952;VQSLOD=-3.333;culprit=MQ GT:AD:DP:FT:GQ:PL 0/1:10,5:15:dp:99:99,0,2147483647 0/1:2,5:7:dp;rd:34:128,0,34 0/0:26,0:26:PASS:78:0,78,783 +1 63735 rs201888535 CCTA C . PASS AC=1;AF=0.167;AN=6;BaseQRankSum=1.138;ClippingRankSum=0.448;DB;DP=176;FS=13.597;MLEAC=1;MLEAF=0.167;MQ=31.06;MQ0=0;MQRankSum=0.636;QD=9.98;ReadPosRankSum=-1.18 GT:AD:DP:FT:GQ:PL 0/0:27,0:27:PASS:79:0,79,1425 0/0:40,0:40:PASS:99:0,117,2120 0/1:23,74:97:rd:99:3034,0,942 +2 19190 . GC G . PASS AC=3;AF=0.5;AN=6;BaseQRankSum=4.157;ClippingRankSum=3.666;DP=74;FS=37.037;MLEAC=3;MLEAF=0.5;MQ=22.26;MQ0=0;MQRankSum=0.195;QD=16.04;ReadPosRankSum=-4.072 GT:AD:DP:FT:GQ:PL 0/1:8,14:22:PASS:99:416,0,2147483647 0/1:18,13:31:PASS:99:353,0,503 0/1:5,15:20:rd:99:457,0,107 +13 752721 rs3131972 A G . PASS AC=6;AF=1.0;AN=6;DB;DP=69;FS=0.0;MLEAC=6;MLEAF=1.0;MQ=60.0;MQ0=0;POSITIVE_TRAIN_SITE;QD=31.67;VQSLOD=18.94;culprit=QD GT:AD:DP:FT:GQ:PL 1/1:0,27:27:PASS:81:1021,81,0 1/1:0,19:19:dp:57:661,57,0 1/1:0,22:22:PASS:66:831,66,0 +13 752791 . A G . PASS AC=6;AF=1.0;AN=6;DB;DP=69;FS=0.0;MLEAC=6;MLEAF=1.0;MQ=60.0;MQ0=0;POSITIVE_TRAIN_SITE;QD=31.67;VQSLOD=18.94;culprit=QD GT:AD:DP:FT:GQ:PL:SB 1/1:0,27:27:PASS:81:1021,81,0:0,1,2,3 1/1:0,19:19:dp:57:661,57,0:4,5,6,7 1/1:0,22:22:PASS:66:831,66,0:2,3,4,5 diff --git a/adam-core/src/test/scala/org/bdgenomics/adam/converters/VariantContextConverterSuite.scala b/adam-core/src/test/scala/org/bdgenomics/adam/converters/VariantContextConverterSuite.scala index 8fe05ad5ff..2eaa200493 100644 --- a/adam-core/src/test/scala/org/bdgenomics/adam/converters/VariantContextConverterSuite.scala +++ b/adam-core/src/test/scala/org/bdgenomics/adam/converters/VariantContextConverterSuite.scala @@ -343,16 +343,14 @@ class VariantContextConverterSuite extends ADAMFunSuite { assert(adamGT1.getAlleles.sameElements(List(GenotypeAllele.ALT, GenotypeAllele.OTHER_ALT))) assert(adamGT1.getAlternateReadDepth === 2) assert(adamGT1.getGenotypeLikelihoods - .map(f => f: scala.Float) - .map(_.toDouble) + .map(d => d: scala.Double) .map(PhredUtils.logProbabilityToPhred) .sameElements(List(59, 0, Int.MaxValue))) assert(adamGT2.getAlleles.sameElements(List(GenotypeAllele.OTHER_ALT, GenotypeAllele.ALT))) assert(adamGT2.getAlternateReadDepth === 3) assert(adamGT2.getGenotypeLikelihoods - .map(f => f: scala.Float) - .map(_.toDouble) + .map(d => d: scala.Double) .map(PhredUtils.logProbabilityToPhred) .sameElements(List(59, 1, 102))) @@ -392,8 +390,7 @@ class VariantContextConverterSuite extends ADAMFunSuite { assert(adamGT.getMinReadDepth === 38) assert(adamGT.getGenotypeLikelihoods.isEmpty) assert(adamGT.getNonReferenceLikelihoods - .map(f => f: scala.Float) - .map(_.toDouble) + .map(d => d: scala.Double) .map(PhredUtils.logProbabilityToPhred) .sameElements(List(0, 1, 2))) } @@ -925,8 +922,8 @@ class VariantContextConverterSuite extends ADAMFunSuite { test("extract genotype likelihoods going adam->htsjdk") { val g = converter.extractGenotypeLikelihoods(Genotype.newBuilder - .setGenotypeLikelihoods(Seq(-0.1f, -0.001f, -0.000001f) - .map(f => f: java.lang.Float)) + .setGenotypeLikelihoods(Seq(-0.1, -0.001, -0.000001) + .map(d => d: java.lang.Double)) .build, newGb) .make diff --git a/pom.xml b/pom.xml index 503f90be8a..8e378b1962 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ 2.7.3 7.8.0 1.7.22 - 0.11.0 + 0.11.1-SNAPSHOT 0.2.13 2.9.1 1.1.1