示例#1
0
        // find matches using the background proteome
        public void UseBackgroundProteome()
        {
            if (_parent.Document.Settings.PeptideSettings.BackgroundProteome.Equals(BackgroundProteome.NONE))
            {
                MessageDlg.Show(this, Resources.AssociateProteinsDlg_UseBackgroundProteome_No_background_proteome_defined);
                return;
            }
            _isFasta  = false;
            _fileName = _parent.Document.Settings.PeptideSettings.BackgroundProteome.DatabasePath;
            checkBoxListMatches.Items.Clear();
            BackgroundProteome proteome = _parent.Document.Settings.PeptideSettings.BackgroundProteome;
            var proteinAssociations     = new List <KeyValuePair <FastaSequence, List <PeptideDocNode> > >();
            var peptidesForMatching     = ListPeptidesForMatching();

            IDictionary <String, List <Protein> > proteinsWithSequences = null;

            using (var longWaitDlg = new LongWaitDlg())
            {
                longWaitDlg.PerformWork(this, 1000, longWaitBroker =>
                {
                    using (var proteomeDb = proteome.OpenProteomeDb(longWaitBroker.CancellationToken))
                    {
                        proteinsWithSequences = proteomeDb.GetDigestion()
                                                .GetProteinsWithSequences(peptidesForMatching.Select(pep => pep.Peptide.Target.Sequence));
                    }
                });
            }
            if (proteinsWithSequences == null)
            {
                return;
            }
            HashSet <String> processedProteinSequence = new HashSet <string>();

            foreach (var entry in proteinsWithSequences)
            {
                foreach (var protein in entry.Value)
                {
                    if (!processedProteinSequence.Add(protein.Sequence))
                    {
                        continue;
                    }
                    var matches = peptidesForMatching.Where(pep => protein.Sequence.Contains(pep.Peptide.Target.Sequence)).ToList();
                    if (matches.Count == 0)
                    {
                        continue;
                    }
                    FastaSequence fastaSequence = proteome.MakeFastaSequence(protein);
                    if (fastaSequence != null)
                    {
                        proteinAssociations.Add(new KeyValuePair <FastaSequence, List <PeptideDocNode> >(fastaSequence, matches));
                    }
                }
            }
            SetCheckBoxListItems(proteinAssociations,
                                 Resources.AssociateProteinsDlg_UseBackgroundProteome_No_matches_were_found_using_the_background_proteome_);
        }
示例#2
0
 public void SetBackgroundProteome(BackgroundProteome backgroundProteome)
 {
     _backgroundProteome = backgroundProteome;
 }