override public void ThreadProc(Object stateInfo)
        {
            int i, j;

            i = (stateInfo as QAlInfo).i;
            j = (stateInfo as QAlInfo).j;
            QAlignment Align = new QAlignment(Peptides, Proteins, i, j);

            Align.Run();
            Align.Proteins.Sort(new ProteinPair.byIPI());
            Align.Peptides.Sort(new PeptidePair.bySet());
            //копирование итоговых значений в итоговые массивы
            for (int k = 0; k < Peptides.Count; k++)
            {
                PeptidePair PP = Align.Peptides[k];
                if (PP.Ratio == 0.0)
                {
                    PeptideRatios[i, j][k] = 0.0;
                }
                else
                {
                    PeptideRatios[i, j][k] = PP.Ratio;
                }
            }
            for (int k = 0; k < Proteins.Count; k++)
            {
                ProteinPair PP = Align.Proteins[k];
                ProteinMedians[i, j, k] = PP.Median;
                ProteinSlopes[i, j, k]  = PP.Slope;
                ProteinDeltas[i, j, k]  = PP.SlopeDelta;
            }
            lock (ForCountLock){
                Count++;
            }
        }
        public QAlignment(List <QPeptide> Peptides, List <QProtein> Proteins, int LeftIndex, int RightIndex)
        {
            Left          = LeftIndex;
            Right         = RightIndex;
            this.Peptides = new List <PeptidePair>();
            for (int i = 0; i < Peptides.Count; i++)
            {
                this.Peptides.Add(new PeptidePair(Peptides[i], Left, Right));
            }
            this.Proteins = new List <ProteinPair>();
            int j = 0;

            for (int i = 0; i < Proteins.Count; i++)
            {
                ProteinPair PPair = new ProteinPair();
                PPair.Protein = Proteins[i];
                while (Proteins[i].ipi == Peptides[j].IPI)
                {
                    if (Proteins[i] == this.Peptides[j].Peptide.PartOfProtein && this.Peptides[j].Exists)
                    {
                        PPair.Peptides.Add(this.Peptides[j]);
                    }
                    j++;
                    if (j >= Peptides.Count)
                    {
                        break;
                    }
                }
                this.Proteins.Add(PPair);
            }
        }
예제 #3
0
        public string GetString(int MatchNumber, int RefMatchNumber /* if no refs =-1 */)
        {
            ProteinPair Pair;

            if (Aligner != null)
            {
                Pair = Aligner.GetProtPair(this, MatchNumber, RefMatchNumber);
            }
            else
            {
                Pair = new ProteinPair();
                //чего можем то заполним
                for (int i = 0; i < Peptides.Count; i++)
                {
                    if (Peptides[i].Matches[MatchNumber] != null)
                    {
                        Pair.LeftScore += Peptides[i].Matches[MatchNumber].Score;
                        Pair.NCount++;
                    }
                }
                Pair.RightScore = Pair.LeftScore;
            }


            string Res =
                ((ReportString[0] != '1')?"":String.Format("\"{0}\"\t", ipi)) +
                ((ReportString[1] != '1')?"":String.Format("{0:f4}\t", Pair.LeftScore)) +
                ((ReportString[2] != '1')?"":String.Format("{0:f4}\t", Pair.RightScore)) +
                ((ReportString[3] != '1')?"":String.Format("\"{0}\"\t", Desc)) +
                ((ReportString[4] != '1')?"":(Utils.IPIListtoString(ipis)) + "\t") +
                ((ReportString[5] != '1')?"":String.Format("{0}\t", Peptides.Count)) +
                ((ReportString[6] != '1')?"":String.Format("{0}\t", Pair.NCount)) +
                ((ReportString[7] != '1')?"":String.Format("{0:f4}\t", Pair.RSquare)) +
                ((ReportString[8] != '1')?"":String.Format("{0:f4}\t", Pair.Slope)) +
                ((ReportString[9] != '1')?"":String.Format("{0:f4}\t", Pair.Median)) +
                ((ReportString[10] != '1')?"":String.Format("{0:f4}\t", Pair.PrAverage)) +
                ((ReportString[11] != '1')?"":String.Format("{0:f4}\t", Pair.MinInterval)) +
                ((ReportString[12] != '1')?"":String.Format("{0:f4}\t", Pair.MaxInterval)) +
                ((ReportString[13] != '1')?"":String.Format("{0:e4}", Pair.PValue));

            return(Res);
        }
 public QAlignment(List <QPeptide> Peptides, List <QProtein> Proteins, int LeftIndex, int RightIndex)
 {
     Left          = LeftIndex;
     Right         = RightIndex;
     this.Peptides = new List <PeptidePair>();
     for (int i = 0; i < Peptides.Count; i++)
     {
         this.Peptides.Add(new PeptidePair(Peptides[i], Left, Right));
     }
     this.Proteins = new List <ProteinPair>();
     for (int i = 0; i < Proteins.Count; i++)
     {
         ProteinPair PPair = new ProteinPair();
         PPair.Protein = Proteins[i];
         for (int j = 0; j < Peptides.Count; j++)
         {
             if (Proteins[i].Peptides.Contains(this.Peptides[j].Peptide) && this.Peptides[j].Exists)
             {
                 PPair.Peptides.Add(this.Peptides[j]);
             }
         }
         this.Proteins.Add(PPair);
     }
 }
