Esempio n. 1
0
        /// <summary>
        /// This eliminates decoys and builds the index
        /// </summary>
        public void ProcessParsedData()
        {
            //Generate a SEPro Fusion---------------------
            ResultPackage seprofusion = FusionSEPro(MyResultPackages.Select(a => a.MyResultPackage).ToList());

            ///-------------------------------------------

            //If we wish to eliminate decoy proteins
            if (MyParameters.EliminateDecoys)
            {
                seprofusion.MyProteins.RemoveDecoyProteins(MyParameters.DecoyTag);
            }

            //we do this in two steps... first we build the index, then, we build the sparse matrix rows

            List <MyProtein> myProteins = seprofusion.MyProteins.MyProteinList;

            if (UseMaxParsimony)
            {
                myProteins = seprofusion.MaxParsimonyList();
            }

            List <TMPProt> result = (from prot in myProteins
                                     select new TMPProt(prot.Locus, prot.Description, prot.ContainsUniquePeptide)).ToList();


            //If we only want proteins of unique peptides
            if (MyParameters.MyProteinType == ProteinOutputType.SpecCountsOfUniquePeptides)
            {
                result = (from r in result
                          where r.UniquePeptides > 0
                          select r).ToList();
            }



            theIndex = new List <ProteinIndexStruct>(result.Count());


            for (int i = 0; i < result.Count; i++)
            {
                ProteinIndexStruct p = new ProteinIndexStruct();
                p.Locus       = result[i].Locus;
                p.Description = result[i].Description;
                p.Index       = i;

                if (!theIndex.Exists(a => a.Locus.Equals(result[i].Locus)))
                {
                    theIndex.Add(p);
                }
                else
                {
                    throw new Exception("Problems generating SEPro fusion file");
                }
            }

            //int counter = 0;
            //foreach (TMPProt r in result)
            //{
            //    counter++;
            //    ProteinIndexStruct p = new ProteinIndexStruct();
            //    p.Locus = r.Locus;
            //    p.Description = r.Description;
            //    p.Index = counter;

            //    if (!theIndex.Exists(a => a.Locus.Equals(r.Locus)))
            //    {
            //        theIndex.Add(p);
            //    }
            //    else
            //    {
            //        counter--;
            //    }
            //}
        }