Exemplo n.º 1
0
        public void TestMs1Filter()
        {
            var methodName = MethodBase.GetCurrentMethod().Name;

            Utils.ShowStarting(methodName);

            // QC_Shew
            const string specFilePath  = @"D:\MassSpecFiles\training\raw\QC_Shew_Intact_26Sep14_Bane_C2Column3.pbf";
            const string ms1FtFileName = @"D:\MassSpecFiles\training\raw\QC_Shew_Intact_26Sep14_Bane_C2Column3.ms1ft";
            const string idFilePath    = @"D:\MassSpecFiles\training\IcTda\QC_Shew_Intact_26Sep14_Bane_C2Column3_IcTda.tsv";

            if (!File.Exists(specFilePath))
            {
                Assert.Ignore(@"Skipping test {0} since file not found: {1}", methodName, specFilePath);
            }

            if (!File.Exists(idFilePath))
            {
                Assert.Ignore(@"Skipping test {0} since file not found: {1}", methodName, idFilePath);
            }

            var run           = PbfLcMsRun.GetLcMsRun(specFilePath);
            var massTolerance = new Tolerance(10);

            var ms1ftFilter = new Ms1FtFilter(run, massTolerance, ms1FtFileName);
            var n           = 0;
            var ms2ScanNums = run.GetScanNumbers(2);

            foreach (var ms2ScanNum in ms2ScanNums)
            {
                var matchingMass = ms1ftFilter.GetMatchingMass(ms2ScanNum);
                n += matchingMass.Count();
            }

            Console.WriteLine("{0} / {1}", n, ms2ScanNums.Count);

            /*
             * var tsvReader = new TsvFileParser(idFilePath);
             *
             * for (var i = 0; i < tsvReader.NumData; i++)
             * {
             *  var qv = double.Parse(tsvReader.GetData("QValue")[i]);
             *  if (qv > 0.01) break;
             *
             *  var scan = int.Parse(tsvReader.GetData("Scan")[i]);
             *  var charge = int.Parse(tsvReader.GetData("Charge")[i]);
             *  var mass = double.Parse(tsvReader.GetData("Mass")[i]);
             *
             *  if (mass > 15000) continue;
             *
             *  var seq = tsvReader.GetData("Sequence")[i];
             *  var mod = tsvReader.GetData("Modifications")[i];
             *  var nMatched = int.Parse(tsvReader.GetData("#MatchedFragments")[i]);
             *
             *  var hit = false;
             *  foreach (var ms2Scan in ms1ftFilter.GetMatchingMs2ScanNums(mass))
             *  {
             *      if (ms2Scan == scan)
             *      {
             *          hit = true;
             *          break;
             *      }
             *  }
             *
             *  if (!hit)
             *  {
             *      Console.WriteLine("{0}\t{1}\t{2}", scan, mass, nMatched);
             *  }
             * }*/
        }