예제 #1
0
        public static void WriteSpectrumAsRcode0(this IRawDataPlus rawFile, string filename)
        {
            int    idx_CHARGE      = rawFile.GetChargeIdx();
            int    firstScanNumber = rawFile.RunHeaderEx.FirstSpectrum;
            int    lastScanNumber  = rawFile.RunHeaderEx.LastSpectrum;
            int    charge          = -1;
            double pc = -1;

            using (System.IO.StreamWriter file =
                       new System.IO.StreamWriter(filename))
            {
                for (int scanNumber = firstScanNumber; scanNumber < lastScanNumber; scanNumber++)
                {
                    var scanTrailer    = rawFile.GetTrailerExtraInformation(scanNumber);
                    var scanStatistics = rawFile.GetScanStatsForScanNumber(scanNumber);
                    var scanEvent      = rawFile.GetScanEventForScanNumber(scanNumber);
                    var scanFilter     = rawFile.GetFilterForScanNumber(scanNumber);


                    try{
                        var reaction0 = scanEvent.GetReaction(0);
                        pc = reaction0.PrecursorMass;
                    }
                    catch {
                        pc = -1;
                    }

                    try{
                        charge = int.Parse(scanTrailer.Values.ToArray()[idx_CHARGE]);
                    }
                    catch {
                        charge = -1;
                    }

                    file.WriteLine("e$Spectrum[[{0}]] <- list(", scanNumber);
                    file.WriteLine("\tscan = {0};", scanNumber);
                    file.WriteLine("\tscanType = \"{0}\";", scanStatistics.ScanType.ToString());
                    file.WriteLine("\trtinseconds = {0};", Math.Round(scanStatistics.StartTime * 60 * 1000) / 1000);
                    file.WriteLine("\tprecursorMass = {0};", pc);
                    file.WriteLine("\tMSOrder = '{0}';", scanFilter.MSOrder.ToString());
                    file.WriteLine("\tcharge = {0}", charge);
                    file.WriteLine(")");
                }
            }
        }
예제 #2
0
        public static void GetIndex(this IRawDataPlus rawFile)
        {
            int firstScanNumber = rawFile.RunHeaderEx.FirstSpectrum;
            int lastScanNumber  = rawFile.RunHeaderEx.LastSpectrum;

            int idx_CHARGE = rawFile.GetChargeIdx();

            double charge, precursorMass;

            Console.WriteLine("scan;scanType;rtinseconds;precursorMass;MSOrder;charge");

            for (int scanNumber = firstScanNumber; scanNumber < lastScanNumber; scanNumber++)
            {
                var scanTrailer    = rawFile.GetTrailerExtraInformation(scanNumber);
                var scanStatistics = rawFile.GetScanStatsForScanNumber(scanNumber);
                var scanEvent      = rawFile.GetScanEventForScanNumber(scanNumber);
                var scanFilter     = rawFile.GetFilterForScanNumber(scanNumber);

                try{
                    var reaction0 = scanEvent.GetReaction(0);
                    precursorMass = reaction0.PrecursorMass;
                } catch {
                    precursorMass = -1;
                }

                try{
                    charge = int.Parse(scanTrailer.Values.ToArray()[idx_CHARGE]);
                } catch {
                    charge = -1;
                }

                Console.WriteLine("{0};{1};{2};{3};{4};{5}", scanNumber,
                                  scanStatistics.ScanType.ToString(),
                                  Math.Round(scanStatistics.StartTime * 60 * 1000) / 1000,
                                  precursorMass,
                                  scanFilter.MSOrder.ToString(),
                                  charge);
            }
        }