Ejemplo n.º 1
0
        public override void LoadChildren()
        {
            if (m_loaded)
            {
                return;
            }

            var peptides = m_parentCluster.FindPeptides();

            if (peptides.Count < 1)
            {
                return;
            }

            // Tally up the unique peptides
            var uniqueCounts = new Dictionary <string, List <Peptide> >();

            foreach (var peptide in peptides)
            {
                if (!uniqueCounts.ContainsKey(peptide.Sequence))
                {
                    uniqueCounts.Add(peptide.Sequence, new List <Peptide>());
                }
                uniqueCounts[peptide.Sequence].Add(peptide);
            }
            // Show that to the user
            AddStatistic("Unique Identifications", uniqueCounts.Count);
            AddStatistic("Total Identifications", peptides.Count);


            foreach (var sequence in uniqueCounts.Keys)
            {
                // Create a collection for each unique sequence
                var model = new GenericCollectionTreeViewModel();
                model.Name = sequence;
                model.AddStatistic("Total Members", uniqueCounts[sequence].Count);

                foreach (var p in uniqueCounts[sequence])
                {
                    var peptideModel = new PeptideTreeViewModel(p);
                    peptideModel.FeatureSelected += peptideModel_FeatureSelected;
                    model.Items.Add(peptideModel);
                }


                m_items.Add(model);
            }


            m_loaded = true;
        }
        public override void LoadChildren()
        {
            if (m_loaded)
                return;

            var peptides = m_parentCluster.FindPeptides();

            if (peptides.Count < 1)
                return;

            // Tally up the unique peptides
            var uniqueCounts = new Dictionary<string, List<Peptide>>();
            foreach (var peptide in peptides)
            {
                if (!uniqueCounts.ContainsKey(peptide.Sequence))
                {
                    uniqueCounts.Add(peptide.Sequence, new List<Peptide>());
                }
                uniqueCounts[peptide.Sequence].Add(peptide);
            }
            // Show that to the user
            AddStatistic("Unique Identifications", uniqueCounts.Count);
            AddStatistic("Total Identifications", peptides.Count);

            foreach (var sequence in uniqueCounts.Keys)
            {
                // Create a collection for each unique sequence
                var model = new GenericCollectionTreeViewModel();
                model.Name = sequence;
                model.AddStatistic("Total Members", uniqueCounts[sequence].Count);

                foreach (var p in uniqueCounts[sequence])
                {
                    var peptideModel = new PeptideTreeViewModel(p);
                    peptideModel.FeatureSelected += peptideModel_FeatureSelected;
                    model.Items.Add(peptideModel);
                }

                m_items.Add(model);
            }

            m_loaded = true;
        }