-
Notifications
You must be signed in to change notification settings - Fork 596
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prevent sequence dictionary validation when aligning reads
previously, tools that align reads required you to manually disable sequence dictionary validation if you didn't, they would fail because the unaligned bam didn't have the required sequence dictionary extracting out a SequenceDictionaryValidationArgumentCollection and providing a method for GATKSparkTools to configure it ReadsPipeline couldn't easily make use of this, so instead it overrides the method that does validation BwaSpark / BwaAndMarkDuplicatesPipelineSpark now do not require or allow dictionary validation fixes #4131
- Loading branch information
1 parent
4e3affb
commit 21322db
Showing
10 changed files
with
133 additions
and
25 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
...ellbender/cmdline/argumentcollections/SequenceDictionaryValidationArgumentCollection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.broadinstitute.hellbender.cmdline.argumentcollections; | ||
|
||
import org.broadinstitute.barclay.argparser.Argument; | ||
import org.broadinstitute.hellbender.cmdline.StandardArgumentDefinitions; | ||
|
||
/** | ||
* interface for argument collections that control how sequence dictionary validation should be handled | ||
*/ | ||
public interface SequenceDictionaryValidationArgumentCollection { | ||
|
||
/** | ||
* Should sequence dictionary validation be performed | ||
* @return true if the tool should perform sequence dictionary validation | ||
*/ | ||
boolean performSequenceDictionaryValidation(); | ||
|
||
|
||
/** | ||
* most tools will want to use this, it defaults to performing sequence dictionary validation but provides the option | ||
* to disable it | ||
*/ | ||
class StandardValidationCollection implements SequenceDictionaryValidationArgumentCollection { | ||
@Argument(fullName = StandardArgumentDefinitions.DISABLE_SEQUENCE_DICT_VALIDATION_NAME, shortName = StandardArgumentDefinitions.DISABLE_SEQUENCE_DICT_VALIDATION_NAME, doc = "If specified, do not check the sequence dictionaries from our inputs for compatibility. Use at your own risk!", optional = true) | ||
private boolean disableSequenceDictionaryValidation = false; | ||
|
||
@Override | ||
public boolean performSequenceDictionaryValidation() { | ||
return !disableSequenceDictionaryValidation; | ||
} | ||
} | ||
|
||
/** | ||
* doesn't provide a configuration argument, and always returns false, useful for tools that do not want to perform | ||
* sequence dictionary validation, like aligners | ||
*/ | ||
class NoValidationCollection implements SequenceDictionaryValidationArgumentCollection { | ||
@Override | ||
public boolean performSequenceDictionaryValidation() { | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...ender/cmdline/argumentcollections/SequenceDictionaryValidationArgumentCollectionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.broadinstitute.hellbender.cmdline.argumentcollections; | ||
|
||
import org.broadinstitute.barclay.argparser.ArgumentCollection; | ||
import org.broadinstitute.barclay.argparser.CommandLineArgumentParser; | ||
import org.broadinstitute.barclay.argparser.CommandLineParser; | ||
import org.broadinstitute.hellbender.cmdline.StandardArgumentDefinitions; | ||
import org.broadinstitute.hellbender.cmdline.argumentcollections.SequenceDictionaryValidationArgumentCollection; | ||
import org.testng.Assert; | ||
import org.testng.annotations.Test; | ||
|
||
public class SequenceDictionaryValidationArgumentCollectionTest { | ||
|
||
private static class StandardArgumentCollection { | ||
@ArgumentCollection | ||
public SequenceDictionaryValidationArgumentCollection standard = new SequenceDictionaryValidationArgumentCollection.StandardValidationCollection(); | ||
} | ||
|
||
@Test | ||
public void testStandardArgumentCollectionDefaultsToTrue(){ | ||
Assert.assertTrue(new SequenceDictionaryValidationArgumentCollection.StandardValidationCollection().performSequenceDictionaryValidation()); | ||
} | ||
|
||
@Test | ||
public void testStandardArgumentCollectionCanBeDisabled(){ | ||
final String[] disabled = {"--"+StandardArgumentDefinitions.DISABLE_SEQUENCE_DICT_VALIDATION_NAME}; | ||
StandardArgumentCollection std = new StandardArgumentCollection(); | ||
CommandLineParser clp = new CommandLineArgumentParser(std); | ||
clp.parseArguments(System.out, disabled); | ||
Assert.assertFalse(std.standard.performSequenceDictionaryValidation()); | ||
} | ||
|
||
@Test | ||
public void testNoValidationDefaultsToFalse(){ | ||
Assert.assertFalse(new SequenceDictionaryValidationArgumentCollection.NoValidationCollection().performSequenceDictionaryValidation()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters