Ejemplo n.º 1
0
        public void Mono3()
        {
            MzXmlReader reader = new MzXmlReader();

            reader.Open("data/orbixl-mini.mzxml");
            var  scans      = new List <Scan>();
            Scan ms2Scan    = new Scan();
            Scan parentScan = new Scan();

            GetBlock(reader, 3, ref ms2Scan, ref parentScan, ref scans);
            MonocleOptions options = new MonocleOptions();

            Monocle.Run(scans, parentScan, ms2Scan.Precursors[0], options);
            Assert.Equal(869.449817, ms2Scan.Precursors[0].Mz, 3);
        }
Ejemplo n.º 2
0
        public void Mono2()
        {
            MzXmlReader reader = new MzXmlReader();

            reader.Open("data/orbixl-mini.mzxml", new ScanReaderOptions());
            var  scans      = new List <Scan>();
            Scan ms2Scan    = new Scan();
            Scan parentScan = new Scan();

            GetBlock(reader, 2, ref ms2Scan, ref parentScan, ref scans);
            MonocleOptions options = new MonocleOptions();

            Monocle.Run(scans, parentScan, ms2Scan.Precursors[0], options);
            Assert.Equal(1009.98842, ms2Scan.Precursors[0].Mz, 2);
        }
Ejemplo n.º 3
0
        public void WindowTest()
        {
            MzXmlReader reader = new MzXmlReader();

            reader.Open("data/orbixl-mini.mzxml");
            var scans = new List <Scan>();

            foreach (Scan scan in reader)
            {
                scans.Add(scan);
            }
            MonocleOptions options = new MonocleOptions();

            options.AveragingVector            = AveragingVector.Both;
            options.Number_Of_Scans_To_Average = 6;
            var nearby = Monocle.GetNearbyScans(ref scans, scans[scans[10].PrecursorMasterScanNumber - 1], options);

            Assert.Equal(13, nearby.Count);
        }
Ejemplo n.º 4
0
        public void MonoAll()
        {
            MzXmlReader reader = new MzXmlReader();

            reader.Open("data/orbixl-mini.mzxml");
            var scans = new List <Scan>();

            foreach (Scan scan in reader)
            {
                scans.Add(scan);
            }
            MonocleOptions options = new MonocleOptions();

            options.AveragingVector = AveragingVector.Both;
            Monocle.Run(ref scans, options);

            Assert.Equal(687.39195, scans[10].Precursors[0].Mz, 3);
            Assert.Equal(1009.98842, scans[31].Precursors[0].Mz, 2);
            Assert.Equal(869.449817, scans[52].Precursors[0].Mz, 3);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Reset Monocle Options to a new set
 /// </summary>
 /// <param name="newOptions"></param>
 public void ResetMonocleOptions(MonocleOptions newOptions)
 {
     monocleOptions = null;
     monocleOptions = newOptions;
 }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            var             parser         = new CliOptionsParser();
            MakeMonoOptions options        = parser.Parse(args);
            MonocleOptions  monocleOptions = new MonocleOptions
            {
                AveragingVector            = options.AveragingVector,
                Charge_Detection           = options.ChargeDetection,
                Charge_Range               = new ChargeRange(options.ChargeRange),
                MS_Level                   = options.MS_Level,
                Number_Of_Scans_To_Average = options.NumOfScans,
                WriteDebugString           = options.WriteDebug,
                OutputFileType             = options.OutputFileType,
                ConvertOnly                = options.ConvertOnly,
                SkipMono                   = options.SkipMono,
                ChargeRangeUnknown         = new ChargeRange(options.ChargeRangeUnknown),
                ForceCharges               = options.ForceCharges,
                UseMostIntense             = options.UseMostIntense
            };

            SetupLogger(options.RunQuiet, options.WriteDebug);

            try
            {
                log.Info("Starting Processing.");
                string      file   = options.InputFilePath;
                IScanReader reader = ScanReaderFactory.GetReader(file);
                reader.Open(file);
                var header = reader.GetHeader();
                header.FileName = Path.GetFileName(file);

                log.Info("Reading scans: " + file);
                List <Scan> Scans = new List <Scan>();
                foreach (Scan scan in reader)
                {
                    Scans.Add(scan);
                }

                if (!monocleOptions.ConvertOnly)
                {
                    log.Info("Starting monoisotopic assignment.");
                    Monocle.Monocle.Run(ref Scans, monocleOptions);
                }

                string outputFilePath = options.OutputFilePath.Trim();
                if (outputFilePath.Length == 0)
                {
                    outputFilePath = ScanWriterFactory.MakeTargetFileName(file, monocleOptions.OutputFileType);
                }
                log.Info("Writing output: " + outputFilePath);
                IScanWriter writer = ScanWriterFactory.GetWriter(monocleOptions.OutputFileType);
                writer.Open(outputFilePath);
                writer.WriteHeader(header);
                foreach (Scan scan in Scans)
                {
                    writer.WriteScan(scan);
                }
                writer.Close();
                log.Info("Done.");
            }
            catch (Exception e)
            {
                log.Error("An error occurred.");
                log.Debug(e.GetType().ToString());
                log.Debug(e.Message);
                log.Debug(e.ToString());
            }
        }