Ejemplo n.º 1
0
def register_thermo_com_net(path):
    '''Register a bundle of Thermo's RawFileReader library's DLLs. The `--path` option can
    be used to specify additional search paths.
    '''
    if path is None:
        path = []
    try:
        import clr
    except ImportError:
        click.secho("pythonnet not installed", fg='yellow')
        raise click.ClickException(
            "This feature requires the pythonnet library. Please install it.")
    from ms_deisotope.data_source.thermo_raw_net import _register_dll, _RawFileReader
    from ms_deisotope.data_source.thermo_raw_net import determine_if_available
    if _RawFileReader:
        click.secho("DLL Already Registered and Loaded")
        return
    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()
                rest = sorted(set(path) - set(config['vendor_readers']['thermo-net']))
                config['vendor_readers']['thermo-net'].extend(rest)
                save_config(config)
        else:
            click.secho("DLL Load Unsuccessful", fg='red')
    else:
        click.secho("DLL Registration Unsuccessful")
Ejemplo n.º 2
0
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]
Ejemplo n.º 3
0
import unittest
import platform

import numpy as np

from ms_deisotope.data_source.thermo_raw import (determine_if_available)
from ms_deisotope.test.common import datafile
from ms_deisotope.data_source import infer_type

not_windows = not platform.platform().lower().startswith("windows")
missing_reader_dll = not determine_if_available()


@unittest.skipIf(not_windows or missing_reader_dll, "Requires Windows COM")
class TestThermoRawLoaderScanBehavior(unittest.TestCase):
    path = datafile("small.RAW")

    reference_mzml = datafile("small.mzML")
    reference_mgf = datafile("small.mgf")

    @property
    def reader(self):
        return infer_type.MSFileLoader(self.path)

    def test_iteration(self):
        reader = self.reader
        reader.start_from_scan('controllerType=0 controllerNumber=1 scan=10')
        bunch = next(reader)
        assert bunch.precursor.id == 'controllerType=0 controllerNumber=1 scan=9'
        bunch = next(reader)
        assert bunch.precursor.id == 'controllerType=0 controllerNumber=1 scan=15'
Ejemplo n.º 4
0
import unittest
import platform

import numpy as np

from ms_deisotope.data_source.thermo_raw import (
    determine_if_available)
from ms_deisotope.data_source.thermo_raw_net import (
    determine_if_available as determine_if_available_net)
from ms_deisotope.test.common import datafile
from ms_deisotope.data_source import infer_type

not_windows = not platform.platform().lower().startswith("windows")
missing_reader_dll = not determine_if_available()
missing_net_dll = not determine_if_available_net()


class ThermoRawLoaderScanBehaviorBase(object):
    path = datafile("small.RAW")

    reference_mzml = datafile("small.mzML")
    reference_mgf = datafile("small.mgf")

    @property
    def reader(self):
        # return infer_type.MSFileLoader(self.path)
        raise NotImplementedError()

    def test_iteration(self):
        reader = self.reader
        reader.start_from_scan('controllerType=0 controllerNumber=1 scan=10')