Exemplo n.º 1
0
        private void ProcessNeighborhood(VcfNeighborhood neighborhood, NeighborhoodClusterer clusterer, IEnumerable <VeadGroup> collapsedReads)
        {
            Logger.WriteToLog("Processing Neighborhood {0}.", neighborhood.Id);

            try
            {
                var clusters = clusterer.ClusterVeadGroups(collapsedReads.ToList());

                if (clusters != null)
                {
                    Logger.WriteToLog("Found " + clusters.Clusters.Length + " clusters in Nbhd " + neighborhood.Id);

                    //tjd+
                    //Commenting out for speed. We currently never use these results
                    //neighborhood.PhasingProbabiltiies =
                    //   VariantPhaser.GetPhasingProbabilities(neighborhood.VcfVariantSites, clusters);
                    //tjd-
                }

                bool crushNbhdVariantsToSamePositon = !_factory.Options.VcfWritingParams.AllowMultipleVcfLinesPerLoci;

                neighborhood.AddMnvsFromClusters(clusters.Clusters,
                                                 _factory.Options.BamFilterParams.MinimumBaseCallQuality, _factory.Options.VariantCallingParams.MaximumVariantQScore,
                                                 crushNbhdVariantsToSamePositon);
                neighborhood.SetGenotypesAndPruneExcessAlleles();
            }
            catch (Exception ex)
            {
                Logger.WriteToLog("Error processing neighborhood {0}", neighborhood.Id);
                Logger.WriteExceptionToLog(ex);
            }
        }
Exemplo n.º 2
0
        public void AddMnvsFromClusters()
        {
            //TODO even with mock cluster this takes too much setting up.
            var nbhd = new VcfNeighborhood(new VariantCallingParameters(), "chr1", new VariantSite(120), new VariantSite(121), "T");

            var vead = PhasedVariantTestUtilities.CreateVeadFromStringArray("r1", new[, ] {
                { "C", "A" }, { "G", "A" }, { "T", "A" }
            });
            var vead2 = PhasedVariantTestUtilities.CreateVeadFromStringArray("r2", new[, ] {
                { "C", "A" }, { "G", "A" }, { "T", "A" }
            });
            var vead3 = PhasedVariantTestUtilities.CreateVeadFromStringArray("r3", new[, ] {
                { "C", "A" }, { "G", "A" }, { "T", "A" }
            });
            var veads = new List <Vead> {
                vead, vead2, vead3
            };

            nbhd.ReferenceSequence = "CGT";

            var mockCluster = new Mock <ICluster>();

            mockCluster.Setup(c => c.CountsAtSites).Returns(new[] { 10, 3, 5 });
            var consensus = PhasedVariantTestUtilities.CreateVeadGroup(veads);

            mockCluster.Setup(c => c.GetConsensusSites()).Returns(consensus.SiteResults);
            mockCluster.Setup(c => c.GetVeadGroups()).Returns(new List <VeadGroup>()
            {
                consensus
            });
            nbhd.AddMnvsFromClusters(new List <ICluster>()
            {
                mockCluster.Object
            }, 20, 100);

            var allele = nbhd.CandidateVariants.First();

            Assert.Equal(6, allele.TotalCoverage);
            Assert.Equal(6, allele.AlleleSupport);
            Assert.Equal("CGT", allele.Reference);
            Assert.Equal("AAA", allele.Alternate);

            var depths = nbhd.DepthAtSites(new List <ICluster>()
            {
                mockCluster.Object
            });

            Assert.Equal(3, depths.Length);
            Assert.Equal(3, depths[0]);
            Assert.Equal(3, depths[1]);
            Assert.Equal(3, depths[2]);
        }