public void InvalidVcfOutputFolder() { Assert.False(Directory.Exists("56:\\Illumina\\OutputFolder")); var outputFolder = Path.Combine("56:\\Illumina\\OutputFolder"); string bamChr19 = Path.Combine(TestPaths.LocalTestDataDirectory, "Chr19.bam"); string bamChr17Chr19 = Path.Combine(TestPaths.LocalTestDataDirectory, "Chr17Chr19.bam"); string bamChr17Chr19Dup = Path.Combine(TestPaths.LocalTestDataDirectory, "Chr17Chr19_removedSQlines.bam"); string intervalsChr19 = Path.Combine(TestPaths.LocalTestDataDirectory, "Chr19.picard"); string intervalsChr17 = Path.Combine(TestPaths.LocalTestDataDirectory, "chr17only.picard"); string genomeChr19 = Path.Combine(TestPaths.SharedGenomesDirectory, "chr19"); var appOptions = new PiscesApplicationOptions { BAMPaths = new[] { bamChr19, bamChr17Chr19, bamChr17Chr19Dup }, IntervalPaths = new[] { intervalsChr17, intervalsChr19, null }, GenomePaths = new[] { genomeChr19 }, OutputDirectory = outputFolder }; var parser = new PiscesOptionsParser() { Options = appOptions }; Assert.Throws <ArgumentException>(() => parser.ValidateAndSetDerivedValues()); }
public void PopulateBAMPaths() { var BAMFolder = TestPaths.SharedBamDirectory; //Happy Path var options_1 = new PiscesApplicationOptions() { BAMPaths = BamProcessorParsingUtils.UpdateBamPathsWithBamsFromFolder(BAMFolder), GenomePaths = new[] { _existingGenome }, IntervalPaths = new[] { _existingInterval } }; Assert.NotNull(options_1.BAMPaths); Assert.True(options_1.BAMPaths.Length > 0); //no bam files found var options_3 = new PiscesApplicationOptions() { GenomePaths = new[] { _existingGenome }, }; var parser = new PiscesOptionsParser() { Options = options_3 }; Assert.Null(options_3.BAMPaths); Assert.Throws <ArgumentException>(() => parser.ValidateAndSetDerivedValues()); }
private void ExecuteValidationTest(Action <PiscesApplicationOptions> testSetup, bool shouldPass) { var options = GetBasicOptions(); testSetup(options); var parser = new PiscesOptionsParser() { Options = options }; if (shouldPass) { parser.ValidateAndSetDerivedValues(); } else { Assert.Throws <ArgumentException>(() => parser.ValidateAndSetDerivedValues()); } }
public void Validate() { // --------------------- // verify default should be valid // --------------------- var option = GetBasicOptions(); var parser = new PiscesOptionsParser() { Options = option }; parser.ValidateAndSetDerivedValues(); // --------------------- // verify log folder // --------------------- Assert.Equal(Path.Combine(TestPaths.SharedBamDirectory, "PiscesLogs"), option.LogFolder); // --------------------------------------------------- // BAMPath(s) should be specified. // --------------------------------------------------- ExecuteValidationTest((o) => { o.BAMPaths = new[] { _existingBamPath }; }, true); ExecuteValidationTest((o) => { o.BAMPaths = new[] { "bampath1.bam" }; }, false); ExecuteValidationTest((o) => { o.BAMPaths = null; }, false); // --------------------------------------------------- // BAMFolder // Folder should exist (given as the first string in BAMPaths) // 1 Genome Path should be specified when BAMFolder is specified. // Atmost 1 Interval Path should be specified when BAMFolder is specified. // Threading by chromosome is not supported when BAMFolder is specified. // --------------------------------------------------- ExecuteValidationTest(o => { o.BAMPaths = new string[] { @"C:\NonexistantBAMFolder" }; o.GenomePaths = new[] { _existingGenome }; }, false); ExecuteValidationTest(o => { o.BAMPaths = new string[] { TestPaths.SharedBamDirectory }; o.GenomePaths = new[] { "folder1", "folder2" }; }, false); ExecuteValidationTest(o => { o.BAMPaths = new string[] { TestPaths.SharedBamDirectory }; o.GenomePaths = new[] { _existingGenome }; o.IntervalPaths = new[] { "file1.intervals", "file2.intervals" }; }, false); ExecuteValidationTest(o => { o.BAMPaths = BamProcessorParsingUtils.UpdateBamPathsWithBamsFromFolder(TestPaths.SharedBamDirectory); o.GenomePaths = new[] { _existingGenome }; o.IntervalPaths = new[] { _existingInterval }; }, true); // --------------------- // BAM Paths // Duplicate BAMPaths detected. // BAM Path does not exist. // --------------------- ExecuteValidationTest((o) => { o.BAMPaths = new string[0]; }, false); ExecuteValidationTest((o) => { o.BAMPaths = new[] { _existingBamPath, _existingBamPath }; }, false); ExecuteValidationTest((o) => { o.BAMPaths = new[] { "nonexistant.bam" }; }, false); // genome paths ExecuteValidationTest((o) => { o.GenomePaths = null; }, false); ExecuteValidationTest((o) => { o.GenomePaths = new string[0]; }, false); ExecuteValidationTest((o) => { o.GenomePaths = new[] { _existingGenome, _existingGenome }; }, false); ExecuteValidationTest((o) => { o.GenomePaths = new[] { "nonexistant" }; }, false); ExecuteValidationTest((o) => { o.BAMPaths = new[] { _existingBamPath, _existingBamPath2 }; o.GenomePaths = new[] { _existingGenome, _existingGenome }; }, true); // dup genomes ok // intervals ExecuteValidationTest((o) => { o.IntervalPaths = new[] { _existingInterval, _existingInterval }; }, false); ExecuteValidationTest((o) => { o.IntervalPaths = new[] { "nonexistant.picard" }; }, false); ExecuteValidationTest((o) => { o.BAMPaths = new[] { _existingBamPath, _existingBamPath2 }; o.IntervalPaths = new[] { _existingInterval, _existingInterval }; }, true); // dup intervals ok ExecuteValidationTest((o) => { o.BAMPaths = new[] { _existingBamPath, _existingBamPath2 }; o.IntervalPaths = new[] { _existingInterval, _existingInterval, _existingInterval }; }, false); // --------------------- // verify parameters // --------------------- ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumVariantQScore = 0; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumVariantQScore = 100; o.VariantCallingParameters.MinimumVariantQScoreFilter = 100; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumVariantQScore = -1; }, false); ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumVariantQScore = 101; }, false); ExecuteValidationTest((o) => { o.VariantCallingParameters.MaximumVariantQScore = 0; o.VariantCallingParameters.MinimumVariantQScore = 0; o.VariantCallingParameters.MinimumVariantQScoreFilter = 0; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.MaximumVariantQScore = 100; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.MaximumVariantQScore = -1; }, false); ExecuteValidationTest((o) => { o.VariantCallingParameters.MaximumVariantQScore = 101; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumVariantQScore = 50; o.VariantCallingParameters.MaximumVariantQScore = 49; }, false); ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumVariantQScore = 50; o.VariantCallingParameters.MaximumVariantQScore = 50; o.VariantCallingParameters.MinimumVariantQScoreFilter = 50; }, true); ExecuteValidationTest((o) => { o.BamFilterParameters.MinimumBaseCallQuality = 0; }, true); ExecuteValidationTest((o) => { o.BamFilterParameters.MinimumBaseCallQuality = -1; }, false); ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumFrequency = 0f; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumFrequency = 1f; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumFrequency = -0.99f; }, false); ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumFrequency = 1.01f; }, false); ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumVariantQScoreFilter = o.VariantCallingParameters.MinimumVariantQScore; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumVariantQScoreFilter = o.VariantCallingParameters.MaximumVariantQScore; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumVariantQScoreFilter = o.VariantCallingParameters.MinimumVariantQScore - 1; }, false); ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumVariantQScoreFilter = o.VariantCallingParameters.MaximumVariantQScore + 1; }, false); ExecuteValidationTest((o) => { o.VariantCallingParameters.ForcedNoiseLevel = 0; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.ForcedNoiseLevel = -50; }, false); ExecuteValidationTest((o) => { o.MaxSizeMNV = 0; }, true); // ok if not calling mnv ExecuteValidationTest((o) => { o.MaxGapBetweenMNV = -1; }, true); // ok if not calling mnv ExecuteValidationTest((o) => { o.OutputDirectory = TestPaths.LocalTestDataDirectory; }, true); // True for valid path ExecuteValidationTest((o) => { o.CallMNVs = true; o.MaxSizeMNV = 1; }, true); ExecuteValidationTest((o) => { o.CallMNVs = true; o.MaxSizeMNV = 0; }, false); ExecuteValidationTest((o) => { o.CallMNVs = true; o.MaxSizeMNV = GlobalConstants.RegionSize; }, true); ExecuteValidationTest((o) => { o.CallMNVs = true; o.MaxSizeMNV = GlobalConstants.RegionSize + 1; }, false); ExecuteValidationTest((o) => { o.CallMNVs = true; o.MaxGapBetweenMNV = 0; }, true); ExecuteValidationTest((o) => { o.CallMNVs = true; o.MaxGapBetweenMNV = -1; }, false); ExecuteValidationTest((o) => { o.BamFilterParameters.MinimumMapQuality = 0; }, true); ExecuteValidationTest((o) => { o.BamFilterParameters.MinimumMapQuality = -1; }, false); ExecuteValidationTest((o) => { o.VariantCallingParameters.StrandBiasAcceptanceCriteria = 0f; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.StrandBiasAcceptanceCriteria = -0.01f; }, false); ExecuteValidationTest((o) => { o.MaxNumThreads = 1; }, true); ExecuteValidationTest((o) => { o.MaxNumThreads = 0; }, false); //FilteredVariantFrequency Scenarios ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumFrequencyFilter = 0; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumFrequencyFilter = 1f; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumFrequencyFilter = -1; o.VariantCallingParameters.MinimumFrequency = -1; }, false); ExecuteValidationTest((o) => { o.VariantCallingParameters.MinimumFrequencyFilter = 1.1f; }, false); //FilteredLowGenomeQuality Scenarios ExecuteValidationTest((o) => { o.VariantCallingParameters.PloidyModel = PloidyModel.DiploidByThresholding; o.VariantCallingParameters.LowGenotypeQualityFilter = 0; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.PloidyModel = PloidyModel.DiploidByThresholding; o.VariantCallingParameters.LowGenotypeQualityFilter = 100; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.PloidyModel = PloidyModel.DiploidByThresholding; o.VariantCallingParameters.LowGenotypeQualityFilter = -1; }, false); ExecuteValidationTest((o) => { o.VariantCallingParameters.PloidyModel = PloidyModel.DiploidByThresholding; o.VariantCallingParameters.LowGenotypeQualityFilter = 101; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.LowGenotypeQualityFilter = 0; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.LowGenotypeQualityFilter = 100; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.LowGenotypeQualityFilter = -1; }, false); ExecuteValidationTest((o) => { o.VariantCallingParameters.LowGenotypeQualityFilter = 101; }, true); //FilteredIndelRepeats Scenarios ExecuteValidationTest((o) => { o.VariantCallingParameters.IndelRepeatFilter = 0; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.IndelRepeatFilter = 10; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.IndelRepeatFilter = -1; }, false); ExecuteValidationTest((o) => { o.VariantCallingParameters.IndelRepeatFilter = 11; }, false); //FilteredLowDepth Scenarios ExecuteValidationTest(o => { o.VariantCallingParameters.LowDepthFilter = 0; o.VariantCallingParameters.MinimumCoverage = 0; }, true); ExecuteValidationTest(o => { o.VariantCallingParameters.LowDepthFilter = 1; o.VariantCallingParameters.MinimumCoverage = 0; }, true); ExecuteValidationTest(o => { o.VariantCallingParameters.LowDepthFilter = -1; o.VariantCallingParameters.MinimumCoverage = 0; }, false); //Priors path ExecuteValidationTest((o) => { o.PriorsPath = _existingBamPath; }, true); ExecuteValidationTest((o) => { o.PriorsPath = Path.Combine(TestPaths.LocalTestDataDirectory, "Nonexistant.txt"); }, false); // Thread by chr ExecuteValidationTest(o => { o.ThreadByChr = true; o.ChromosomeFilter = "chr1"; }, false); // Validate ncfilter ExecuteValidationTest((o) => { o.VariantCallingParameters.NoCallFilterThreshold = 0f; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.NoCallFilterThreshold = 1f; }, true); ExecuteValidationTest((o) => { o.VariantCallingParameters.NoCallFilterThreshold = -1f; }, false); ExecuteValidationTest((o) => { o.VariantCallingParameters.NoCallFilterThreshold = 2f; }, false); }