Esempio n. 1
0
        public ChrRealigner(ChrReference chrReference, IAlignmentExtractor extractorForCandidates,
                            IAlignmentExtractor extractorForRealign, IIndelCandidateFinder indelFinder, IIndelRanker indelRanker,
                            ITargetCaller caller, RealignStateManager stateManager, IRealignmentWriter writer,
                            List <CandidateAllele> knownIndels   = null, int maxIndelSize         = 25, bool tryThree                   = false,
                            int anchorSizeThreshold              = 10, bool skipDuplicates        = false, bool skipAndRemoveDuplicates = false, bool remaskSoftclips = true, bool maskPartialInsertion = false, int minimumUnanchoredInsertionLength = 0,
                            bool tryRealignCleanSoftclippedReads = true, bool allowRescoringOrig0 = true, int maxRealignShift           = 250, AlignmentScorer alignmentScorer = null, bool debug       = false)
        {
            _chrReference           = chrReference;
            _extractorForCandidates = extractorForCandidates;
            _extractorForRealign    = extractorForRealign;
            _indelFinder            = indelFinder;
            _indelRanker            = indelRanker;
            _caller                          = caller;
            _stateManager                    = stateManager;
            _writer                          = writer;
            _knownIndels                     = knownIndels == null ? null : knownIndels.Select(i => new CandidateIndel(i)).ToList();
            _maxIndelSize                    = maxIndelSize;
            _anchorSizeThreshold             = anchorSizeThreshold;
            _skipDuplicates                  = skipDuplicates;
            _skipAndRemoveDuplicates         = skipAndRemoveDuplicates;
            _allowRescoringOrig0             = allowRescoringOrig0;
            _maxRealignShift                 = maxRealignShift;
            _tryRealignCleanSoftclippedReads = tryRealignCleanSoftclippedReads;
            _alignmentScorer                 = alignmentScorer;
            _debug = debug;

            if (alignmentScorer != null)
            {
                _alignmentComparer = new ScoredAlignmentComparer(alignmentScorer);
            }
            else
            {
                _alignmentComparer = new BasicAlignmentComparer();
            }

            _readRealigner = new ReadRealigner(_alignmentComparer, tryThree, remaskSoftclips, maskPartialInsertion, minimumUnanchoredInsertionLength);
        }
Esempio n. 2
0
      private void SetupMocksandExecute(IAlignmentExtractor extractorForRealign, IRealignmentWriter writer, bool skipDups, int maxShift, string chrReference = null, ITargetCaller targetCaller = null, IStateManager stateManager = null)

      {
          var extractorForCandidates = new Mock <IAlignmentExtractor>();
          var ranker      = new Mock <IIndelRanker>();
          var indel       = new CandidateIndel(new CandidateAllele("chr", 10, "C", "CTATATA", AlleleCategory.Insertion));
          var indelFinder = new Mock <IIndelCandidateFinder>();

          if (targetCaller == null)
          {
              var mocktargetCaller = new Mock <ITargetCaller>();
              mocktargetCaller.Setup(x => x.Call(It.IsAny <List <CandidateIndel> >(), It.IsAny <IAlleleSource>()))
              .Returns(new List <CandidateIndel>()
                {
                    indel
                });

              targetCaller = mocktargetCaller.Object;
          }

          var realigner = new ChrRealigner(new ChrReference()
            {
                Sequence = chrReference ?? string.Join(string.Empty, Enumerable.Repeat("ACGT", 10))
            }, extractorForCandidates.Object,
                                           extractorForRealign, indelFinder.Object, ranker.Object, targetCaller,
                                           new RealignStateManager(), writer, skipDuplicates: skipDups, maxRealignShift: maxShift);

          realigner.Execute();
      }