public VcfWriterConfig(VariantCallingParameters callerOptions, VcfWritingParameters outputOptions, BamFilterParameters bamFilterOptions, SampleAggregationParameters sampleAggregationParameters, bool debugMode, bool outputBiasFiles, bool hasForcedGT = false) { DepthFilterThreshold = outputOptions.OutputGvcfFile ? callerOptions.MinimumCoverage : (callerOptions.LowDepthFilter > callerOptions.MinimumCoverage) ? callerOptions.LowDepthFilter : (int?)null; IndelRepeatFilterThreshold = callerOptions.IndelRepeatFilter > 0 ? callerOptions.IndelRepeatFilter : (int?)null; VariantQualityFilterThreshold = callerOptions.MinimumVariantQScoreFilter; GenotypeQualityFilterThreshold = callerOptions.LowGenotypeQualityFilter.HasValue && callerOptions.MinimumVariantQScoreFilter > callerOptions.MinimumVariantQScore ? callerOptions.LowGenotypeQualityFilter : null; StrandBiasFilterThreshold = callerOptions.StrandBiasAcceptanceCriteria < 1 ? callerOptions.StrandBiasAcceptanceCriteria : (float?)null; AmpliconBiasFilterThreshold = callerOptions.AmpliconBiasFilterThreshold > 0 ? callerOptions.AmpliconBiasFilterThreshold : (float?)null; FrequencyFilterThreshold = GetMinFreqFilterForVcfHeader(callerOptions); MinFrequencyThreshold = callerOptions.MinimumFrequency; ShouldOutputNoCallFraction = outputOptions.ReportNoCalls; ShouldOutputStrandBiasAndNoiseLevel = ShouldOutputNoiseLevelAndStrandBias(debugMode, outputBiasFiles, callerOptions.StrandBiasAcceptanceCriteria); ShouldFilterOnlyOneStrandCoverage = callerOptions.FilterOutVariantsPresentOnlyOneStrand; EstimatedBaseCallQuality = callerOptions.NoiseLevelUsedForQScoring; ShouldOutputRcCounts = outputOptions.ReportRcCounts; ShouldOutputTsCounts = outputOptions.ReportTsCounts; AllowMultipleVcfLinesPerLoci = outputOptions.AllowMultipleVcfLinesPerLoci; PloidyModel = callerOptions.PloidyModel; RMxNFilterMaxLengthRepeat = callerOptions.RMxNFilterMaxLengthRepeat; RMxNFilterMinRepetitions = callerOptions.RMxNFilterMinRepetitions; RMxNFilterFrequencyLimit = callerOptions.RMxNFilterFrequencyLimit; NoiseModel = callerOptions.NoiseModel; ShouldReportGp = outputOptions.ReportGp; NoCallFilterThreshold = callerOptions.NoCallFilterThreshold; ShouldOutputSuspiciousCoverageFraction = outputOptions.ReportSuspiciousCoverageFraction; if (sampleAggregationParameters != null) { ShouldOutputProbeBias = true; ProbePoolBiasFilterThreshold = sampleAggregationParameters.ProbePoolBiasThreshold; } HasForcedGt = hasForcedGT; }
//if I was not in a hurry, we could refactor this into the Config class and let it be re-used by Scylla and VQR... private static VcfWriterConfig GetWriterConfigToMatchInputVcf(string vcfIn) { List <string> vcfHeaderLines; using (var reader = new VcfReader(vcfIn)) { vcfHeaderLines = reader.HeaderLines; } PiscesOptionsParser piscesOptionsParser = VcfConsumerAppParsingUtils.GetPiscesOptionsFromVcfHeader(vcfHeaderLines); if (piscesOptionsParser.ParsingFailed) { Logger.WriteToLog("Unable to parse the original Pisces commandline"); throw new ArgumentException("Unable to parse the input vcf header: " + vcfIn); } VariantCallingParameters variantCallingParams = piscesOptionsParser.PiscesOptions.VariantCallingParameters; VcfWritingParameters vcfWritingParams = piscesOptionsParser.PiscesOptions.VcfWritingParameters; BamFilterParameters bamFilterParams = piscesOptionsParser.PiscesOptions.BamFilterParameters; var config = new VcfWriterConfig(variantCallingParams, vcfWritingParams, bamFilterParams, null, false, false); return(config); }
public static Dictionary <string, OptionSet> GetVcfWritingOptionsMethods(VcfWritingParameters options) { var vcfWriterOps = new OptionSet { { "gvcf=", OptionTypes.BOOL + " Output gVCF files, 'true' or 'false'", value => options.OutputGvcfFile = bool.Parse(value) }, { "crushvcf=", OptionTypes.BOOL + " To crush vcf output to one line per loci", value => options.ForceCrush = bool.Parse(value) }, { "reportnocalls=", OptionTypes.BOOL + " 'true' or 'false'. default, false", value => options.ReportNoCalls = bool.Parse(value) }, { "reportrccounts=", OptionTypes.BOOL + " Report collapsed read count, When BAM files contain X1 and X2 tags, output read counts for duplex-stitched, duplex-nonstitched, simplex-stitched, and simplex-nonstitched. 'true' or 'false'. default, false", value => options.ReportRcCounts = bool.Parse(value) }, { "reporttscounts=", OptionTypes.BOOL + " Report collapsed read count by different template strands, Conditional on ReportRcCounts, output read counts for duplex-stitched, duplex-nonstitched, simplex-forward-stitched, simplex-forward-nonstitched, simplex-reverse-stitched, simplex-reverse-nonstitched. 'true' or 'false'. default, false", value => options.ReportTsCounts = bool.Parse(value) }, { "reportSuspiciousCoverageFraction=", OptionTypes.BOOL + " Report fraction of total coverage (for spanning variants, this is start + end coverage, so up to double the reported coverage) that is 'suspicious' i.e. unanchored and bearing some resemblance to an insertion at that site. 'true' or 'false'. default, false", value => options.ReportSuspiciousCoverageFraction = bool.Parse(value) } }; var optionDict = new Dictionary <string, OptionSet> { { OptionSetNames.VcfWriting, vcfWriterOps }, }; return(optionDict); }
public AdaptiveGtOptions() { // Set defaults VariantCallingParams = new VariantCallingParameters { PloidyModel = Pisces.Domain.Types.PloidyModel.DiploidByAdaptiveGT, IsMale = false }; VcfWritingParams = new VcfWritingParameters { OutputGvcfFile = false, ForceCrush = true, ReportGp = true }; SetDerivedValues(); }
public static void AddVcfWritingArgumentParsing(Dictionary <string, OptionSet> parsingMethods, VcfWritingParameters options) { var vcfWritingOptionDict = GetVcfWritingOptionsMethods(options); foreach (var key in vcfWritingOptionDict.Keys) { foreach (var optSet in vcfWritingOptionDict[key]) { if (!parsingMethods.ContainsKey(key)) { parsingMethods.Add(key, new OptionSet()); } parsingMethods[key].Add(optSet); } } }