예제 #5
0
        public string GetSheetString(int RefNumber)
        {
            ProteinPair Pair;

            if (Aligner != null)
            {
                Pair = Aligner.GetProtPair(this, RefNumber, RefNumber);
            }
            else
            {
                Pair            = new ProteinPair();
                Pair.RightScore = 0.0;
            }

            string Res =
                ((SheetReportString[0] != '1')?"":String.Format("{0}\t", ipi)) +
                ((SheetReportString[1] != '1')?"":String.Format("{0:f2}\t", Pair.RightScore)) +
                ((SheetReportString[2] != '1')?"":String.Format("{0}\t", Desc)) +
                ((SheetReportString[3] != '1')?"":(Utils.IPIListtoString(ipis)) + "\t") +
                ((SheetReportString[4] != '1')?"":String.Format("{0}\t", Peptides.Count));

            for (int i = 0; i < FileList.Count; i++)
            {
                if (Aligner != null)
                {
                    Pair = Aligner.GetProtPair(this, i, RefNumber);
                }
                else
                {
                    break;
                }
                Res = Res +
                      ((SheetReportString[5] != '1')?"":String.Format("{0:f5}\t", Pair.Median)) +
                      ((SheetReportString[6] != '1')?"":String.Format("{0:f5}\t", Pair.Slope)) +
                      ((SheetReportString[7] != '1')?"":String.Format("{0:f5}\t", Pair.PrAverage)) +
                      ((SheetReportString[8] != '1')?"":String.Format("{0:f5}\t", Pair.MinInterval)) +
                      ((SheetReportString[9] != '1')?"":String.Format("{0:f5}\t", Pair.MaxInterval)) +
                      ((SheetReportString[10] != '1')?"":String.Format("{0:f5}\t", Pair.RSquare));
            }

            double[] RawScores = new double[FileList.Count];
            if (SheetReportString[12] == '1' || SheetReportString[1] == '1')
            {
                for (int i = 0; i < FileList.Count; i++)
                {
                    for (int j = 0; j < Peptides.Count; j++)
                    {
                        if (Peptides[j].Matches[i] != null &&
                            Peptides[j].Matches[i].Score > 0.0)
                        {
                            if (RefNumber < 0 || Peptides[j].Matches[RefNumber] != null)
                            {
                                RawScores[i] += Peptides[j].Matches[i].Score;
                            }
                        }
                    }
                }
            }

            //ppm's
            if (SheetReportString[12] == '1')
            {
                Res += "\t";
                for (int i = 0; i < FileList.Count; i++)
                {
                    double PPM = (RawScores[i] / FileFactors[i]) * 1000000.0;
                    Res += String.Format("{0:f5}\t", PPM);
                }
            }

            //Raw values
            if (SheetReportString[13] == '1')
            {
                Res += "\t";
                for (int i = 0; i < FileList.Count; i++)
                {
                    Res += String.Format("{0:f5}\t", RawScores[i]);
                }
            }

            return(Res);
        }