コード例 #1
0
        public MSAmandaSearchWrapper()
        {
            Settings = new MSAmandaSettings();
            helper   = new MSHelper();
            helper.InitLogWriter(_baseDir.DirPath);
            helper.SearchProgressChanged += Helper_SearchProgressChanged;
            var folderForMappings = Path.Combine(_baseDir.DirPath, AmandaMap);

            // creates dir if not existing
            Directory.CreateDirectory(folderForMappings);
            mzID = new OutputMzid(folderForMappings);
            AvailableSettings                  = new SettingsFile(helper, Settings, mzID);
            AvailableSettings.AllEnzymes       = new List <MSAmandaEnzyme>();
            AvailableSettings.AllModifications = new List <Modification>();

            using (var d = new CurrentDirectorySetter(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)))
            {
                if (!AvailableSettings.ParseEnzymeFile(ENZYME_FILENAME, "", AvailableSettings.AllEnzymes))
                {
                    throw new Exception(string.Format(Resources.DdaSearch_MSAmandaSearchWrapper_enzymes_file__0__not_found, ENZYME_FILENAME));
                }
                if (!AvailableSettings.ParseUnimodFile(UNIMOD_FILENAME, AvailableSettings.AllModifications))
                {
                    throw new Exception(string.Format(Resources.DdaSearch_MSAmandaSearchWrapper_unimod_file__0__not_found, UNIMOD_FILENAME));
                }
                if (!AvailableSettings.ParseOboFiles())
                {
                    throw new Exception(Resources.DdaSearch_MSAmandaSearchWrapper_Obo_files_not_found);
                }
                if (!AvailableSettings.ReadInstrumentsFile(INSTRUMENTS_FILENAME))
                {
                    throw new Exception(string.Format(Resources.DdaSearch_MSAmandaSearchWrapper_Instruments_file_not_found, INSTRUMENTS_FILENAME));
                }
            }

            AdditionalSettings = new Dictionary <string, Setting>
            {
                { MAX_LOADED_PROTEINS_AT_ONCE, new Setting(MAX_LOADED_PROTEINS_AT_ONCE, 100000, 10, int.MaxValue) },
                { MAX_LOADED_SPECTRA_AT_ONCE, new Setting(MAX_LOADED_SPECTRA_AT_ONCE, 10000, 100, int.MaxValue) }
            };

            CurrentFile = 0;
        }