Exemple #1
0
        private static MixtureModelResult GetModelResult(CalledAllele allele, RecalibrationResult result)
        {
            var recal = new RecalibratedVariantsCollection();

            recal.AddLocus(allele);
            return(MixtureModel.UsePrefitModel(recal.Ad, recal.Dp, result.Means, result.Priors).PrimaryResult);
        }
        private static List <MixtureModel> ApplyModels(string vcfIn, string modelFile, List <RecalibratedVariantsCollection> variants)
        {
            List <MixtureModelParameters> modelParams = MixtureModel.ReadModelsFile(modelFile);
            var models = new List <MixtureModel>();

            Logger.WriteToLog("Applying models");
            for (int i = 0; i < variants.Count; i++)
            {
                models.Add(MixtureModel.UsePrefitModel(variants[i].Ad, variants[i].Dp, modelParams[i].Means, modelParams[i].Priors));
            }

            return(models);
        }
        public void RecalibratedVariantModelAndIndexerTests()
        {
            var modelsFile = Path.Combine(TestPaths.LocalTestDataDirectory, "example.model");
            List <MixtureModelParameters> models = MixtureModel.ReadModelsFile(modelsFile);

            var mm = MixtureModel.UsePrefitModel(RecalCollection.Ad, RecalCollection.Dp, models[0].Means, models[0].Priors);

            RecalCollection.AddMixtureModelResults(mm);

            Assert.Equal(14, RecalCollection.Categories.Count);
            Assert.Equal(14, RecalCollection.QScores.Count);

            RecalibratedVariant variant1 = RecalCollection["chr1:115252176"];

            Assert.Equal(SimplifiedDiploidGenotype.HeterozygousAltRef, variant1.MixtureModelResult.GenotypeCategory);
            RecalibratedVariant variant2 = RecalCollection["chr1:115252177"];

            Assert.Equal(SimplifiedDiploidGenotype.HomozygousAlt, variant2.MixtureModelResult.GenotypeCategory);
        }