Example #1
0
        private PeptideMatchesData AnalyzeClusters(List <UMCClusterLight> clusters)
        {
            var peptides = new Dictionary <string, List <Peptide> >();

            foreach (var cluster in clusters)
            {
                var clusterPeptides = ExtractPeptides(cluster.Features);
                foreach (var peptide in clusterPeptides)
                {
                    if (!peptides.ContainsKey(peptide.Sequence))
                    {
                        peptides.Add(peptide.Sequence, new List <Peptide>());
                    }
                    peptides[peptide.Sequence].Add(peptide);
                }
            }

            // analyze now...
            var matches = new PeptideMatchesData();

            foreach (var sequence in peptides.Keys)
            {
                var map = new Dictionary <int, int>();
                foreach (var peptide in peptides[sequence])
                {
                    var parent = peptide.GetParentUmc();
                    if (parent != null)
                    {
                        if (parent.UmcCluster != null)
                        {
                            var id = parent.UmcCluster.Id;
                            if (!map.ContainsKey(id))
                            {
                                map.Add(id, 0);
                            }
                            map[id]++;
                        }
                    }
                }

                if (map.Count > 1)
                {
                    matches.DifferentCluster++;
                }
                else
                {
                    matches.SameCluster++;
                }
            }
            return(matches);
        }
        private PeptideMatchesData AnalyzeClusters(List<UMCClusterLight> clusters)
        {
            var peptides = new Dictionary<string, List<Peptide>>();
            foreach (var cluster in clusters)
            {
                var clusterPeptides = ExtractPeptides(cluster.Features);
                foreach (var peptide in clusterPeptides)
                {
                    if (!peptides.ContainsKey(peptide.Sequence))
                    {
                        peptides.Add(peptide.Sequence, new List<Peptide>());
                    }
                    peptides[peptide.Sequence].Add(peptide);
                }
            }

            // analyze now...
            var matches = new PeptideMatchesData();

            foreach (var sequence in peptides.Keys)
            {
                var map = new Dictionary<int, int>();
                foreach (var peptide in peptides[sequence])
                {
                    var parent = peptide.GetParentUmc();
                    if (parent != null)
                    {
                        if (parent.UmcCluster != null)
                        {
                            var id = parent.UmcCluster.Id;
                            if (!map.ContainsKey(id))
                            {
                                map.Add(id, 0);
                            }
                            map[id]++;
                        }
                    }
                }

                if (map.Count > 1)
                    matches.DifferentCluster++;
                else
                    matches.SameCluster++;
            }
            return matches;
        }