Ejemplo n.º 1
0
        public static void Insilico_filter_U2(proteins prot, List <double> peakList, double tol)
        {
            double       l_score;
            double       r_score;
            double       score;
            bool         left;
            bool         right;
            insilico_obj comp;

            comp    = new insilico_obj();
            r_score = 0;
            l_score = 0;

            comp = prot.insilico_details;
            //comp.insilico_mass_right = frags.ElementAt(j).mw_right_ion;

            for (int k = 0; k < prot.insilico_details.insilico_mass_left.Count; k++)
            {
                left = false;
                for (int i = 0; i < peakList.Count; i++)
                {
                    if (Math.Abs(prot.insilico_details.insilico_mass_left[k] - peakList[i]) < tol)
                    {
                        l_score++;
                        comp.peaklist_mass_left.Add(peakList[i]);
                        left = true;
                    }
                }
                if (left == false)
                {
                    comp.peaklist_mass_left.Add(0);
                }
            }

            for (int k = 0; k < prot.insilico_details.insilico_mass_right.Count; k++)
            {
                right = false;

                for (int i = 0; i < peakList.Count; i++)
                {
                    if (Math.Abs(prot.insilico_details.insilico_mass_right[k] - peakList[i]) < tol)
                    {
                        comp.peaklist_mass_right.Add(peakList[i]);
                        r_score++;
                        right = true;
                    }
                }
                if (right == false)
                {
                    comp.peaklist_mass_right.Add(0);
                }
            }

            score = (l_score + r_score) / (peakList.Count);
            Console.WriteLine("Insilico score:");
            Console.WriteLine(score);

            prot.insilico_score   = score;
            prot.insilico_details = comp;
        }
Ejemplo n.º 2
0
        public static void Insilico_filter_U(List <proteins> prot, List <double> peakList, double tol)
        {
            List <double> xyz = new List <double>();

            double l_score;
            double r_score;
            double score;

            // bool right;
            insilico_obj comp;

            for (int j = 0; j < prot.Count; j++)
            {
                comp    = new insilico_obj();
                r_score = 0;
                l_score = 0;

                comp.insilico_mass_left  = prot[j].insilico_details.insilico_mass_left;  //frags.ElementAt(j).mw_left_ion;
                comp.insilico_mass_right = prot[j].insilico_details.insilico_mass_right; //frags.ElementAt(j).mw_right_ion;


                double[] m_arrayy = new double[comp.insilico_mass_right.Count];


                for (int mass_i = 0, peak_i = 0; mass_i < comp.insilico_mass_left.Count && peak_i < peakList.Count;)
                {
                    if ((comp.insilico_mass_left[mass_i] - peakList[peak_i]) <= (-1 * tol))
                    {
                        mass_i++;
                    }
                    else if ((comp.insilico_mass_left[mass_i] - peakList[peak_i]) >= (tol))
                    {
                        peak_i++;
                    }
                    else
                    {
                        l_score++;
                        // comp.peaklist_mass_left.Add(peakList[peak_i]);
                        m_arrayy[mass_i] = peakList[peak_i];
                        peak_i++;
                    }
                }
                comp.peaklist_mass_left = m_arrayy.ToList();

                m_arrayy = new double[comp.insilico_mass_right.Count];



                for (int mass_i = 0, peak_i = 0; mass_i < comp.insilico_mass_right.Count && peak_i < peakList.Count;)
                {
                    if ((comp.insilico_mass_right[mass_i] - peakList[peak_i]) <= (-1 * tol))
                    {
                        mass_i++;
                    }
                    else if ((comp.insilico_mass_right[mass_i] - peakList[peak_i]) >= (tol))
                    {
                        peak_i++;
                    }
                    else
                    {
                        r_score++;
                        //comp.peaklist_mass_right.Add(peakList[peak_i]);

                        m_arrayy[mass_i] = peakList[peak_i];


                        peak_i++;
                    }

                    if (mass_i == 24 || peak_i == 150)
                    {
                    }
                }


                comp.peaklist_mass_right = m_arrayy.ToList();


                ///////////////////////////////////////////////////
                // Changed Code


                //for (int k = 0; k < frags[j].mw_left_ion.Count; k++)
                //{



                //    for (int i = 0; i < peakList.Count; i++)
                //    {



                //        if (Math.Abs(frags[j].mw_left_ion[k] - peakList[i]) < tol)
                //        {
                //            l_score++;
                //            comp.peaklist_mass_left.Add(peakList[i]);
                //            left = true;
                //        }

                //    }



                //}


                //for (int k = 0; k < frags[j].mw_right_ion.Count; k++)
                //{


                //    for (int i = 0; i < peakList.Count; i++)
                //    {

                //        if (Math.Abs(frags[j].mw_right_ion[k] - peakList[i]) < tol)
                //        {
                //            comp.peaklist_mass_right.Add(peakList[i]);
                //            r_score++;

                //        }


                //    }



                //}


                score = (l_score + r_score) / (peakList.Count);
                //Console.WriteLine("Insilico score:");
                //Console.WriteLine(score);

                prot[j].insilico_score   = score;
                prot[j].insilico_details = comp;
            }
        }