Ejemplo n.º 1
0
        public void testCalculatePeakMatchesZeroPull3()//sometimes you might be missing one peak, but you do have the others, so this tests the first two matching
        {
            var           binner    = new Binner();
            List <double> checkList = new List <double>()
            {
                102.0553, 104.0532, 115.0866, 115.0868, 120.081, 129.1022, 129.1024, 136.0756, 136.0758, 143.0813, 143.0815, 147.1129, 175.1191, 205.0997, 205.1005, 226.1183, 226.1184, 234.1445, 234.1445, 244.129, 244.1292, 346.1235, 349.1711, 512.2333, 512.2339, 731.3385, 731.3389, 731.8417, 882.8903, 882.8914, 883.3907, 883.3919, 883.8919, 932.4248, 932.4258, 932.9235, 932.9239, 933.4252, 981.9614, 982.4613
            };

            Assert.That(binner.calculatePeakMatches(checkList.ToArray()), Is.EqualTo(14));
        }
Ejemplo n.º 2
0
        public void testCalculatePeakMatchesZeroPull1()//sometimes you might be missing one peak, but you do have the others, so this tests the first two matching
        {
            var           binner    = new Binner();
            List <double> checkList = new List <double>()
            {
                129.1021, 129.1023, 204.1342, 204.1343, 216.134, 216.1342, 315.2028, 315.2031, 420.2077, 420.2088, 497.3074, 497.3077, 515.3183, 515.3183, 576.2971, 576.2971, 614.3826, 614.3839, 705.3383, 705.3389, 814.9211, 815.4231, 815.4234, 833.432, 833.433, 932.4996, 932.5014, 933.5035, 1047.5243, 1047.5259, 1160.6065, 1291.6454, 1291.6455, 1292.6493, 1369.1514, 1369.6582, 1370.1592, 1370.6724, 1390.7145, 1390.7148
            };

            Assert.That(binner.calculatePeakMatches(checkList.ToArray()), Is.EqualTo(16));
        }
Ejemplo n.º 3
0
        public void testCalculatePeakMatchesZeroPull2()//sometimes you might be missing one peak, but you do have the others, so this tests the first two matching
        {
            var           binner    = new Binner();
            List <double> checkList = new List <double>()
            {
                120.0807, 129.1021, 129.1021, 186.1234, 204.1341, 204.1342, 216.1339, 216.134, 244.0926, 262.118, 315.2028, 343.161, 391.1608, 399.1982, 420.2074, 420.2077, 497.3074, 515.3183, 515.3185, 576.2958, 576.2971, 614.3826, 614.3903, 705.338, 705.3383, 814.9211, 815.4234, 833.4318, 833.432, 932.4996, 932.5006, 933.5035, 1047.5243, 1047.5251, 1160.6065, 1291.6455, 1291.6463, 1292.6493, 1390.7148, 1390.7162
            };

            Assert.That(binner.calculatePeakMatches(checkList.ToArray()), Is.EqualTo(13));
        }
Ejemplo n.º 4
0
        public void testCalculatePeakMatchesRandom2()
        {
            var           binner    = new Binner();
            List <double> checkList = new List <double>()
            {
                102.055, 110.0714, 120.0808, 129.102, 129.1022, 130.0649, 136.0754, 136.0756, 147.1126, 159.0912, 199.071, 200.1391, 216.0975, 218.1495, 226.0817, 226.1181, 228.1339, 244.0922, 244.1289, 261.1553, 298.1032, 315.1292, 343.1599, 374.2386, 459.3279, 475.2859, 584.762, 585.2638, 588.3688, 922.3692, 1035.7957, 1036.1309, 1036.4625, 1168.5145, 1329.1099, 1329.607, 1422.6464, 1447.6745, 1448.6753, 1515.1708
            };

            Assert.That(binner.calculatePeakMatches(checkList.ToArray()), Is.EqualTo(2));
        }
Ejemplo n.º 5
0
        public void testCalculatePeakMatchesRandom1()
        {
            var           binner    = new Binner();
            List <double> checkList = new List <double>()
            {
                102.055, 110.0712, 126.0548, 129.1019, 129.102, 145.0603, 175.1185, 175.1188, 183.1489, 211.1436, 226.0817, 230.1263, 244.0923, 269.1239, 287.1475, 297.1187, 315.1291, 315.2017, 322.1862, 368.1555, 412.2544, 487.3337, 525.335, 526.3399, 573.2868, 637.7699, 646.2794, 646.7815, 676.2944, 687.4118, 763.3268, 800.4964, 821.9374, 822.4349, 929.5351, 1000.5723, 1001.5726, 1128.6274, 1129.6319, 1256.6856
            };

            Assert.That(binner.calculatePeakMatches(checkList.ToArray()), Is.EqualTo(2));
        }
