public static QmrrModelAllPeptides GetInstance(ModelLikelihoodFactories modelLikelihoodFactories, string datasetName, OptimizationParameterList qmrrParamsStart, double depth, string hlaFactoryName)
        {
            QmrrModelAllPeptides aQmrrModelAllPeptides = new QmrrModelAllPeptides();

            aQmrrModelAllPeptides.QmrrPartialModelCollection  = QmrrPartialModelCollection.GetInstance(modelLikelihoodFactories, datasetName, qmrrParamsStart, hlaFactoryName);
            aQmrrModelAllPeptides.BestParamsAndHlaAssignments = BestParamsAndHlaAssignments.GetInstance(modelLikelihoodFactories, qmrrParamsStart, aQmrrModelAllPeptides.QmrrPartialModelCollection, depth);
            aQmrrModelAllPeptides.ModelLikelihoodFactories    = modelLikelihoodFactories;
            return(aQmrrModelAllPeptides);
        }
Ejemplo n.º 2
0
        internal void FindBestQmrrParams(QmrrPartialModelCollection qmrrPartialModelCollection)
        {
            SpecialFunctions.CheckCondition(false, "Regression test this to be sure that switch to new optimization method didn't change anything important - cmk 5/1/2006");

            QmrrlModelMissingParametersCollection aQmrrlModelMissingParametersCollection =
                QmrrlModelMissingParametersCollection.GetInstance(ModelLikelihoodFactories, qmrrPartialModelCollection, PeptideToBestHlaAssignmentSoFar);

            double score;
            OptimizationParameterList qmrrParamsEnd = aQmrrlModelMissingParametersCollection.FindBestParams(BestParamsSoFar.Champ, out score);

            BestParamsSoFar.Compare(score, qmrrParamsEnd);
        }
Ejemplo n.º 3
0
        static public QmrrPartialModelCollection GetInstance(ModelLikelihoodFactories modelLikelihoodFactories, string datasetName, OptimizationParameterList qmrrParams, string hlaFactoryName)
        {
            QmrrPartialModelCollection aQmrrPartialModelCollection = new QmrrPartialModelCollection();

            aQmrrPartialModelCollection.HlaFactory = Qmrr.HlaFactory.GetFactory(hlaFactoryName);

            aQmrrPartialModelCollection.OptimizationParameterList = qmrrParams;
            aQmrrPartialModelCollection.SetFileNames(datasetName);
            aQmrrPartialModelCollection.ReadTables();
            aQmrrPartialModelCollection.ModelLikelihoodFactories = modelLikelihoodFactories;
            aQmrrPartialModelCollection.CreateList();
            return(aQmrrPartialModelCollection);
        }
Ejemplo n.º 4
0
        private double FindBestHlaAssignmentSet(QmrrPartialModelCollection qmrrPartialModelCollection, double depth)
        {
            double sumScore = 0.0;

            PeptideToBestHlaAssignmentSoFar = new Dictionary <string, BestSoFar <double, TrueCollection> >();
            foreach (QmrrPartialModel qmrrPartialModel in qmrrPartialModelCollection)
            {
                QmmrModelOnePeptide aQmmrModelOnePeptide = QmmrModelOnePeptideGetInstance(qmrrPartialModel, BestParamsSoFar.Champ, depth);
                aQmmrModelOnePeptide.FindBestHlaAssignment();
                sumScore += aQmmrModelOnePeptide.BestHlaAssignmentSoFar.ChampsScore;
                PeptideToBestHlaAssignmentSoFar.Add(qmrrPartialModel.Peptide, aQmmrModelOnePeptide.BestHlaAssignmentSoFar);
            }

            return(sumScore);
        }
Ejemplo n.º 5
0
        public static QmrrPartialModelCollection GetInstance(string peptide,
                                                             ModelLikelihoodFactories modelLikelihoodFactories,
                                                             OptimizationParameterList qmrrParamsStart,
                                                             Dictionary <string, Set <Hla> > patientList,
                                                             Dictionary <string, Dictionary <string, double> > reactTable,
                                                             Dictionary <string, Set <Hla> > knownTable,
                                                             string hlaFactoryName
                                                             )
        {
            QmrrPartialModelCollection aQmrrPartialModelCollection = new QmrrPartialModelCollection();

            aQmrrPartialModelCollection.HlaFactory = Qmrr.HlaFactory.GetFactory(hlaFactoryName);
            aQmrrPartialModelCollection.OptimizationParameterList = qmrrParamsStart;
            aQmrrPartialModelCollection.SetFileNamesToNull();
            aQmrrPartialModelCollection.PeptideList = new List <string>(new string[] { peptide });
            aQmrrPartialModelCollection.PatientList = patientList;
            aQmrrPartialModelCollection.ReactTable  = reactTable;
            aQmrrPartialModelCollection._knownTable = knownTable;
            aQmrrPartialModelCollection.ModelLikelihoodFactories = modelLikelihoodFactories;
            aQmrrPartialModelCollection.CreateList();
            return(aQmrrPartialModelCollection);
        }
