public static void BioQuickTestInternal(Quickscore <Hla, int> quickscore, string fileName, string header)
        {
            List <int> patientList = quickscore.EffectList();

            List <QmrJob <Hla, int> > jobList = new List <QmrJob <Hla, int> >();

            foreach (List <Dictionary <string, string> > tableByPeptide in HlaAssignmentParams.QuickScoreOptimalsGroupByPeptide(fileName, header))
            {
                Debug.Assert(tableByPeptide.Count > 0);                 // real assert
                string peptide = tableByPeptide[0]["peptide"];



                List <int> patientsWhoDoNotRespond;
                List <int> patientsWhoRespond;
                QmrAlgorithms.FindPatientsWhoRespondAndWhoDoNot(patientList, tableByPeptide, out patientsWhoRespond, out patientsWhoDoNotRespond);

                QmrJob <Hla, int> aQuickScoreJob = QmrJob <Hla, int> .GetInstance(peptide, patientsWhoRespond, patientsWhoDoNotRespond, quickscore);

                jobList.Add(aQuickScoreJob);
            }


            jobList.Sort(delegate(QmrJob <Hla, int> x, QmrJob <Hla, int> y) { return(x.PresentEffectCollection.Count.CompareTo(y.PresentEffectCollection.Count)); });
            foreach (QmrJob <Hla, int> job in jobList)
            {
                Debug.WriteLine(job);
            }


            foreach (QmrJob <Hla, int> job in jobList)
            {
                //if (job.Name != "RIRTWKSLVK")
                //{
                //    continue;
                //}
                Console.WriteLine(job);

                //job.Quickscore.Probability("B58", job.PresentEffectCollection, job.AbsentEffectCollection);

                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                Dictionary <Hla, double> posteriorOfEveryCause = job.PosteriorOfEveryCause();
                stopwatch.Stop();

                Console.WriteLine("{0}\t{1}\t{2}\t{3}", job.Name, job.PresentEffectCollection.Count, job.AbsentEffectCollection.Count, stopwatch.Elapsed);

                foreach (KeyValuePair <Hla, double> causeAndPosterior in posteriorOfEveryCause)
                {
                    Debug.Assert(0 <= causeAndPosterior.Value && causeAndPosterior.Value <= 1);
                    Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", job.Name, job.PresentEffectCollection.Count, job.AbsentEffectCollection.Count, stopwatch.Elapsed
                                      , causeAndPosterior.Key, causeAndPosterior.Value);
                }
            }
        }
Esempio n. 2
0
        GetInstance(string name, List <TEffect> presentEffectCollection,
                    List <TEffect> absentEffectCollection, Qmr <TCause, TEffect> qmr)
        {
            QmrJob <TCause, TEffect> aQmrJob = new QmrJob <TCause, TEffect>();

            aQmrJob.Name = name;
            aQmrJob.PresentEffectCollection = presentEffectCollection;
            aQmrJob.AbsentEffectCollection  = absentEffectCollection;
            aQmrJob.Qmr = qmr;
            return(aQmrJob);
        }