Ejemplo n.º 6
0
        public void testCalculatePeakMatchesOnePull2()
        {
            var           binner    = new Binner();
            List <double> checkList = new List <double>()
            {
                110.0716, 120.081, 129.1025, 136.0759, 143.1178, 143.1181, 147.1129, 171.1126, 171.113, 173.1288, 180.1021, 181.0971, 199.1076, 199.1081, 213.0869, 231.0968, 231.0976, 254.1498, 254.1501, 261.1244, 272.1603, 272.1606, 328.1621, 383.1919, 383.1932, 488.3056, 828.4752, 828.9772, 829.4727, 851.4489, 932.4659, 1031.5328, 1163.6329, 1164.6385, 1177.6372, 1178.6394, 1314.6951, 1364.6927, 1463.7149, 1514.8089
            };

            Assert.That(binner.calculatePeakMatches(checkList.ToArray()), Is.EqualTo(7));
        }
Ejemplo n.º 7
0
        public void testCalculatePeakMatchesOnePull1()//sometimes you might be missing one peak, but you do have the others, so this tests the first two matching
        {
            var           binner    = new Binner();
            List <double> checkList = new List <double>()
            {
                104.053, 110.0711, 110.0713, 120.0807, 129.1022, 136.0753, 136.0756, 147.1126, 157.1332, 157.1333, 173.1281, 175.1184, 185.1282, 185.1283, 201.1232, 229.1179, 251.1025, 251.1025, 260.1966, 279.0974, 279.0975, 300.1549, 300.1554, 301.1584, 362.1354, 449.2359, 622.3544, 643.4247, 859.5001, 987.5576, 1001.5563, 1002.5616, 1100.6265, 1157.6617, 1158.6645, 1256.7299, 1257.7325, 1300.7061, 1369.8097, 1387.6953
            };

            Assert.That(binner.calculatePeakMatches(checkList.ToArray()), Is.EqualTo(7));
        }
Ejemplo n.º 8
0
        private static void GetItemsFromDatabase()
        {
            List <int>    numberOfPeakMatchesList = new List <int>();
            List <string> toDatabaseList          = new List <string>();
            var           Binner = new Binner();

            using (
                System.Data.SQLite.SQLiteConnection conn =
                    new System.Data.SQLite.SQLiteConnection("data source=" + LibraryDBPath + ".db3"))
            {
                conn.Open();
                using (var cmd = conn.CreateCommand())
                {
                    cmd.CommandText = "ATTACH '" + QueryDBPath + ".db3' AS db2;";
                    cmd.ExecuteNonQuery();
                    cmd.CommandText = "ATTACH '" + QueryLibraryPairsDB + ".db3' AS dbPair;";
                    cmd.ExecuteNonQuery();


                    //This select statement is equivalent to if I had used inner joins between the tables.  This version is just in an older style.
                    cmd.CommandText = "SELECT main.Spectrum.mzList, main.Spectrum.charge, main.Spectrum.precursor, main.Spectrum.peptide, main.Files.path, " +
                                      "db2.QuerySpectrum.mzList, db2.QuerySpectrum.charge, db2.QuerySpectrum.precursor, db2.Files.path " +
                                      "FROM main.Spectrum, main.Files, db2.Files, db2.QuerySpectrum, dbPair.QueryLibraryPair " +
                                      "WHERE main.Spectrum.ID = dbPair.QueryLibraryPair.id_Library AND db2.QuerySpectrum.ID = dbPair.QueryLibraryPair.id_Query " +
                                      "AND db2.QuerySpectrum.codex = db2.Files.codex AND main.Spectrum.codex = main.Files.codex " +
                                      "AND dbPair.QueryLibraryPair.PeakMatchNumber<11;";

                    using (var reader = cmd.ExecuteReader(System.Data.CommandBehavior.SingleResult))
                    {
                        while (reader.Read())
                        {
                            Library oneLibrary = new Library(Convert.ToInt32(reader.GetString(1)), reader.GetString(3), reader.GetString(0).Split(',').Select(n => Convert.ToDouble(n)).ToArray(), reader.GetString(4), Convert.ToDouble(reader.GetString(2)));
                            Query   oneQuery   = new Query(Convert.ToInt32(reader.GetString(6)), reader.GetString(5).Split(',').Select(n => Convert.ToDouble(n)).ToArray(), reader.GetString(8), Convert.ToDouble(reader.GetString(7)));
                            listOfAllLibraries.Add(oneLibrary);
                            listOfAllQueries.Add(oneQuery);
                            if (listOfAllLibraries.Count % 50 == 0)
                            {
                                Console.WriteLine("processed: " + listOfAllLibraries.Count);
                            }
                            if (listOfAllLibraries.Count >= 500)
                            //if(listOfAllLibraries.Count %1000 ==0)
                            {
                                Binner.processor(listOfAllQueries, listOfAllLibraries);
                                listOfAllLibraries = new List <Library>();
                                listOfAllQueries   = new List <Query>();
                                // break;
                            }
                        }
                    }
                    Binner.sendToFile(outputFilename);
                }
                conn.Close();
            }
        }