Example #1
0
 protected virtual ICoverageCalculator CreateCoverageCalculator(IAlignmentSource alignmentSource)
 {
     return(_options.CoverageMethod == CoverageMethod.Exact
         ? (ICoverageCalculator) new ExactCoverageCalculator()
         : alignmentSource.SourceIsCollapsed && alignmentSource.SourceIsStitched? new CollapsedCoverageCalculator(considerAnchorInformation: _options.TrackedAnchorSize > 0) :
            new CoverageCalculator(considerAnchorInformation: _options.TrackedAnchorSize > 0));
 }
Example #2
0
 public SomaticVariantCaller(IAlignmentSource alignmentSource, ICandidateVariantFinder variantFinder, IAlleleCaller alleleCaller,
                             IVcfWriter <CalledAllele> vcfWriter, IStateManager stateManager, ChrReference chrReference, IRegionMapper regionMapper,
                             IStrandBiasFileWriter biasFileWriter, ChrIntervalSet intervalSet = null)
 {
     _alignmentSource = alignmentSource;
     _variantFinder   = variantFinder;
     _alleleCaller    = alleleCaller;
     _vcfWriter       = vcfWriter;
     _stateManager    = stateManager;
     _chrReference    = chrReference;
     _regionMapper    = regionMapper;
     _biasFileWriter  = biasFileWriter;
     _intervalSet     = intervalSet;
 }
 public SomaticVariantCaller(IAlignmentSource alignmentSource, ICandidateVariantFinder variantFinder, IAlleleCaller alleleCaller,
                             IVcfWriter <CalledAllele> vcfWriter, IStateManager stateManager, ChrReference chrReference, IRegionMapper regionMapper,
                             IStrandBiasFileWriter biasFileWriter, ChrIntervalSet intervalSet = null, HashSet <Tuple <string, int, string, string> > forcedGTAlleles = null)
 {
     _alignmentSource = alignmentSource;
     _variantFinder   = variantFinder;
     _alleleCaller    = alleleCaller;
     _vcfWriter       = vcfWriter;
     _stateManager    = stateManager;
     _chrReference    = chrReference;
     _regionMapper    = regionMapper;
     _biasFileWriter  = biasFileWriter;
     _intervalSet     = intervalSet;
     _forcedGtAlleles = forcedGTAlleles;
     _unProcessedForcedAllelesByPos = CreateForcedAllelePos(_forcedGtAlleles);
 }
Example #4
0
        public SomaticVariantCaller(IAlignmentSource alignmentSource, ICandidateVariantFinder variantFinder, IAlleleCaller alleleCaller,
                                    IVcfWriter vcfWriter, IStateManager stateManager, ChrReference chrReference, IRegionPadder regionMapper, IStrandBiasFileWriter biasFileWriter)
        {
            _alignmentSource = alignmentSource;
            _variantFinder   = variantFinder;
            _alleleCaller    = alleleCaller;
            _vcfWriter       = vcfWriter;
            _stateManager    = stateManager;
            _chrReference    = chrReference;
            _regionMapper    = regionMapper;
            _biasFileWriter  = biasFileWriter;

            if (_alignmentSource.ChromosomeFilter != _chrReference.Name)
            {
                throw new ArgumentException(string.Format("Chromosome filter in alignment source '{0}' does not match to current chromosome '{1}'", _alignmentSource.ChromosomeFilter, _chrReference.Name));
            }
        }
