def register_thermo_com(path=None): '''Register an installed MSFileReader or XRawFile DLL. Searches the standard installation paths, but the `--path` option can be used to specify additional search paths. ''' if path is None: path = [] try: import comtypes except ImportError: click.secho("comtypes not installed", fg='yellow') raise click.ClickException( "This feature requires the comtypes library. Please install it.") import logging from ms_deisotope.data_source._vendor.MSFileReader import _register_dll, log, DLL_IS_LOADED from ms_deisotope.data_source.thermo_raw import determine_if_available if DLL_IS_LOADED: click.secho("DLL Already Registered and Loaded") return if log is not None: log.addHandler(logging.StreamHandler()) log.setLevel('DEBUG') result = _register_dll(path) if result: click.secho("DLL Registration Successful") if determine_if_available(): click.secho("DLL Load Succesful", fg='cyan') if path is not None: config = get_config() config['vendor_readers']['thermo-com'].extend(path) save_config(config) else: click.secho("DLL Load Unsuccessful", fg='red') else: click.secho("DLL Registration Unsuccessful") if log is not None: log.handlers = log.handlers[:-1]
ScanAcquisitionInformation, ScanEventInformation, ScanWindow, component, ComponentGroup, InstrumentInformation, FileInformation, MultipleActivationInformation, ScanFileMetadataBase) from .metadata.activation import (supplemental_term_map, dissociation_methods_map) from .metadata.file_information import (MS_MS1_Spectrum, MS_MSn_Spectrum) from ms_deisotope.utils import Base try: from ms_deisotope.data_source._vendor.MSFileReader import ( ThermoRawfile as _ThermoRawFileAPI, register_dll, log as _api_logger) comtypes_logger = logging.getLogger("comtypes") comtypes_logger.setLevel("INFO") _api_logger.setLevel("INFO") def is_thermo_raw_file(path): try: _ThermoRawFileAPI(path) return True except (WindowsError, IOError, ImportError): return False def infer_reader(path): if is_thermo_raw_file(path): return ThermoRawLoader raise ValueError("Not Thermo Raw File") def determine_if_available(): try:
from ms_deisotope.data_source.common import ( ScanDataSource, ScanIterator, RandomAccessScanSource, Scan, PrecursorInformation, ScanBunch, ChargeNotProvided, ActivationInformation) from ms_deisotope.utils import Base try: from ms_deisotope.data_source._vendor.MSFileReader import ( ThermoRawfile as _ThermoRawFileAPI, register_dll, log as _api_logger) comtypes_logger = logging.getLogger("comtypes") comtypes_logger.setLevel("INFO") _api_logger.setLevel("INFO") def is_thermo_raw_file(path): try: _ThermoRawFileAPI(path) return True except (WindowsError, IOError, ImportError): return False def infer_reader(path): if is_thermo_raw_file(path): return ThermoRawLoader raise ValueError("Not Thermo Raw File") def determine_if_available(): try: