Example #1
0
        static void Main(string[] args)
        {
            Peptide peptideList = new Peptide();

            List<string> peptideSeqList = new List<string>();
            string file = "C:\\Users\\Dong\\Desktop\\test.pep.list";
            TextReader tr = new StreamReader(file);
            string line;
            while ((line = tr.ReadLine()) != null)
            {
                string peptide;
                if (line.Contains("."))
                {
                    string[] strs = line.Split('.');
                    peptide = strs[1];
                }
                else
                    peptide = line;
                peptideSeqList.Add(peptide);
            }

            //remove duplicates of the peptides
            //make it a unique list
            peptideSeqList = removeDuplicate(peptideSeqList);
            //generate the peptide list
            //by putting the peptide
            foreach (var pep in peptideSeqList)
            { 
                //something wrong here!!!
                peptideList.Add(1, "");
            }

            //Pep2Pro pp = new Pep2Pro();
            string database = "C:\\Users\\Dong\\Desktop\\yates.fasta";
            ProteomeDataFile foo = new ProteomeDataFile(database);
            pwiz.CLI.proteome.ProteinList proteinList = foo.proteinList;
            List<Protein> finalProteinList = new List<Protein>();
            
            
            for (int i = 0; i < proteinList.size(); i++)
            {
                Protein protein = proteinList.protein(i, true);
                if (!protein.id.Contains("Reverse"))
                {
                    string sequence = protein.sequence;
                    //Console.WriteLine(protein.index);
                    foreach (var pep in peptideSeqList)
                    {
                        if (sequence.Contains(pep) && !finalProteinList.Contains(protein))
                        {
                            finalProteinList.Add(protein);
                        }
                    }
                    
                }
            }

            //test
            //results: got a protein list which corresponding all peptides
            //the "finalProteinList" is ready for filters. 
            //Console.WriteLine(proteinList.size());
            //Console.WriteLine(finalProteinList.Count);


            //filter by minDistinctPeptides

            //filter by filterByDistinctPeptides

            //filterByMinimumCoveringSet

            //done it!
        }