Example #5
0
        protected virtual IAlleleCaller CreateVariantCaller(ChrReference chrReference, ChrIntervalSet intervalSet, IAlignmentSource alignmentSource, HashSet <Tuple <string, int, string, string> > forceGtAlleles = null)
        {
            var coverageCalculator = CreateCoverageCalculator(alignmentSource);
            var genotypeCalculator = GenotypeCreator.CreateGenotypeCalculator(
                _options.VariantCallingParameters.PloidyModel, _options.VariantCallingParameters.MinimumFrequencyFilter,
                _options.VariantCallingParameters.MinimumCoverage,
                _options.VariantCallingParameters.DiploidSNVThresholdingParameters,
                _options.VariantCallingParameters.DiploidINDELThresholdingParameters,
                _options.VariantCallingParameters.AdaptiveGenotypingParameters,
                _options.VariantCallingParameters.MinimumGenotypeQScore,
                _options.VariantCallingParameters.MaximumGenotypeQScore,
                _options.VariantCallingParameters.TargetLODFrequency,
                _options.VariantCallingParameters.MinimumFrequency,
                chrReference.Name, _options.VariantCallingParameters.IsMale);

            genotypeCalculator.SetMinFreqFilter(_options.VariantCallingParameters.MinimumFrequencyFilter);

            var locusProcessor = _options.VariantCallingParameters.PloidyModel == PloidyModel.DiploidByThresholding
                ? (ILocusProcessor) new DiploidLocusProcessor()
                : new SomaticLocusProcessor();

            var variantCallerConfig = new VariantCallerConfig
            {
                IncludeReferenceCalls        = _options.VcfWritingParameters.OutputGvcfFile,
                MinVariantQscore             = _options.VariantCallingParameters.MinimumVariantQScore,
                MaxVariantQscore             = _options.VariantCallingParameters.MaximumVariantQScore,
                MinGenotypeQscore            = _options.VariantCallingParameters.MinimumGenotypeQScore,
                MaxGenotypeQscore            = _options.VariantCallingParameters.MaximumGenotypeQScore,
                VariantQscoreFilterThreshold = _options.VariantCallingParameters.MinimumVariantQScoreFilter,
                NoCallFilterThreshold        = _options.VariantCallingParameters.NoCallFilterThreshold,
                AmpliconBiasFilterThreshold  = _options.VariantCallingParameters.AmpliconBiasFilterThreshold,
                MinCoverage  = _options.VariantCallingParameters.MinimumCoverage,
                MinFrequency = genotypeCalculator.MinVarFrequency,
                NoiseLevelUsedForQScoring  = _options.VariantCallingParameters.NoiseLevelUsedForQScoring,
                StrandBiasModel            = _options.VariantCallingParameters.StrandBiasModel,
                StrandBiasFilterThreshold  = _options.VariantCallingParameters.StrandBiasAcceptanceCriteria,
                FilterSingleStrandVariants = _options.VariantCallingParameters.FilterOutVariantsPresentOnlyOneStrand,
                GenotypeCalculator         = genotypeCalculator,
                VariantFreqFilter          = genotypeCalculator.MinVarFrequencyFilter,
                LowGTqFilter       = _options.VariantCallingParameters.LowGenotypeQualityFilter,
                IndelRepeatFilter  = _options.VariantCallingParameters.IndelRepeatFilter,
                LowDepthFilter     = _options.VariantCallingParameters.LowDepthFilter,
                ChrReference       = chrReference,
                RMxNFilterSettings = new RMxNFilterSettings
                {
                    RMxNFilterMaxLengthRepeat = _options.VariantCallingParameters.RMxNFilterMaxLengthRepeat,
                    RMxNFilterMinRepetitions  = _options.VariantCallingParameters.RMxNFilterMinRepetitions,
                    RMxNFilterFrequencyLimit  = _options.VariantCallingParameters.RMxNFilterFrequencyLimit
                },
                NoiseModel     = _options.VariantCallingParameters.NoiseModel,
                LocusProcessor = locusProcessor
            };



            var alleleCaller = new AlleleCaller(variantCallerConfig, intervalSet,
                                                CreateVariantCollapser(chrReference.Name, coverageCalculator),
                                                coverageCalculator);

            alleleCaller.AddForcedGtAlleles(forceGtAlleles);

            return(alleleCaller);
        }
 protected override IAlleleCaller CreateVariantCaller(ChrReference chrReference, ChrIntervalSet intervalSet, IAlignmentSource alignmentSource, HashSet <Tuple <string, int, string, string> > forcedGtAlleles = null)
 {
     return(MockVariantCaller != null ? MockVariantCaller.Object : base.CreateVariantCaller(chrReference, intervalSet, alignmentSource, forcedGtAlleles));
 }