diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/AssemblyBasedCallerArgumentCollection.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/AssemblyBasedCallerArgumentCollection.java index 1857f605dde..6d17a547d32 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/AssemblyBasedCallerArgumentCollection.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/AssemblyBasedCallerArgumentCollection.java @@ -4,10 +4,12 @@ import org.broadinstitute.barclay.argparser.Advanced; import org.broadinstitute.barclay.argparser.Argument; import org.broadinstitute.barclay.argparser.ArgumentCollection; +import org.broadinstitute.gatk.nativebindings.smithwaterman.SWParameters; import org.broadinstitute.hellbender.engine.FeatureInput; import org.broadinstitute.hellbender.tools.walkers.haplotypecaller.readthreading.ReadThreadingAssembler; import org.broadinstitute.hellbender.utils.haplotype.HaplotypeBAMWriter; import org.broadinstitute.hellbender.utils.smithwaterman.SmithWatermanAligner; +import org.broadinstitute.hellbender.utils.smithwaterman.SmithWatermanAlignmentConstants; /** * Set of arguments for Assembly Based Callers @@ -34,6 +36,26 @@ public abstract class AssemblyBasedCallerArgumentCollection { public static final String PILEUP_DETECTION_LONG_NAME = "pileup-detection"; + public static final String SMITH_WATERMAN_DANGLING_END_MATCH_VALUE_LONG_NAME = "smith-waterman-dangling-end-match-value"; + public static final String SMITH_WATERMAN_DANGLING_END_MISMATCH_PENALTY_LONG_NAME = "smith-waterman-dangling-end-mismatch-penalty"; + public static final String SMITH_WATERMAN_DANGLING_END_GAP_OPEN_PENALTY_LONG_NAME = "smith-waterman-dangling-end-gap-open-penalty"; + public static final String SMITH_WATERMAN_DANGLING_END_GAP_EXTEND_PENALTY_LONG_NAME = "smith-waterman-dangling-end-gap-extend-penalty"; + public static final String SMITH_WATERMAN_HAPLOTYPE_TO_REFERENCE_MATCH_VALUE_LONG_NAME = "smith-waterman-haplotype-to-reference-match-value"; + public static final String SMITH_WATERMAN_HAPLOTYPE_TO_REFERENCE_MISMATCH_PENALTY_LONG_NAME = "smith-waterman-haplotype-to-reference-mismatch-penalty"; + public static final String SMITH_WATERMAN_HAPLOTYPE_TO_REFERENCE_GAP_OPEN_PENALTY_LONG_NAME = "smith-waterman-haplotype-to-reference-gap-open-penalty"; + public static final String SMITH_WATERMAN_HAPLOTYPE_TO_REFERENCE_GAP_EXTEND_PENALTY_LONG_NAME = "smith-waterman-haplotype-to-reference-gap-extend-penalty"; + public static final String SMITH_WATERMAN_READ_TO_HAPLOTYPE_MATCH_VALUE_LONG_NAME = "smith-waterman-read-to-haplotype-match-value"; + public static final String SMITH_WATERMAN_READ_TO_HAPLOTYPE_MISMATCH_PENALTY_LONG_NAME = "smith-waterman-read-to-haplotype-mismatch-penalty"; + public static final String SMITH_WATERMAN_READ_TO_HAPLOTYPE_GAP_OPEN_PENALTY_LONG_NAME = "smith-waterman-read-to-haplotype-gap-open-penalty"; + public static final String SMITH_WATERMAN_READ_TO_HAPLOTYPE_GAP_EXTEND_PENALTY_LONG_NAME = "smith-waterman-read-to-haplotype-gap-extend-penalty"; + + /** See documentation at {@link SmithWatermanAlignmentConstants#STANDARD_NGS}. */ + private static final SWParameters DEFAULT_DANGLING_END_SMITH_WATERMAN_PARAMETERS = SmithWatermanAlignmentConstants.STANDARD_NGS; + /** See documentation at {@link SmithWatermanAlignmentConstants#NEW_SW_PARAMETERS}. */ + private static final SWParameters DEFAULT_HAPLOTYPE_TO_REFERENCE_SMITH_WATERMAN_PARAMETERS = SmithWatermanAlignmentConstants.NEW_SW_PARAMETERS; + /** See documentation at {@link SmithWatermanAlignmentConstants#ALIGNMENT_TO_BEST_HAPLOTYPE_SW_PARAMETERS}. */ + private static final SWParameters DEFAULT_READ_TO_HAPLOTYPE_SMITH_WATERMAN_PARAMETERS = SmithWatermanAlignmentConstants.ALIGNMENT_TO_BEST_HAPLOTYPE_SW_PARAMETERS; + public ReadThreadingAssembler createReadThreadingAssembler() { final ReadThreadingAssembler assemblyEngine = assemblerArgs.makeReadThreadingAssembler(); assemblyEngine.setDebug(assemblerArgs.debugAssembly); @@ -153,4 +175,132 @@ public ReadThreadingAssembler createReadThreadingAssembler() { "that overlap the variant or any base no further than this distance expressed in base pairs", optional = true) public int informativeReadOverlapMargin = 2; -} + + /** + * Enables pileup-based haplotype creation and variant detection + * + * NOTE: --pileup-detection is a beta feature. Use this mode at your own risk. + */ + @Argument(fullName= PILEUP_DETECTION_LONG_NAME, doc = "If enabled, the variant caller will create pileup-based haplotypes in addition to the assembly-based haplotype generation.", optional = true) + public boolean usePileupDetection = false; + + + // ----------------------------------------------------------------------------------------------- + // Smith-Waterman parameters for dangling-end recovery + // ----------------------------------------------------------------------------------------------- + + @Advanced + @Argument(fullName = SMITH_WATERMAN_DANGLING_END_MATCH_VALUE_LONG_NAME, + doc = "Smith-Waterman match value for dangling-end recovery.", + minValue = 0, + optional = true) + public int smithWatermanDanglingEndMatchValue = DEFAULT_DANGLING_END_SMITH_WATERMAN_PARAMETERS.getMatchValue(); + + @Advanced + @Argument(fullName = SMITH_WATERMAN_DANGLING_END_MISMATCH_PENALTY_LONG_NAME, + doc = "Smith-Waterman mismatch penalty for dangling-end recovery.", + maxValue = 0, + optional = true) + public int smithWatermanDanglingEndMismatchPenalty = DEFAULT_DANGLING_END_SMITH_WATERMAN_PARAMETERS.getMismatchPenalty(); + + @Advanced + @Argument(fullName = SMITH_WATERMAN_DANGLING_END_GAP_OPEN_PENALTY_LONG_NAME, + doc = "Smith-Waterman gap-open penalty for dangling-end recovery.", + maxValue = 0, + optional = true) + public int smithWatermanDanglingEndGapOpenPenalty = DEFAULT_DANGLING_END_SMITH_WATERMAN_PARAMETERS.getGapOpenPenalty(); + + @Advanced + @Argument(fullName = SMITH_WATERMAN_DANGLING_END_GAP_EXTEND_PENALTY_LONG_NAME, + doc = "Smith-Waterman gap-extend penalty for dangling-end recovery.", + maxValue = 0, + optional = true) + public int smithWatermanDanglingEndGapExtendPenalty = DEFAULT_DANGLING_END_SMITH_WATERMAN_PARAMETERS.getGapExtendPenalty(); + + // ----------------------------------------------------------------------------------------------- + // Smith-Waterman parameters for haplotype-to-reference alignment + // ----------------------------------------------------------------------------------------------- + + @Advanced + @Argument(fullName = SMITH_WATERMAN_HAPLOTYPE_TO_REFERENCE_MATCH_VALUE_LONG_NAME, + doc = "Smith-Waterman match value for haplotype-to-reference alignment.", + minValue = 0, + optional = true) + public int smithWatermanHaplotypeToReferenceMatchValue = DEFAULT_HAPLOTYPE_TO_REFERENCE_SMITH_WATERMAN_PARAMETERS.getMatchValue(); + + @Advanced + @Argument(fullName = SMITH_WATERMAN_HAPLOTYPE_TO_REFERENCE_MISMATCH_PENALTY_LONG_NAME, + doc = "Smith-Waterman mismatch penalty for haplotype-to-reference alignment.", + maxValue = 0, + optional = true) + public int smithWatermanHaplotypeToReferenceMismatchPenalty = DEFAULT_HAPLOTYPE_TO_REFERENCE_SMITH_WATERMAN_PARAMETERS.getMismatchPenalty(); + + @Advanced + @Argument(fullName = SMITH_WATERMAN_HAPLOTYPE_TO_REFERENCE_GAP_OPEN_PENALTY_LONG_NAME, + doc = "Smith-Waterman gap-open penalty for haplotype-to-reference alignment.", + maxValue = 0, + optional = true) + public int smithWatermanHaplotypeToReferenceGapOpenPenalty = DEFAULT_HAPLOTYPE_TO_REFERENCE_SMITH_WATERMAN_PARAMETERS.getGapOpenPenalty(); + + @Advanced + @Argument(fullName = SMITH_WATERMAN_HAPLOTYPE_TO_REFERENCE_GAP_EXTEND_PENALTY_LONG_NAME, + doc = "Smith-Waterman gap-extend penalty for haplotype-to-reference alignment.", + maxValue = 0, + optional = true) + public int smithWatermanHaplotypeToReferenceGapExtendPenalty = DEFAULT_HAPLOTYPE_TO_REFERENCE_SMITH_WATERMAN_PARAMETERS.getGapExtendPenalty(); + + // ----------------------------------------------------------------------------------------------- + // Smith-Waterman parameters for read-to-haplotype alignment + // ----------------------------------------------------------------------------------------------- + + @Advanced + @Argument(fullName = SMITH_WATERMAN_READ_TO_HAPLOTYPE_MATCH_VALUE_LONG_NAME, + doc = "Smith-Waterman match value for read-to-haplotype alignment.", + minValue = 0, + optional = true) + public int smithWatermanReadToHaplotypeMatchValue = DEFAULT_READ_TO_HAPLOTYPE_SMITH_WATERMAN_PARAMETERS.getMatchValue(); + + @Advanced + @Argument(fullName = SMITH_WATERMAN_READ_TO_HAPLOTYPE_MISMATCH_PENALTY_LONG_NAME, + doc = "Smith-Waterman mismatch penalty for read-to-haplotype alignment.", + maxValue = 0, + optional = true) + public int smithWatermanReadToHaplotypeMismatchPenalty = DEFAULT_READ_TO_HAPLOTYPE_SMITH_WATERMAN_PARAMETERS.getMismatchPenalty(); + + @Advanced + @Argument(fullName = SMITH_WATERMAN_READ_TO_HAPLOTYPE_GAP_OPEN_PENALTY_LONG_NAME, + doc = "Smith-Waterman gap-open penalty for read-to-haplotype alignment.", + maxValue = 0, + optional = true) + public int smithWatermanReadToHaplotypeGapOpenPenalty = DEFAULT_READ_TO_HAPLOTYPE_SMITH_WATERMAN_PARAMETERS.getGapOpenPenalty(); + + @Advanced + @Argument(fullName = SMITH_WATERMAN_READ_TO_HAPLOTYPE_GAP_EXTEND_PENALTY_LONG_NAME, + doc = "Smith-Waterman gap-extend penalty for read-to-haplotype alignment.", + maxValue = 0, + optional = true) + public int smithWatermanReadToHaplotypeGapExtendPenalty = DEFAULT_READ_TO_HAPLOTYPE_SMITH_WATERMAN_PARAMETERS.getGapExtendPenalty(); + + public SWParameters getDanglingEndSWParameters() { + return new SWParameters( + smithWatermanDanglingEndMatchValue, + smithWatermanDanglingEndMismatchPenalty, + smithWatermanDanglingEndGapOpenPenalty, + smithWatermanDanglingEndGapExtendPenalty); + } + + public SWParameters getHaplotypeToReferenceSWParameters() { + return new SWParameters( + smithWatermanHaplotypeToReferenceMatchValue, + smithWatermanHaplotypeToReferenceMismatchPenalty, + smithWatermanHaplotypeToReferenceGapOpenPenalty, + smithWatermanHaplotypeToReferenceGapExtendPenalty); + } + + public SWParameters getReadToHaplotypeSWParameters() { + return new SWParameters( + smithWatermanReadToHaplotypeMatchValue, + smithWatermanReadToHaplotypeMismatchPenalty, + smithWatermanReadToHaplotypeGapOpenPenalty, + smithWatermanReadToHaplotypeGapExtendPenalty); + } \ No newline at end of file