Пример #1
0
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            mapEd = new Map ();
            drawMapSeg = new DrawMapSegment (mapEd.SegmentDefinitions, 500, 30, 50, 30, 40);
            segIndex = -1;
            mapSegIndex = -1;
            currentLayer = 0f;
            layer = new string[]{ "back", "mid", "front" };
            selectType = new string[]{"col","select" };
            layerName = layer[0];
            selectName = selectType [1];

            mouseClick = false;
            dropSegment = false;
            holdSegment = false;
            mouseDrag = false;

            drawType = DrawingMode.SegmentSelection;
            //Components.Add (new CollisionRectangle (this));

            base.Initialize ();
        }
Пример #2
0
        public static void CreateTestData (NHibernate.ISession session, IList<SpectrumTuple> testPsmSummary)
        {
            var dbGroups = new Map<string, SpectrumSourceGroup>();
            foreach (var ssg in session.Query<SpectrumSourceGroup>())
                dbGroups[ssg.Name] = ssg;

            var dbSources = new Map<long, SpectrumSource>();
            foreach (var ss in session.Query<SpectrumSource>())
                dbSources[ss.Id.Value] = ss;

            var dbAnalyses = new Map<long, Analysis>();
            foreach (var a in session.Query<Analysis>())
                dbAnalyses[a.Id.Value] = a;

            var dbPeptides = new Map<string, Peptide>();
            foreach (var pep in session.Query<Peptide>())
                dbPeptides[pep.Sequence] = pep;

            var bulkInserter = new BulkInserter(session.Connection);

            long lastPsmId = session.CreateQuery("SELECT MAX(Id) FROM PeptideSpectrumMatch").UniqueResult<long?>().GetValueOrDefault();
            long lastModId = session.CreateQuery("SELECT MAX(Id) FROM Modification").UniqueResult<long?>().GetValueOrDefault();
            long lastPmId = session.CreateQuery("SELECT MAX(Id) FROM PeptideModification").UniqueResult<long?>().GetValueOrDefault();
            long lastGroupId = session.CreateQuery("SELECT MAX(Id) FROM SpectrumSourceGroup").UniqueResult<long?>().GetValueOrDefault();
            long lastSourceId = session.CreateQuery("SELECT MAX(Id) FROM SpectrumSource").UniqueResult<long?>().GetValueOrDefault();
            long lastSglId = session.CreateQuery("SELECT MAX(Id) FROM SpectrumSourceGroupLink").UniqueResult<long?>().GetValueOrDefault();

            foreach (SpectrumTuple row in testPsmSummary)
            {
                string groupName = row.Group;
                string sourceName = "Source " + row.Source;
                string analysisId = "Engine " + row.Analysis;
                string peptideTuples = row.PeptideTuples;

                SpectrumSourceGroup group = dbGroups[groupName];
                if (String.IsNullOrEmpty(group.Name))
                {
                    group.Id = ++lastGroupId;
                    group.Name = groupName;
                    bulkInserter.Add(group);
                }

                SpectrumSource source = dbSources[row.Source];
                if (String.IsNullOrEmpty(source.Name))
                {
                    source.Id = ++lastSourceId;
                    source.Name = sourceName;
                    source.Group = group;
                    source.Spectra = new List<Spectrum>();
                    bulkInserter.Add(source);

                    // add a source group link for the source's immediate group
                    bulkInserter.Add(new SpectrumSourceGroupLink() { Id = ++lastSglId, Group = group, Source = source });

                    #region add source group links for all of the immediate group's parent groups

                    if (groupName != "/")
                    {
                        string parentGroupName = groupName.Substring(0, groupName.LastIndexOf("/"));
                        while (true)
                        {
                            if (String.IsNullOrEmpty(parentGroupName))
                                parentGroupName = "/";

                            // add the parent group if it doesn't exist yet
                            SpectrumSourceGroup parentGroup = session.UniqueResult<SpectrumSourceGroup>(o => o.Name == parentGroupName);
                            if (parentGroup == null)
                            {
                                parentGroup = new SpectrumSourceGroup() { Id = ++lastGroupId, Name = parentGroupName };
                                bulkInserter.Add(parentGroup);
                            }

                            bulkInserter.Add(new SpectrumSourceGroupLink() { Id = ++lastSglId, Group = parentGroup, Source = source });

                            if (parentGroupName == "/")
                                break;
                            parentGroupName = parentGroupName.Substring(0, parentGroupName.LastIndexOf("/"));
                        }
                    }

                    #endregion
                }

                Spectrum spectrum = source.Spectra.SingleOrDefault(o => o.Source.Id == source.Id &&
                                                                        o.Index == row.Spectrum - 1);
                if (spectrum == null)
                {
                    spectrum = new Spectrum()
                                   {
                                       Id = source.Id * 10000 + row.Spectrum,
                                       Index = row.Spectrum - 1,
                                       NativeID = "scan=" + row.Spectrum,
                                       Source = source,
                                       PrecursorMZ = 42
                                   };
                    source.Spectra.Add(spectrum);
                    bulkInserter.Add(spectrum);
                }

                Analysis analysis = dbAnalyses[row.Analysis];
                if (String.IsNullOrEmpty(analysis.Name))
                {
                    analysis.Id = dbAnalyses.Max(o => o.Value.Id).GetValueOrDefault() + 1;
                    analysis.Name = analysisId + " 1.0";
                    analysis.Software = new AnalysisSoftware() {Name = analysisId, Version = "1.0"};
                    analysis.StartTime = DateTime.Today.AddHours(row.Analysis);
                    analysis.Type = AnalysisType.DatabaseSearch;

                    analysis.Parameters = new SortedSet<AnalysisParameter>()
                    {
                        new AnalysisParameter()
                        {
                            Id = analysis.Id * 10000,
                            Analysis = analysis,
                            Name = "Parameter 1",
                            Value = "Value 1"
                        }
                    };

                    bulkInserter.Add(analysis);
                }

                // make sure peptides are sorted by their score divider (which will determine rank)
                var peptideList = new SortedList<int, List<PeptideTuple>>();
                foreach (string tuple in peptideTuples.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
                {
                    var peptideTuple = new PeptideTuple()
                                           {
                                               Sequence = tuple.Split('@', '/')[0],
                                               Charge = Convert.ToInt32(tuple.Split('@', '/')[1]),
                                               ScoreDivider = Convert.ToInt32(tuple.Split('@', '/')[2])
                                           };
                    if (!peptideList.ContainsKey(peptideTuple.ScoreDivider))
                        peptideList[peptideTuple.ScoreDivider] = new List<PeptideTuple>();
                    peptideList[peptideTuple.ScoreDivider].Add(peptideTuple);
                }

                int rank = 1;
                int lastDivider = 1;
                foreach (var peptideTupleList in peptideList.Values)
                    foreach (var peptideTuple in peptideTupleList)
                    {
                        using (PwizPeptide pwizPeptide = new PwizPeptide(peptideTuple.Sequence, ModParsing.ModificationParsing_Auto, ModDelimiter.ModificationDelimiter_Brackets))
                        {
                            Peptide peptide = dbPeptides[pwizPeptide.sequence];
                            if (String.IsNullOrEmpty(peptide.Sequence))
                            {
                                peptide = new TestPeptide(pwizPeptide.sequence);
                                peptide.Id = dbPeptides.Max(o => o.Value.Id).GetValueOrDefault() + 1;
                                peptide.MonoisotopicMass = pwizPeptide.monoisotopicMass(false);
                                peptide.MolecularWeight = pwizPeptide.molecularWeight(false);
                                dbPeptides[pwizPeptide.sequence] = peptide;
                                bulkInserter.Add(peptide);
                                createTestPeptideInstances(session, bulkInserter, peptide);
                            }

                            double neutralPrecursorMass = (spectrum.PrecursorMZ*peptideTuple.Charge) - (peptideTuple.Charge*Proton.Mass);

                            var psm = new PeptideSpectrumMatch()
                                          {
                                              Id = ++lastPsmId,
                                              Peptide = peptide,
                                              Spectrum = spectrum,
                                              Analysis = analysis,
                                              ObservedNeutralMass = neutralPrecursorMass,
                                              MonoisotopicMassError = neutralPrecursorMass - pwizPeptide.monoisotopicMass(),
                                              MolecularWeightError = neutralPrecursorMass - pwizPeptide.molecularWeight(),
                                              Charge = peptideTuple.Charge,
                                              Rank = (peptideTuple.ScoreDivider == lastDivider ? rank : ++rank),
                                              QValue = (rank == 1 ? row.QValue : PeptideSpectrumMatch.DefaultQValue),
                                          };

                            if (row.Score != null)
                                psm.Scores = new Dictionary<string, double>()
                                                 {
                                                     {"score1", (double) row.Score/peptideTuple.ScoreDivider},
                                                     {"score2", 1/((double) row.Score/peptideTuple.ScoreDivider)}
                                                 };

                            bulkInserter.Add(psm);
                            lastDivider = peptideTuple.ScoreDivider;

                            // add PeptideModifications and Modifications
                            foreach (KeyValuePair<int, ModList> itr in pwizPeptide.modifications())
                            {
                                foreach (PwizMod pwizMod in itr.Value)
                                {
                                    Modification mod = session.UniqueResult<Modification>(o => o.Formula == pwizMod.formula());
                                    if (mod == null)
                                    {
                                        mod = new Modification()
                                                  {
                                                      Id = ++lastModId,
                                                      Formula = pwizMod.formula(),
                                                      MonoMassDelta = pwizMod.monoisotopicDeltaMass(),
                                                      AvgMassDelta = pwizMod.averageDeltaMass(),
                                                      Name = pwizMod.formula()
                                                  };
                                        bulkInserter.Add(mod);
                                    }

                                    bulkInserter.Add(new PeptideModification()
                                                         {
                                                             Id = ++lastPmId,
                                                             PeptideSpectrumMatch = psm,
                                                             Modification = mod,
                                                             Offset = itr.Key == ModMap.NTerminus() ? int.MinValue
                                                                    : itr.Key == ModMap.CTerminus() ? int.MaxValue
                                                                    : itr.Key
                                                         });
                                }
                            }
                        }
                    }
            }
            bulkInserter.Execute();
            bulkInserter.Reset("");
        }
Пример #3
0
 public void Init()
 {
     map = new Map ();
     map.AddSeg (1f, 1, 45, 45);
     pallet =new DrawMapSegment (map.SegmentDefinitions, 500, 30, 50, 30, 40);
 }
Пример #4
0
        public void TestAdditionalPeptides ()
        {
            // each protein in the test scenarios is created from simple repeating motifs
            var testProteinSequences = new string[]
            {
                createSimpleProteinSequence("A", 20), // PRO1

                createSimpleProteinSequence("B", 20),

                createSimpleProteinSequence("C", 20),

                createSimpleProteinSequence("D", 20),

                createSimpleProteinSequence("E", 20), // PRO5
                createSimpleProteinSequence("E", 21),

                createSimpleProteinSequence("F", 20),
                createSimpleProteinSequence("F", 21),

                createSimpleProteinSequence("G", 20),
                createSimpleProteinSequence("G", 21), // PRO10
                
                createSimpleProteinSequence("H", 20),
                createSimpleProteinSequence("H", 21),
                
                createSimpleProteinSequence("AAAABBBBCCCC", 24),
                createSimpleProteinSequence("AAAABBBB", 24),
                createSimpleProteinSequence("BBBBCCCC", 24), // PRO15
                
                createSimpleProteinSequence("DDDDEEEEFFFF", 24),
                createSimpleProteinSequence("DDDDEEEE", 24),
                createSimpleProteinSequence("DDDDEEEE", 16),

                createSimpleProteinSequence("GGGGHHHHIIII", 24),
                createSimpleProteinSequence("GGGGHHHHIIII", 36), // PRO20
                createSimpleProteinSequence("GGGGHHHH", 24),
                createSimpleProteinSequence("HHHHIIII", 24),
                
                createSimpleProteinSequence("KKKKLLLLMMMM", 24),
                createSimpleProteinSequence("KKKKLLLLMMMM", 36),
                createSimpleProteinSequence("LLLLMMMM", 24), // PRO25
                createSimpleProteinSequence("LLLLMMMM", 16),
                
                createSimpleProteinSequence("NNNNPPPPQQQQ", 24),
                createSimpleProteinSequence("PPPPQQQQRRRR", 24),
                
                createSimpleProteinSequence("SSSSTTTTUUUU", 24),
                createSimpleProteinSequence("TTTTUUUUVVVV", 24), // PRO30
                createSimpleProteinSequence("TTTTUUUUVVVV", 36),
                
                createSimpleProteinSequence("WWWWYYYYZZZZ", 24),
                createSimpleProteinSequence("WWWWYYYYZZZZ", 36),
                createSimpleProteinSequence("YYYYZZZZFFFF", 24),
                
                createSimpleProteinSequence("AAAACCCCEEEE", 24), // PRO35
                createSimpleProteinSequence("AAAACCCCEEEE", 36),
                createSimpleProteinSequence("CCCCEEEEGGGG", 24),
                createSimpleProteinSequence("CCCCEEEEGGGG", 36),

                createSimpleProteinSequence("BBBBBDDDDD", 20),
                createSimpleProteinSequence("BBBBDDDD", 24), // PRO40
                createSimpleProteinSequence("ZBBBBDDD", 24),
                createSimpleProteinSequence("YBBBDDD", 20),
                createSimpleProteinSequence("WBBDD", 21),

                createSimpleProteinSequence("DDDDDFFFFF", 20),
                createSimpleProteinSequence("FFFFFHHHHH", 20), // PRO45

                createSimpleProteinSequence("HHHHHKKKKK", 20),
                createSimpleProteinSequence("HHHHHKKKKK", 30),
                createSimpleProteinSequence("KKKKKMMMMM", 20),

                createSimpleProteinSequence("LLLLLNNNNN", 20),
                createSimpleProteinSequence("NNNNNQQQQQ", 20), // PRO50
                createSimpleProteinSequence("NNNNNQQQQQ", 30),

                createSimpleProteinSequence("MMMMMPPPPP", 20),
                createSimpleProteinSequence("PPPPPRRRRR", 20),
                createSimpleProteinSequence("PPPPPRRRR", 24),

                createSimpleProteinSequence("QQQQSSSSUUUU", 24), // PRO55
                createSimpleProteinSequence("SSSSUUUUYYYY", 24),

                createSimpleProteinSequence("RRRRTTTTWWWWZZZZ", 32),
                createSimpleProteinSequence("TTTTWWWWZZZZBBBB", 32),
                createSimpleProteinSequence("RRRRTTTTZZZZBBBBTTTTWWWW", 24),

                createSimpleProteinSequence("AAAADDDDGGGGKKKK", 32), // PRO60
                createSimpleProteinSequence("DDDDGGGGKKKKNNNN", 32),
                createSimpleProteinSequence("AAAADDDDKKKKNNNN", 32),

                createSimpleProteinSequence("BBBBEEEEHHHH", 24),
                createSimpleProteinSequence("EEEEHHHHLLLL", 24),
                createSimpleProteinSequence("HHHHLLLLPPPP", 24), // PRO65

                createSimpleProteinSequence("CCCCFFFFIIII", 24),
                createSimpleProteinSequence("FFFFIIIIMMMM", 24),
                createSimpleProteinSequence("IIIIMMMMQQQQ", 24),

                createSimpleProteinSequence("NNNNRRRRUUUU", 24),
                createSimpleProteinSequence("RRRRUUUUZZZZ", 24), // PRO70
                createSimpleProteinSequence("UUUUZZZZCCCC", 24),
            };

            string idpDbName = System.Reflection.MethodInfo.GetCurrentMethod().Name + ".idpDB";
            File.Delete(idpDbName);
            sessionFactory = SessionFactoryFactory.CreateSessionFactory(idpDbName, new SessionFactoryConfig { CreateSchema = true });
            var session = sessionFactory.OpenSession();

            TestModel.CreateTestProteins(session, testProteinSequences);

            const int analysisCount = 2;
            const int sourceCount = 1;
            const int chargeCount = 2;

            for (int analysis = 1; analysis <= analysisCount; ++analysis)
            for (int source = 1; source <= sourceCount; ++source)
            for (int charge = 1; charge <= chargeCount; ++charge)
            {
                int scan = 0;

                List<SpectrumTuple> testPsmSummary = new List<SpectrumTuple>()
                {
                    // Columns:     Group  Source Spectrum Analysis Score Q List of Peptide@Charge/ScoreDivider
                    
                    // 1 protein (PRO1) to 1 peptide to 1 spectrum = 1 additional peptide
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("AAAAAAAAAA@{0}/1 BBBBBBBBBB@{0}/8", charge)),

                    // 1 protein (PRO2) to 1 peptide to 2 spectra = 1 additional peptide
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("BBBBBBBBBB@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("BBBBBBBBBB@{0}/1 CCCCCCCCCC@{0}/8", charge)),

                    // 1 protein (PRO3) to 2 peptides to 1 spectrum (each) = 2 additional peptides
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("CCCCCCCCCC@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("CCCCCCCCC@{0}/1  BBBBBBBBBB@{0}/8", charge)),

                    // 1 protein (PRO4) to 2 peptides to 2 spectra (each) = 2 additional peptides
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("DDDDDDDDDD@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("DDDDDDDDDD@{0}/1 BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("DDDDDDDDD@{0}/1  AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("DDDDDDDDD@{0}/1  BBBBBBBBBB@{0}/8", charge)),

                    // 2 proteins (PRO5,6) to 1 peptide to 1 spectrum = 1 additional peptide (ambiguous protein group)
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("EEEEEEEEEE@{0}/1 AAAAAAAAAA@{0}/8", charge)),

                    // 2 proteins (PRO7,8) to 1 peptide to 2 spectra = 1 additional peptide (ambiguous protein group)
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("FFFFFFFFFF@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("FFFFFFFFFF@{0}/1 BBBBBBBBBB@{0}/8", charge)),

                    // 2 proteins (PRO9,10) to 2 peptides to 1 spectrum (each) = 2 additional peptides (ambiguous protein group)
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("GGGGGGGGGG@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("GGGGGGGGG@{0}/1  BBBBBBBBBB@{0}/8", charge)),

                    // 2 proteins (PRO11,12) to 2 peptides to 2 spectra (each) = 2 additional peptides (ambiguous protein group)
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("HHHHHHHHHH@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("HHHHHHHHHH@{0}/1 BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("HHHHHHHHH@{0}/1  AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("HHHHHHHHH@{0}/1  BBBBBBBBBB@{0}/8", charge)),

                    // 1 protein (PRO13) to 2 peptides = 2 additional peptide
                    // 1 protein (PRO14) to 1 of the above peptides = 0 additional peptides (subsumed protein)
                    // 1 protein (PRO15) to the other above peptide = 0 additional peptides (subsumed protein)
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("AAAABBBB@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("BBBBCCCC@{0}/1 BBBBBBBBBB@{0}/8", charge)),

                    // 1 protein (PRO16) to 2 peptides = 2 additional peptide
                    // 2 proteins (PRO17,18) to 1 of the above peptides = 0 additional peptides (subsumed ambiguous protein group)
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("DDDDEEEE@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("EEEEFFFF@{0}/1 BBBBBBBBBB@{0}/8", charge)),

                    // 2 proteins (PRO19,20) to 2 peptides = 2 additional peptide (ambiguous protein group)
                    // 1 protein (PRO21) to 1 of the above peptides = 0 additional peptides (subsumed protein)
                    // 1 protein (PRO22) to the other above peptide = 0 additional peptides (subsumed protein)
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("GGGGHHHH@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("HHHHIIII@{0}/1 BBBBBBBBBB@{0}/8", charge)),

                    // 2 proteins (PRO23,24) to 2 peptides = 2 additional peptides (ambiguous protein group)
                    // 2 proteins (PRO25,26) to 1 of the above peptides = 0 additional peptides (subsumed ambiguous protein group)
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("KKKKLLLL@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("LLLLMMMM@{0}/1 BBBBBBBBBB@{0}/8", charge)),

                    // 1 protein (PRO27) to 3 peptides = 3 additional peptides
                    // 1 protein (PRO28) to 1 of the above peptides and 1 extra peptide = 1 additional peptides
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("NNNNPPPP@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("NNNNPPP@{0}/1  BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("PPPPQQQQ@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("QQQQRRRR@{0}/1 BBBBBBBBBB@{0}/8", charge)),

                    // 1 protein (PRO29) to 3 peptides = 3 additional peptides
                    // 2 proteins (PRO30,31) to 1 of the above peptides and 1 extra peptide = 1 additional peptides (ambiguous protein group)
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("SSSSTTTT@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("SSSSTTT@{0}/1  BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("TTTTUUUU@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("UUUUVVVV@{0}/1 BBBBBBBBBB@{0}/8", charge)),

                    // 2 proteins (PRO32,33) to 3 peptides = 3 additional peptides (ambiguous protein group)
                    // 1 protein (PRO34) to 1 of the above peptides and 1 extra peptide = 1 additional peptides
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("WWWWYYYY@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("WWWWYYY@{0}/1  BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("YYYYZZZZ@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("ZZZZFFFF@{0}/1 BBBBBBBBBB@{0}/8", charge)),

                    // 2 proteins (PRO35,36) to 3 peptides = 3 additional peptides (ambiguous protein group)
                    // 2 proteins (PRO37,38) to 1 of the above peptides and 1 extra peptide = 1 additional peptides (ambiguous protein group)
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("AAAACCCC@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("AAAACCC@{0}/1  BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("CCCCEEEE@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("EEEEGGGG@{0}/1 BBBBBBBBBB@{0}/8", charge)),

                    // 1 protein (PRO39) to 5 peptides = 5 additional peptides
                    // 1 protein (PRO40) to 4 of the above peptides = 0 additional peptides
                    // 1 protein (PRO41) to 3 of the above peptides and 1 extra peptides = 1 additional peptides
                    // 1 protein (PRO42) to 2 of the above peptides and 2 extra peptides = 2 additional peptides
                    // 1 protein (PRO43) to 1 of the above peptides and 3 extra peptides = 3 additional peptides
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("BBBBBDDDDD@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("BBBBDDDD@{0}/1   BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("BBBBDDD@{0}/1    AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("BBBDD@{0}/1      BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("BBDD@{0}/1       AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("ZBBBBDDD@{0}/1   BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("YBBBDD@{0}/1     AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("YBBBDDD@{0}/1    BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("WBB@{0}/1        AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("WBBD@{0}/1       BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("WBBDD@{0}/1      AAAAAAAAAA@{0}/8", charge)),

                    // 1 protein (PRO44) to 3 peptides, 1 of which is evidenced by an ambiguous spectrum = 3 additional peptides
                    // 1 protein (PRO45) to 1 peptide evidenced by the ambiguous spectrum above and 1 extra peptide = 1 additional peptides
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("DDDDDFFFFF@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("DDDDDFFFF@{0}/1  BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("DFFFFF@{0}/1 FFFFFH@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("FFFFFHHHHH@{0}/1 BBBBBBBBBB@{0}/8", charge)),
                    
                    // 2 proteins (PRO46,47) to 3 peptides, 1 of which is evidenced by an ambiguous spectrum = 3 additional peptides
                    // 1 protein (PRO48) to 1 peptide evidenced by the ambiguous spectrum above and 1 extra peptide = 1 additional peptides
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("HHHHHKKKKK@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("HHHHHKKKK@{0}/1  BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("HKKKKK@{0}/1 KKKKKM@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("KKKKKMMMMM@{0}/1 BBBBBBBBBB@{0}/8", charge)),
                    
                    // 1 protein (PRO49) to 3 peptides, 1 of which is evidenced by an ambiguous spectrum = 3 additional peptides
                    // 2 proteins (PRO50,51) to 1 peptide evidenced by the ambiguous spectrum above and 1 extra peptide = 1 additional peptides
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("LLLLLNNNNN@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("LLLLLNNNN@{0}/1  BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("LNNNNN@{0}/1 NNNNNQ@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("NNNNNQQQQQ@{0}/1 BBBBBBBBBB@{0}/8", charge)),
                    
                    // 1 protein (PRO52) to 3 peptides, 2 of which are evidenced by ambiguous spectra = 3 additional peptides
                    // 1 protein (PRO53) to 1 peptide evidenced by an ambiguous spectrum above and 1 extra peptide = 1 additional peptides
                    // 1 protein (PRO54) to 1 peptide evidenced by the other ambiguous spectrum above and 1 extra peptide = 1 additional peptides
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("MMMMMPPPPP@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("MPPPPP@{0}/1 PRRRRR@{0}/1 BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("PPPPPRRRRR@{0}/1 AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("MPPPP@{0}/1 PRRRRP@{0}/1 BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("PPPPRRRRP@{0}/1  AAAAAAAAAA@{0}/8", charge)),

                    // PRO55 -> QQQQSSSS, SSSSUUUU = 2 additional peptides
                    // PRO56 -> UUUUYYYY, SSSSUUUU = 2 additional peptides
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("QQQQSSSS@{0}/1   AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("SSSSUUUU@{0}/1   BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("UUUUYYYY@{0}/1   AAAAAAAAAA@{0}/8", charge)),

                    // PRO57 -> RRRRTTTT, WWWWZZZZ, TTTTWWWW = 3 additional peptides
                    // PRO58 -> ZZZZBBBB, WWWWZZZZ, TTTTWWWW = 3 additional peptides
                    // PRO59 -> RRRRTTTT, ZZZZBBBB, TTTTWWWW = 3 additional peptides
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("RRRRTTTT@{0}/1   AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("WWWWZZZZ@{0}/1   BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("TTTTWWWW@{0}/1   AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("ZZZZBBBB@{0}/1   BBBBBBBBBB@{0}/8", charge)),

                    // PRO60 -> AAAADDDD, DDDDGGGG, GGGGKKKK = 3 additional peptides
                    // PRO61 -> DDDDGGGG, GGGGKKKK, KKKKNNNN = 3 additional peptides
                    // PRO62 -> AAAADDDD, KKKKNNNN = 0 additional peptides
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("AAAADDDD@{0}/1   AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("DDDDGGGG@{0}/1   BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("GGGGKKKK@{0}/1   AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("KKKKNNNN@{0}/1   BBBBBBBBBB@{0}/8", charge)),

                    // PRO63 -> BBBBEEEE, EEEEHHHH = 2 additional peptides
                    // PRO64 -> EEEEHHHH, HHHHLLLL = 0 additional peptides
                    // PRO65 -> HHHHLLLL, LLLLPPPP = 2 additional peptides
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("BBBBEEEE@{0}/1   AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("EEEEHHHH@{0}/1   BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("HHHHLLLL@{0}/1   AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("LLLLPPPP@{0}/1   BBBBBBBBBB@{0}/8", charge)),
                    
                    // PRO66 -> CCCCFFFF, CFFFFI, FFFFIIII = 3 additional peptides
                    // PRO67 -> FFFFIIII, FIIIIM, IIIIMMMM = 1 additional peptides
                    // PRO68 -> IIIIMMMM, IMMMMQ, MMMMQQQQ = 3 additional peptides
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("CCCCFFFF@{0}/1   AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("CFFFFI@{0}/1     BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("FFFFIIII@{0}/1   AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("FIIIIM@{0}/1     BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("IIIIMMMM@{0}/1   AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("IMMMMQ@{0}/1     BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("MMMMQQQQ@{0}/1   AAAAAAAAAA@{0}/8", charge)),
                    
                    // PRO69 -> NNNNRRRR, RRRRUUUU, RRRRUUU = 3 additional peptides
                    // PRO70 -> RRRRUUUU, RRRRUUU, UUUUZZZZ = 0 additional peptides
                    // PRO71 -> UUUUZZZZ, UZZZZC, ZZZZCCCC = 3 additional peptides
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("NNNNRRRR@{0}/1   AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("RRRRUUUU@{0}/1   BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("RRRRUUU@{0}/1    AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("UUUUZZZZ@{0}/1   BBBBBBBBBB@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("UZZZZC@{0}/1     AAAAAAAAAA@{0}/8", charge)),
                    new SpectrumTuple("/", source, ++scan, analysis, 1, 1, String.Format("ZZZZCCCC@{0}/1   BBBBBBBBBB@{0}/8", charge)),
                };

                TestModel.CreateTestData(session, testPsmSummary);
            }

            var dataFilter = new DataFilter()
            {
                MaximumQValue = 1,
                MinimumDistinctPeptides = 0,
                MinimumSpectra = 0,
                MinimumAdditionalPeptides = 1
            };
            dataFilter.ApplyBasicFilters(session);

            // clear session so objects are loaded from database
            session.Clear();

            var additionalPeptidesByProteinId = new Map<long, int>();
            foreach (object[] row in session.CreateSQLQuery("SELECT ProteinId, AdditionalMatches FROM AdditionalMatches").List<object[]>())
                additionalPeptidesByProteinId[Convert.ToInt64(row[0])] = Convert.ToInt32(row[1]);

            // 1 protein to 1 peptide to 1 spectrum = 1 additional peptide
            Assert.AreEqual(1, additionalPeptidesByProteinId[1]);

            // 1 protein to 1 peptide to 2 spectra = 1 additional peptide
            Assert.AreEqual(1, additionalPeptidesByProteinId[2]);

            // 1 protein to 2 peptides to 1 spectrum (each) = 2 additional peptides
            Assert.AreEqual(2, additionalPeptidesByProteinId[3]);

            // 1 protein to 2 peptides to 2 spectra (each) = 2 additional peptides
            Assert.AreEqual(2, additionalPeptidesByProteinId[4]);

            // 2 proteins to 1 peptide to 1 spectrum = 1 additional peptide (ambiguous protein group)
            Assert.AreEqual(1, additionalPeptidesByProteinId[5]);
            Assert.AreEqual(1, additionalPeptidesByProteinId[6]);

            // 2 proteins to 1 peptide to 2 spectra = 1 additional peptide (ambiguous protein group)
            Assert.AreEqual(1, additionalPeptidesByProteinId[7]);
            Assert.AreEqual(1, additionalPeptidesByProteinId[8]);

            // 2 proteins to 2 peptides to 1 spectrum (each) = 2 additional peptides (ambiguous protein group)
            Assert.AreEqual(2, additionalPeptidesByProteinId[9]);
            Assert.AreEqual(2, additionalPeptidesByProteinId[10]);

            // 2 proteins to 2 peptides to 2 spectra (each) = 2 additional peptides (ambiguous protein group)
            Assert.AreEqual(2, additionalPeptidesByProteinId[11]);
            Assert.AreEqual(2, additionalPeptidesByProteinId[12]);

            // 1 protein to 2 peptides to 1 spectrum (each) = 2 additional peptide
            // 1 protein to 1 of the above peptides = 0 additional peptides (subsumed protein)
            // 1 protein to the other above peptide = 0 additional peptides (subsumed protein)
            Assert.AreEqual(2, additionalPeptidesByProteinId[13]);
            Assert.AreEqual(0, additionalPeptidesByProteinId[14]);
            Assert.AreEqual(0, additionalPeptidesByProteinId[15]);

            // 1 protein to 2 peptides to 1 spectrum (each) = 2 additional peptide
            // 2 proteins to 1 of the above peptides = 0 additional peptides (subsumed ambiguous protein group)
            Assert.AreEqual(2, additionalPeptidesByProteinId[16]);
            Assert.AreEqual(0, additionalPeptidesByProteinId[17]);
            Assert.AreEqual(0, additionalPeptidesByProteinId[18]);

            // 2 proteins to 2 peptides to 1 spectrum (each) = 2 additional peptide (ambiguous protein group)
            // 1 protein to 1 of the above peptides = 0 additional peptides (subsumed protein)
            // 1 protein to the other above peptide = 0 additional peptides (subsumed protein)
            Assert.AreEqual(2, additionalPeptidesByProteinId[19]);
            Assert.AreEqual(2, additionalPeptidesByProteinId[20]);
            Assert.AreEqual(0, additionalPeptidesByProteinId[21]);
            Assert.AreEqual(0, additionalPeptidesByProteinId[22]);

            // 2 proteins to 2 peptides to 1 spectrum (each) = 2 additional peptides (ambiguous protein group)
            // 2 proteins to 1 of the above peptides = 0 additional peptides (subsumed ambiguous protein group)
            Assert.AreEqual(2, additionalPeptidesByProteinId[23]);
            Assert.AreEqual(2, additionalPeptidesByProteinId[24]);
            Assert.AreEqual(0, additionalPeptidesByProteinId[25]);
            Assert.AreEqual(0, additionalPeptidesByProteinId[26]);

            // 1 protein to 3 peptides to 1 spectrum (each) = 3 additional peptides
            // 1 protein to 1 of the above peptides and 1 extra peptide to 1 spectrum = 1 additional peptides
            Assert.AreEqual(3, additionalPeptidesByProteinId[27]);
            Assert.AreEqual(1, additionalPeptidesByProteinId[28]);

            // 1 protein to 3 peptides to 1 spectrum (each) = 3 additional peptides
            // 2 proteins to 1 of the above peptides and 1 extra peptide to 1 spectrum = 1 additional peptides (ambiguous protein group)
            Assert.AreEqual(3, additionalPeptidesByProteinId[29]);
            Assert.AreEqual(1, additionalPeptidesByProteinId[30]);
            Assert.AreEqual(1, additionalPeptidesByProteinId[31]);

            // 2 proteins to 3 peptides to 1 spectrum (each) = 3 additional peptides (ambiguous protein group)
            // 1 protein to 1 of the above peptides and 1 extra peptide to 1 spectrum = 1 additional peptides
            Assert.AreEqual(3, additionalPeptidesByProteinId[32]);
            Assert.AreEqual(3, additionalPeptidesByProteinId[33]);
            Assert.AreEqual(1, additionalPeptidesByProteinId[34]);

            // 2 proteins to 3 peptides to 1 spectrum (each) = 3 additional peptides (ambiguous protein group)
            // 2 proteins to 1 of the above peptides and 1 extra peptide to 1 spectrum = 1 additional peptides (ambiguous protein group)
            Assert.AreEqual(3, additionalPeptidesByProteinId[35]);
            Assert.AreEqual(3, additionalPeptidesByProteinId[36]);
            Assert.AreEqual(1, additionalPeptidesByProteinId[37]);
            Assert.AreEqual(1, additionalPeptidesByProteinId[38]);

            // 1 protein (PRO39) to 5 peptides = 5 additional peptides
            // 1 protein (PRO40) to 4 of the above peptides = 0 additional peptides
            // 1 protein (PRO41) to 3 of the above peptides and 1 extra peptides = 1 additional peptides
            // 1 protein (PRO42) to 2 of the above peptides and 2 extra peptides = 2 additional peptides
            // 1 protein (PRO43) to 1 of the above peptides and 3 extra peptides = 3 additional peptides
            Assert.AreEqual(5, additionalPeptidesByProteinId[39]);
            Assert.AreEqual(0, additionalPeptidesByProteinId[40]);
            Assert.AreEqual(1, additionalPeptidesByProteinId[41]);
            Assert.AreEqual(2, additionalPeptidesByProteinId[42]);
            Assert.AreEqual(3, additionalPeptidesByProteinId[43]);

            // 1 protein (PRO44) to 3 peptides, 1 of which is evidenced by an ambiguous spectrum = 3 additional peptides
            // 1 protein (PRO45) to 1 peptide evidenced by the ambiguous spectrum above and 1 extra peptide = 1 additional peptides
            Assert.AreEqual(3, additionalPeptidesByProteinId[44]);
            Assert.AreEqual(1, additionalPeptidesByProteinId[45]);
                    
            // 2 proteins (PRO46,47) to 3 peptides, 1 of which is evidenced by an ambiguous spectrum = 3 additional peptides
            // 1 protein (PRO48) to 1 peptide evidenced by the ambiguous spectrum above and 1 extra peptide = 1 additional peptides
            Assert.AreEqual(3, additionalPeptidesByProteinId[46]);
            Assert.AreEqual(3, additionalPeptidesByProteinId[47]);
            Assert.AreEqual(1, additionalPeptidesByProteinId[48]);
            
            // 1 protein (PRO49) to 3 peptides, 1 of which is evidenced by an ambiguous spectrum = 3 additional peptides
            // 2 proteins (PRO50,51) to 1 peptide evidenced by the ambiguous spectrum above and 1 extra peptide = 1 additional peptides
            Assert.AreEqual(3, additionalPeptidesByProteinId[49]);
            Assert.AreEqual(1, additionalPeptidesByProteinId[50]);
            Assert.AreEqual(1, additionalPeptidesByProteinId[51]);

            // 1 protein (PRO52) to 3 peptides, 2 of which are evidenced by ambiguous spectra = 3 additional peptides
            // 1 protein (PRO53) to 1 peptide evidenced by an ambiguous spectrum above and 1 extra peptide = 1 additional peptides
            // 1 protein (PRO54) to 1 peptide evidenced by the other ambiguous spectrum above and 1 extra peptide = 1 additional peptides
            Assert.AreEqual(3, additionalPeptidesByProteinId[52]);
            Assert.AreEqual(1, additionalPeptidesByProteinId[53]);
            Assert.AreEqual(1, additionalPeptidesByProteinId[54]);
            
            // PRO55 -> QQQQSSSS, SSSSUUUU = 2 additional peptides
            // PRO56 -> UUUUYYYY, SSSSUUUU = 2 additional peptides
            Assert.AreEqual(2, additionalPeptidesByProteinId[55]);
            Assert.AreEqual(2, additionalPeptidesByProteinId[56]);

            // PRO57 -> RRRRTTTT, WWWWZZZZ, TTTTWWWW = 3 additional peptides
            // PRO58 -> QQQQKKKK, WWWWZZZZ, TTTTWWWW = 3 additional peptides
            // PRO59 -> RRRRTTTT, TTTTZZZZ, TTTTWWWW = 3 additional peptides
            Assert.AreEqual(3, additionalPeptidesByProteinId[57]);
            Assert.AreEqual(3, additionalPeptidesByProteinId[58]);
            Assert.AreEqual(3, additionalPeptidesByProteinId[59]);

            // PRO60 -> AAAADDDD, DDDDGGGG, GGGGKKKK = 3 additional peptides
            // PRO61 -> DDDDGGGG, GGGGKKKK, KKKKNNNN = 3 additional peptides
            // PRO62 -> AAAADDDD, KKKKNNNN = 0 additional peptides
            Assert.AreEqual(3, additionalPeptidesByProteinId[60]);
            Assert.AreEqual(3, additionalPeptidesByProteinId[61]);
            Assert.AreEqual(0, additionalPeptidesByProteinId[62]);

            // PRO63 -> BBBBEEEE, EEEEHHHH = 2 additional peptides
            // PRO64 -> EEEEHHHH, HHHHLLLL = 0 additional peptides
            // PRO65 -> HHHHLLLL, LLLLPPPP = 2 additional peptides
            Assert.AreEqual(2, additionalPeptidesByProteinId[63]);
            Assert.AreEqual(0, additionalPeptidesByProteinId[64]);
            Assert.AreEqual(2, additionalPeptidesByProteinId[65]);

            // PRO66 -> CCCCFFFF, CFFFFI, FFFFIIII = 3 additional peptides
            // PRO67 -> FFFFIIII, FIIIIM, IIIIMMMM = 1 additional peptides
            // PRO68 -> IIIIMMMM, IMMMMQ, MMMMQQQQ = 3 additional peptides
            Assert.AreEqual(3, additionalPeptidesByProteinId[66]);
            Assert.AreEqual(1, additionalPeptidesByProteinId[67]);
            Assert.AreEqual(3, additionalPeptidesByProteinId[68]);

            // PRO69 -> NNNNRRRR, RRRRUUUU, RRRRUUU = 3 additional peptides
            // PRO70 -> RRRRUUUU, RRRRUUU, UUUUZZZZ = 0 additional peptides
            // PRO71 -> UUUUZZZZ, UZZZZC, ZZZZCCCC = 3 additional peptides
            Assert.AreEqual(3, additionalPeptidesByProteinId[69]);
            Assert.AreEqual(0, additionalPeptidesByProteinId[70]);
            Assert.AreEqual(3, additionalPeptidesByProteinId[71]);

            // test that the MinimumAdditionalPeptidesPerProtein filter is applied correctly;
            // proteins filtered out by it should cascade to PeptideInstances, Peptides, and PSMs

            dataFilter.MinimumAdditionalPeptides = 1;
            dataFilter.ApplyBasicFilters(session);

            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO55"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO56"));

            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO57"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO58"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO59"));

            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO60"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO61"));
            Assert.IsNull(session.UniqueResult<Protein>(o => o.Accession == "PRO62"));
            Assert.IsNull(session.UniqueResult<PeptideInstance>(o => o.Protein.Accession == "PRO62"));
            Assert.IsNotNull(session.UniqueResult<Peptide>(o => o.Sequence == "AAAADDDD"));
            Assert.IsNotNull(session.UniqueResult<Peptide>(o => o.Sequence == "KKKKNNNN"));

            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO63"));
            Assert.IsNull(session.UniqueResult<Protein>(o => o.Accession == "PRO64"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO65"));
            Assert.IsNull(session.UniqueResult<PeptideInstance>(o => o.Protein.Accession == "PRO64"));
            Assert.IsNotNull(session.UniqueResult<Peptide>(o => o.Sequence == "EEEEHHHH"));
            Assert.IsNotNull(session.UniqueResult<Peptide>(o => o.Sequence == "HHHHLLLL"));

            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO66"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO67"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO68"));

            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO69"));
            Assert.IsNull(session.UniqueResult<Protein>(o => o.Accession == "PRO70"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO71"));
            Assert.IsNull(session.UniqueResult<PeptideInstance>(o => o.Protein.Accession == "PRO70"));
            Assert.IsNotNull(session.UniqueResult<Peptide>(o => o.Sequence == "RRRRUUUU"));
            Assert.IsNotNull(session.UniqueResult<Peptide>(o => o.Sequence == "RRRRUUU"));
            Assert.IsNotNull(session.UniqueResult<Peptide>(o => o.Sequence == "UUUUZZZZ"));

            dataFilter.MinimumAdditionalPeptides = 2;
            dataFilter.ApplyBasicFilters(session);

            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO55"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO56"));

            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO57"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO58"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO59"));

            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO60"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO61"));
            Assert.IsNull(session.UniqueResult<Protein>(o => o.Accession == "PRO62"));
            Assert.IsNull(session.UniqueResult<PeptideInstance>(o => o.Protein.Accession == "PRO62"));

            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO63"));
            Assert.IsNull(session.UniqueResult<Protein>(o => o.Accession == "PRO64"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO65"));
            Assert.IsNull(session.UniqueResult<PeptideInstance>(o => o.Protein.Accession == "PRO64"));

            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO66"));
            Assert.IsNull(session.UniqueResult<Protein>(o => o.Accession == "PRO67"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO68"));
            Assert.IsNull(session.UniqueResult<PeptideInstance>(o => o.Protein.Accession == "PRO67"));
            Assert.IsNull(session.UniqueResult<Peptide>(o => o.Sequence == "FIIIIM"));
            Assert.IsNull(session.UniqueResult<PeptideSpectrumMatch>(o => o.Peptide.Sequence == "FIIIIM"));

            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO69"));
            Assert.IsNull(session.UniqueResult<Protein>(o => o.Accession == "PRO70"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO71"));
            Assert.IsNull(session.UniqueResult<PeptideInstance>(o => o.Protein.Accession == "PRO70"));

            dataFilter.MinimumAdditionalPeptides = 3;
            dataFilter.ApplyBasicFilters(session);

            Assert.IsNull(session.UniqueResult<Protein>(o => o.Accession == "PRO55"));
            Assert.IsNull(session.UniqueResult<Protein>(o => o.Accession == "PRO56"));
            Assert.IsNull(session.UniqueResult<PeptideInstance>(o => o.Protein.Accession == "PRO55"));
            Assert.IsNull(session.UniqueResult<PeptideInstance>(o => o.Protein.Accession == "PRO56"));
            Assert.IsNull(session.UniqueResult<Peptide>(o => o.Sequence == "QQQQSSSS"));
            Assert.IsNull(session.UniqueResult<Peptide>(o => o.Sequence == "SSSSUUUU"));
            Assert.IsNull(session.UniqueResult<Peptide>(o => o.Sequence == "UUUUYYYY"));
            Assert.IsNull(session.UniqueResult<PeptideSpectrumMatch>(o => o.Peptide.Sequence == "QQQQSSSS"));
            Assert.IsNull(session.UniqueResult<PeptideSpectrumMatch>(o => o.Peptide.Sequence == "SSSSUUUU"));
            Assert.IsNull(session.UniqueResult<PeptideSpectrumMatch>(o => o.Peptide.Sequence == "UUUUYYYY"));

            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO57"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO58"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO59"));

            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO60"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO61"));
            Assert.IsNull(session.UniqueResult<Protein>(o => o.Accession == "PRO62"));
            Assert.IsNull(session.UniqueResult<PeptideInstance>(o => o.Protein.Accession == "PRO62"));

            Assert.IsNull(session.UniqueResult<Protein>(o => o.Accession == "PRO63"));
            Assert.IsNull(session.UniqueResult<Protein>(o => o.Accession == "PRO64"));
            Assert.IsNull(session.UniqueResult<Protein>(o => o.Accession == "PRO65"));
            Assert.IsNull(session.UniqueResult<PeptideInstance>(o => o.Protein.Accession == "PRO63"));
            Assert.IsNull(session.UniqueResult<PeptideInstance>(o => o.Protein.Accession == "PRO64"));
            Assert.IsNull(session.UniqueResult<PeptideInstance>(o => o.Protein.Accession == "PRO65"));
            Assert.IsNull(session.UniqueResult<Peptide>(o => o.Sequence == "BBBBEEEE"));
            Assert.IsNull(session.UniqueResult<Peptide>(o => o.Sequence == "EEEEHHHH"));
            Assert.IsNull(session.UniqueResult<Peptide>(o => o.Sequence == "HHHHLLLL"));
            Assert.IsNull(session.UniqueResult<Peptide>(o => o.Sequence == "LLLLPPPP"));
            Assert.IsNull(session.UniqueResult<PeptideSpectrumMatch>(o => o.Peptide.Sequence == "BBBBEEEE"));
            Assert.IsNull(session.UniqueResult<PeptideSpectrumMatch>(o => o.Peptide.Sequence == "EEEEHHHH"));
            Assert.IsNull(session.UniqueResult<PeptideSpectrumMatch>(o => o.Peptide.Sequence == "HHHHLLLL"));
            Assert.IsNull(session.UniqueResult<PeptideSpectrumMatch>(o => o.Peptide.Sequence == "LLLLPPPP"));

            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO66"));
            Assert.IsNull(session.UniqueResult<Protein>(o => o.Accession == "PRO67"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO68"));
            Assert.IsNull(session.UniqueResult<PeptideInstance>(o => o.Protein.Accession == "PRO67"));

            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO69"));
            Assert.IsNull(session.UniqueResult<Protein>(o => o.Accession == "PRO70"));
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO71"));
            Assert.IsNull(session.UniqueResult<PeptideInstance>(o => o.Protein.Accession == "PRO70"));

            dataFilter.MinimumAdditionalPeptides = 4;
            dataFilter.ApplyBasicFilters(session);

            Assert.AreEqual(1, session.Query<Protein>().Count());
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO39"));
            Assert.IsNull(session.UniqueResult<PeptideInstance>(o => o.Protein.Accession != "PRO39"));

            var remainingPeptides = new string[] { "BBBBBDDDDD", "BBBBDDDD", "BBBBDDD", "BBBDD", "BBDD" };
            Assert.AreEqual(5, session.Query<Peptide>().Count());
            Assert.AreEqual(5, session.Query<Peptide>().Count(o => remainingPeptides.Contains(o.Sequence)));
            Assert.AreEqual(0, session.Query<Peptide>().Count(o => !remainingPeptides.Contains(o.Sequence)));
            Assert.AreNotEqual(0, session.Query<PeptideSpectrumMatch>().Count(o => remainingPeptides.Contains(o.Peptide.Sequence)));
            Assert.AreEqual(0, session.Query<PeptideSpectrumMatch>().Count(o => !remainingPeptides.Contains(o.Peptide.Sequence)));

            dataFilter.MinimumAdditionalPeptides = 5;
            dataFilter.ApplyBasicFilters(session);

            Assert.AreEqual(1, session.Query<Protein>().Count());
            Assert.IsNotNull(session.UniqueResult<Protein>(o => o.Accession == "PRO39"));
            Assert.IsNull(session.UniqueResult<PeptideInstance>(o => o.Protein.Accession != "PRO39"));

            dataFilter.MinimumAdditionalPeptides = 6;
            dataFilter.ApplyBasicFilters(session);

            Assert.AreEqual(0, session.Query<Protein>().Count());
            Assert.AreEqual(0, session.Query<PeptideInstance>().Count());
            Assert.AreEqual(0, session.Query<Peptide>().Count());
            Assert.AreEqual(0, session.Query<PeptideSpectrumMatch>().Count());

            session.Close();
        }
Пример #5
0
 public void Initialize()
 {
     //Objekte der Klassen werden initialisiert.
     map = new Map(new System.Drawing.Bitmap("Collision-Maps/Collision-Bitmap.bmp"));
     player = new Player("Cookie2", new Vector2f(200, 1400));
     enemy = new Enemy01();
     checkPointList = checkPointList01();
     text = new Texture("Collision-Maps/Collision-Bitmap.bmp");
     sprite = new Sprite(text);
     sprite.Scale = new Vector2f(50, 50);
     powerups = new Powerups01();
     hud = new Hud();
     start = new TimeSpan(0, 0, 3);
     Stopwatch timer = new Stopwatch();
     TimeSpan time = new TimeSpan();
     timer.Start();
     time = new TimeSpan(0, 0, 1);
     pH = new ParticleHandler();
 }
Пример #6
0
 public void Init()
 {
     Map map = new Map ();
 }