Ejemplo n.º 6
0
        private void SearchForBestParamsAndHlaAssignments(QmrrPartialModelCollection qmrrPartialModelCollection, double depth)
        {
            int    cStep = 100;
            double eps   = 1e-7;
            OptimizationParameterList oldQmrrParams = null;

            Debug.WriteLine(SpecialFunctions.CreateTabString("depth", "dataset", QmrrParamsStart.ToStringHeader(), "Step", "After", QmrrParamsStart.ToStringHeader(), "Score"));
            for (int iStep = 0; iStep < cStep && !(BestParamsSoFar.Champ.IsClose(oldQmrrParams, eps)); ++iStep)
            {
                oldQmrrParams = BestParamsSoFar.Champ.Clone();

                double hlaAssignmentSumScore = FindBestHlaAssignmentSet(qmrrPartialModelCollection, depth);

                Debug.WriteLine(SpecialFunctions.CreateTabString(depth, qmrrPartialModelCollection.DatasetName,
                                                                 QmrrParamsStart, iStep + 1, "AfterHla", BestParamsSoFar.Champ,
                                                                 hlaAssignmentSumScore));

                FindBestQmrrParams(qmrrPartialModelCollection);

                Debug.WriteLine(SpecialFunctions.CreateTabString(depth, qmrrPartialModelCollection.DatasetName,
                                                                 QmrrParamsStart, iStep + 1, "AfterParam", BestParamsSoFar.Champ, BestParamsSoFar.ChampsScore));
            }
        }
        public static QmrrlModelMissingParametersCollection GetInstance(ModelLikelihoodFactories modelLikelihoodFactories, QmrrPartialModelCollection qmrrPartialModelCollection, Dictionary <string, BestSoFar <double, TrueCollection> > PeptideToBestHlaAssignmentSoFar)
        {
            QmrrlModelMissingParametersCollection aQmrrlModelMissingParametersCollection = new QmrrlModelMissingParametersCollection();

            foreach (QmrrPartialModel qmrrPartialModel in qmrrPartialModelCollection)
            {
                QmrrlModelMissingParameters aQmrrlModelMissingParameters = QmrrlModelMissingParameters.GetInstance(modelLikelihoodFactories, qmrrPartialModel, PeptideToBestHlaAssignmentSoFar[qmrrPartialModel.Peptide]);
                aQmrrlModelMissingParametersCollection.Collection.Add(aQmrrlModelMissingParameters);
            }
            aQmrrlModelMissingParametersCollection.GridSearch = GridSearch.GetInstance("Grid");
            return(aQmrrlModelMissingParametersCollection);
        }
Ejemplo n.º 8
0
        //private BestParamsAndHlaAssignments(OptimizationParameterList qmrrParamsStart)
        //{
        //    QmrrParamsStart = qmrrParamsStart;
        //    CreateBestParamsSoFar();
        //    PeptideToBestHlaAssignmentSoFar = null;
        //}

        public static BestParamsAndHlaAssignments GetInstance(ModelLikelihoodFactories modelLikelihoodFactories, OptimizationParameterList qmrrParamsStart, QmrrPartialModelCollection qmrrPartialModelCollection, double depth)
        {
            BestParamsAndHlaAssignments aBestParamsAndHlaAssignments = new BestParamsAndHlaAssignments();

            aBestParamsAndHlaAssignments.QmrrParamsStart = qmrrParamsStart;
            aBestParamsAndHlaAssignments.CreateBestParamsSoFar();
            aBestParamsAndHlaAssignments.ModelLikelihoodFactories = modelLikelihoodFactories;
            aBestParamsAndHlaAssignments.SearchForBestParamsAndHlaAssignments(qmrrPartialModelCollection, depth);
            return(aBestParamsAndHlaAssignments);
        }