Merge pull request #1451 from broadinstitute/sl_issue_1345_fix_2
Changed maximum allowed GQB value to 100.
This commit is contained in:
commit
7959324f08
|
|
@ -366,12 +366,17 @@ public class HaplotypeCaller extends ActiveRegionWalker<List<VariantContext>, In
|
|||
* sites are compressed into bands of similar genotype quality (GQ) that are emitted as a single VCF record. See
|
||||
* the FAQ documentation for more details about the GVCF format.
|
||||
*
|
||||
* This argument allows you to set the GQ boundaries. HC expects a list of multiple GQ threshold values. To pass
|
||||
* multiple values, you provide them one by one with the argument, as in `-GQB 10 -GQB 20 -GQB 30` and so on. Note
|
||||
* that GQ values are capped at 99 in the GATK, so values must be integers in [1, 99].
|
||||
* This argument allows you to set the GQ bands. HC expects a list of strictly increasing GQ values
|
||||
* that will act as exclusive upper bounds for the GQ bands. To pass multiple values,
|
||||
* you provide them one by one with the argument, as in `-GQB 10 -GQB 20 -GQB 30` and so on
|
||||
* (this would set the GQ bands to be `[0, 10), [10, 20), [20, 30)` and so on, for example).
|
||||
* Note that GQ values are capped at 99 in the GATK, so values must be integers in [1, 100].
|
||||
* If the last value is strictly less than 100, the last GQ band will start at that value (inclusive)
|
||||
* and end at 100 (exclusive).
|
||||
*/
|
||||
@Advanced
|
||||
@Argument(fullName="GVCFGQBands", shortName="GQB", doc="GQ thresholds for reference confidence bands (must be in [1, 99] and specified in increasing order)", required = false)
|
||||
@Argument(fullName="GVCFGQBands", shortName="GQB", doc="Exclusive upper bounds for reference confidence GQ bands " +
|
||||
"(must be in [1, 100] and specified in increasing order)", required = false)
|
||||
protected List<Integer> GVCFGQBands = new ArrayList<Integer>(70) {{
|
||||
for (int i=1; i<=60; ++i) add(i);
|
||||
add(70); add(80); add(90); add(99);
|
||||
|
|
|
|||
|
|
@ -98,20 +98,34 @@ public class GVCFWriter implements VariantContextWriter {
|
|||
* @return a non-null string if something is wrong (string explains issue)
|
||||
*/
|
||||
protected static List<HomRefBlock> parsePartitions(final List<Integer> GQPartitions, final int defaultPloidy) {
|
||||
if ( GQPartitions == null ) throw new IllegalArgumentException("The list of GQ partitions cannot be null.");
|
||||
if ( GQPartitions.isEmpty() ) throw new IllegalArgumentException("The list of GQ partitions cannot be empty.");
|
||||
if ( GQPartitions == null ) {
|
||||
throw new IllegalArgumentException("The list of GQ partitions cannot be null.");
|
||||
}
|
||||
if ( GQPartitions.isEmpty() ) {
|
||||
throw new IllegalArgumentException("The list of GQ partitions cannot be empty.");
|
||||
}
|
||||
|
||||
final List<HomRefBlock> result = new LinkedList<>();
|
||||
int lastThreshold = 0;
|
||||
for ( final Integer value : GQPartitions ) {
|
||||
if ( value == null || value <= 0 ) throw new IllegalArgumentException("The list of GQ partitions contains a null or non-positive integer.");
|
||||
if ( value < lastThreshold ) throw new IllegalArgumentException(String.format("The list of GQ partitions is out of order. Previous value is %d but the next is %d.", lastThreshold, value));
|
||||
if ( value == lastThreshold ) throw new IllegalArgumentException(String.format("The value %d appears more than once in the list of GQ partitions.", value));
|
||||
if ( value > MAX_GENOTYPE_QUAL ) throw new IllegalArgumentException(String.format("The value %d in the list of GQ partitions is greater than VCFConstants.MAX_GENOTYPE_QUAL = %d.", value, VCFConstants.MAX_GENOTYPE_QUAL));
|
||||
if ( value == null || value <= 0 ) {
|
||||
throw new IllegalArgumentException("The list of GQ partitions contains a null or non-positive integer.");
|
||||
}
|
||||
if ( value < lastThreshold ) {
|
||||
throw new IllegalArgumentException(String.format("The list of GQ partitions is out of order. " +
|
||||
"Previous value is %d but the next is %d.", lastThreshold, value));
|
||||
}
|
||||
if ( value == lastThreshold ) {
|
||||
throw new IllegalArgumentException(String.format("The value %d appears more than once in the list of GQ partitions.", value));
|
||||
}
|
||||
if ( value > MAX_GENOTYPE_QUAL + 1 ) {
|
||||
throw new IllegalArgumentException(String.format("The value %d in the list of GQ partitions is " +
|
||||
"greater than VCFConstants.MAX_GENOTYPE_QUAL + 1 = %d.", value, VCFConstants.MAX_GENOTYPE_QUAL + 1));
|
||||
}
|
||||
result.add(new HomRefBlock(lastThreshold, value, defaultPloidy));
|
||||
lastThreshold = value;
|
||||
}
|
||||
if (lastThreshold <= MAX_GENOTYPE_QUAL ) {
|
||||
if ( lastThreshold <= MAX_GENOTYPE_QUAL ) {
|
||||
result.add(new HomRefBlock(lastThreshold, MAX_GENOTYPE_QUAL + 1, defaultPloidy));
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
{Arrays.asList(-1, 10, 20)},
|
||||
{Arrays.asList(10, 20, 1)},
|
||||
{Arrays.asList(10, 10, 20)},
|
||||
{Arrays.asList(10, 20, VCFConstants.MAX_GENOTYPE_QUAL + 1)}
|
||||
{Arrays.asList(10, 20, VCFConstants.MAX_GENOTYPE_QUAL + 2)}
|
||||
};
|
||||
}
|
||||
@Test(dataProvider = "dataBadGQBValues")
|
||||
|
|
|
|||
|
|
@ -390,7 +390,9 @@ public class GVCFWriterUnitTest extends BaseTest {
|
|||
tests.add(new Object[]{Arrays.asList(1, 1, 10), false, null});
|
||||
tests.add(new Object[]{Arrays.asList(1, 10, VCFConstants.MAX_GENOTYPE_QUAL - 1), true, Arrays.asList(0, 1, 10, VCFConstants.MAX_GENOTYPE_QUAL - 1)});
|
||||
tests.add(new Object[]{Arrays.asList(1, 10, VCFConstants.MAX_GENOTYPE_QUAL), true, Arrays.asList(0, 1, 10, VCFConstants.MAX_GENOTYPE_QUAL)});
|
||||
tests.add(new Object[]{Arrays.asList(1, 10, VCFConstants.MAX_GENOTYPE_QUAL + 1), false, null});
|
||||
tests.add(new Object[]{Arrays.asList(1, 10, VCFConstants.MAX_GENOTYPE_QUAL + 1), true, Arrays.asList(0, 1, 10)});
|
||||
tests.add(new Object[]{Collections.singletonList(VCFConstants.MAX_GENOTYPE_QUAL + 1), true, Collections.singletonList(0)});
|
||||
tests.add(new Object[]{Arrays.asList(1, 10, VCFConstants.MAX_GENOTYPE_QUAL + 2), false, null});
|
||||
|
||||
return tests.toArray(new Object[][]{});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue