Example #1
0
        public void ProcessParsedData(bool considerOnlyUnique)
        {
            //If we wish to eliminate decoy proteins
            if (MyParameters.EliminateDecoys)
            {
                foreach (ResultEntry re in MyResultPackages)
                {
                    re.MyResultPackage.MyProteins.RemoveDecoyProteins(MyParameters.DecoyTag);
                }
            }

            List <string> globalPeptideList = (from re in MyResultPackages
                                               from p in re.MyResultPackage.AllPeptideSequences
                                               select p).Distinct().ToList();

            foreach (string p in globalPeptideList)
            {
                List <List <string> > mappableProteins = (from re in MyResultPackages.AsParallel()
                                                          from pepR in re.MyResultPackage.MyProteins.MyPeptideList
                                                          where pepR.CleanedPeptideSequence == p
                                                          select pepR.MyMapableProteins).ToList();

                List <string> uniqueList = new List <string>(mappableProteins.Count);

                foreach (List <string> list in mappableProteins)
                {
                    uniqueList.AddRange(list);
                }
                uniqueList = uniqueList.Distinct().ToList();

                GlobalPeptideResult gpp = new GlobalPeptideResult();
                gpp.Sequence         = p;
                gpp.MappableProteins = uniqueList;

                globalPeptideIndex.Add(gpp);
            }

            if (MyParameters.PeptideParserOnlyUniquePeptides)
            {
                globalPeptideIndex.RemoveAll(a => a.MappableProteins.Count > 1);
            }
        }
Example #2
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--;
            //    }
            //}
        }