Example #1
0
        private static void CalcFdr(string[] rawFiles, string decoyPrefix, MascotQueryType type, IProteinSet proteinSet, bool debug,
                                    IIdentificationProvider ip)
        {
            List <bool>   correct = new List <bool>();
            List <double> scores  = new List <double>();
            List <double> seqLen  = new List <double>();

            for (int i = 0; i < rawFiles.Length; i++)
            {
                Identifications ident = ip.GetIdentifications(rawFiles[i], type);
                int             n     = ident.Count;
                for (int j = 0; j < n; j++)
                {
                    bool   c = ident.IsHighestScoringCorrect(j, decoyPrefix, proteinSet);
                    double s = ident.GetHighestAltScore(j);
                    double l = Math.Log(ident.GetBestSequence(j).Length);
                    if (!double.IsNaN(s) && !double.IsInfinity(s))
                    {
                        correct.Add(c);
                        scores.Add(s);
                        seqLen.Add(l);
                    }
                }
                ip.Dispose();
                if (correct.Count > 10000000)
                {
                    break;
                }
            }
            if (correct.Count == 0)
            {
                return;
            }
            bool write             = debug && (type == MascotQueryType.Silac);
            BayesianInversion2D bi = new BayesianInversion2D(scores.ToArray(), seqLen.ToArray(), correct.ToArray(), write);

            if (write)
            {
                Write(rawFiles, bi);
            }
            for (int i = 0; i < rawFiles.Length; i++)
            {
                SetPep(ip.GetIdentifications(rawFiles[i], type), bi);
                ip.Dispose();
            }
        }