Ejemplo n.º 1
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();
      }
Ejemplo n.º 2
0
      private void SetupExecute(IAlignmentExtractor extractorForRealign, IAlignmentExtractor extractorForCandidates, MockRealignmentWriter writer,
                                bool skipDups, int maxShift, string chrReference = null, float frequencyCutoff = 0, bool skipAndRemove = false, Action <IEnumerable <BamAlignment> > verifyRemappedReads = null, bool allowRescoringOrig0 = true, int realignWindowSize = 1000)
      {
          var ranker = new Mock <IIndelRanker>();

          var realigner = new ChrRealigner(new ChrReference()
            {
                Name = "chr", Sequence = chrReference ?? string.Join(string.Empty, Enumerable.Repeat("ACGT", 10))
            },
                                           extractorForCandidates,
                                           extractorForRealign, new IndelTargetFinder(0), ranker.Object,
                                           new  IndelTargetCaller(frequencyCutoff),
                                           new RealignStateManager(realignWindowSize: realignWindowSize), writer, skipDuplicates: skipDups, skipAndRemoveDuplicates: skipAndRemove, maxRealignShift: maxShift, allowRescoringOrig0: allowRescoringOrig0);

          realigner.Execute();
          Assert.Equal(writer.ReadsExpected, writer.ReadsWritten);

          verifyRemappedReads?.Invoke(writer.RemappedReads);
      }