private PValueDetails CreateAPValueDetail(int nullIndex, string peptide, Dictionary <string, Set <Hla> > pidToHlaSetAll, Set <Hla> knownHlaSet, Set <Hla> bestHlaSetSoFar, Hla hla)
        {
            //Dictionary<string, Dictionary<string, double>> reactTableCustom;
            Dictionary <string, Set <Hla> > pidToHlaSetCustom =
                CreatePidToHlaSetCustom(pidToHlaSetAll, bestHlaSetSoFar, hla, knownHlaSet);
            //out pidToHlaSetCustom, out reactTableCustom);

            //!!!could cache both calls to FindBestParams
            double scoreBase;
            OptimizationParameterList baseParams = FindBestParams(peptide, bestHlaSetSoFar, Set <Hla> .GetInstance(), pidToHlaSetCustom, out scoreBase);

            double scoreWithOneMore;
            OptimizationParameterList withMoreMoreParams = FindBestParams(peptide, bestHlaSetSoFar.Union(hla), Set <Hla> .GetInstance(), pidToHlaSetCustom, out scoreWithOneMore);

            PValueDetails pValueDetails = PValueDetails.GetInstance(SelectionName, nullIndex, peptide, hla,
                                                                    scoreWithOneMore, scoreBase, knownHlaSet, bestHlaSetSoFar, withMoreMoreParams["leakProbability"].Value, withMoreMoreParams["link" + hla].Value, withMoreMoreParams);

            //Debug.Write(String.Format("{0}/{1}\t", hla, scoreWithOneMore));
            return(pValueDetails);
        }
Esempio n. 2
0
        internal override Dictionary <Hla, PValueDetails> CreateHlaToPValueDetails(int nullIndex, string peptide, Dictionary <string, Set <Hla> > pidToHlaSet, Set <Hla> candidateHlaSet, TextWriter writer)
        {
            Dictionary <string, double> pidToReactValue = ReactTableUnfiltered[peptide];
            Set <Hla> knownHlaSet = KnownTable(peptide);

            double scoreKnown;
            OptimizationParameterList knownParams = FindBestParams(peptide, Set <Hla> .GetInstance(), Set <Hla> .GetInstance(), pidToHlaSet, out scoreKnown);


            Dictionary <Hla, PValueDetails> hlaToPValueDetails = new Dictionary <Hla, PValueDetails>();

            foreach (Hla hla in candidateHlaSet.Subtract(knownHlaSet)) //!!!only look at hla's of patients with reactivity to this peptide (how effects nulls?)
            {
                double scoreWithOne;
                OptimizationParameterList withHlaParams = FindBestParams(peptide, Set <Hla> .GetInstance(hla), Set <Hla> .GetInstance(), pidToHlaSet, out scoreWithOne);
                PValueDetails             pValueDetails = PValueDetails.GetInstance(SelectionName, nullIndex, peptide, hla, scoreWithOne, scoreKnown, knownHlaSet, null, withHlaParams["leakProbability"].Value, withHlaParams["link" + hla].Value, withHlaParams);
                hlaToPValueDetails.Add(hla, pValueDetails);
                writer.WriteLine(pValueDetails);
                Debug.WriteLine(pValueDetails);
                writer.Flush();
            }
            return(hlaToPValueDetails);
        }