-
Notifications
You must be signed in to change notification settings - Fork 597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prevent sequence dictionary validation when aligning reads #4308
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,14 +38,6 @@ private PipelineTest(String referenceURL, String bam, String outputExtension, St | |
this.expectedVcfFileName = expectedVcfFileName; | ||
} | ||
|
||
public String getCommandLine() { | ||
return " -R " + referenceURL + | ||
" -I " + bam + | ||
" " + args + | ||
(knownSites.isEmpty() ? "": " --known-sites " + knownSites) + | ||
" -O %s"; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wow. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was totally unused. |
||
@Override | ||
public String toString() { | ||
return String.format("ReadsPipeline(bam='%s', args='%s')", bam, args); | ||
|
@@ -97,7 +89,7 @@ public Object[][] createReadsPipelineSparkTestData() { | |
{new PipelineTest(GRCh37Ref2bit_chr2021, hiSeqBam_chr20, ".bam", dbSNPb37_20, "--join-strategy OVERLAPS_PARTITIONER --read-shard-padding 1000 --known-sites " + more20Sites, getResourceDir() + expectedMultipleKnownSites, getResourceDir() + expectedMultipleKnownSitesVcf)}, | ||
|
||
// BWA-MEM | ||
{new PipelineTest(GRCh37Ref2bit_chr2021, unalignedBam, ".bam", dbSNPb37_20, "--align --bwa-mem-index-image " + GRCh37Ref_2021_img + " --disable-sequence-dictionary-validation true --join-strategy BROADCAST --known-sites " + more20Sites, null, largeFileTestDir + expectedMultipleKnownSitesFromUnalignedVcf)}, | ||
{new PipelineTest(GRCh37Ref2bit_chr2021, unalignedBam, ".bam", dbSNPb37_20, "--align --bwa-mem-index-image " + GRCh37Ref_2021_img + " --join-strategy BROADCAST --known-sites " + more20Sites, null, largeFileTestDir + expectedMultipleKnownSitesFromUnalignedVcf)}, | ||
}; | ||
} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like having these as inner classes so we don't have separate files for them. I assume that its the case that an inner class inside of an interface is static wrt the containing/implementing class ? Can/should these be static ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're static by default in an interface and intelli complains that it's redundnat if you mark them as static. I can add it in though if you think it's clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to change anything. I just didn't recall seeing that before, but thats about what I suspected.