Exemplo n.º 1
0
        for isotopelabel_id, data in allsumionratiodata.iteritems():
            allfractionbgratios[isotopelabel_id] = np.median(data)
        # second normalization so that the bg-ratios all add to 1
        for isotopelabel_id, data in allfractionbgratios.iteritems():
            allfractionbgratios[isotopelabel_id] = data / sum(allfractionbgratios.values())
        logger.log.debug(('allfractionbgratios are %s' % str(allfractionbgratios)))
        for corrects2iquantob in corrects2iquantoblist:
            # perform correction for each of the analyzed .hdf5 files.
            s2icorrecteddata = corrects2iquantob.performS2Icorrection(allfractionbgratios)
            corrects2iquantob.hdf5corrects2iquant.updates2ivalues(s2icorrecteddata)
            hdf5corrects2iquant.close()

    except ExHa.czException as czEx:
        ExHa.reformatException(czEx)
        ExHa.addContext(czEx, 'Error during corrects2iquant run')
        ExHa.exportError2File(czEx, cfg.parameters['runtime']['datadir'] / Path('errors.error'))
        if logger:
            logger.log.warning(ExHa.oneLineRepr(czEx))
        else:
            print ExHa.multiLineRepr(czEx)

    except Exception as genEx:

        ExHa.reformatException(genEx)
        ExHa.addContext(genEx, 'Error during corrects2iquant run')
        ExHa.exportError2File(genEx, cfg.parameters['runtime']['datadir'] / 'errors.error')
        if logger:
            logger.log.warning(ExHa.oneLineRepr(genEx))
        else:
            print ExHa.multiLineRepr(genEx)
Exemplo n.º 2
0
    ret = cfg.evaluateCommandLineArgs(sys.argv)

    try:
        cfg.scalePpmMda()
        dataDir = cfg.parameters['runtime']['datadir']

        logParam = cfg.parameters['logging']
        logPath = Path(dataDir.joinpath(logParam['logdir']))
        if not logPath.exists():
            logPath.mkdir(parents=True)
        logFile = logPath.joinpath(logParam['logfile'])

        logger = Logger(logFile, logParam['loglevel'], logParam['screenlevel'],
                        False)
        logger.setMascotParserLogs()

        jobcontrol(cfg, logger)

    except ExHa.UsageError as useEx:
        ExHa.reformatException(useEx)
        print useEx.context
    except Exception as genEx:
        ExHa.reformatException(genEx)
        errorFile = Path(cfg.parameters['runtime']['hdf5file']).stem + '.error'
        ExHa.exportError2File(
            genEx, cfg.parameters['runtime']['datadir'].joinpath(errorFile))
        if logs:
            logs.datlog.warning(ExHa.oneLineRepr(genEx))
        else:
            print ExHa.multiLineRepr(genEx)
Exemplo n.º 3
0
                        importer.importData.mascot_matched_spectra)
        logger.log.info('Total Spectra Matched = %6i' %
                        importer.importData.spectra_in_qc_proteins)
        logger.log.info('Total Spectra w Quant = %6i' %
                        importer.importData.quantified_spectra)
        logger.log.info('Total Spectra All Rep = %6i' %
                        importer.importData.numSpectraAllReporters)

        times = sw.stop()
        logger.log.info(sw.format())

        hdf5results.close()

    except ExHa.UsageError as useEx:
        ExHa.reformatException(useEx)
        logger.log.warning(ExHa.oneLineRepr(useEx))
    except Exception as genEx:
        # error
        if logger:
            logger.log.warning(ExHa.oneLineRepr(genEx))
            print ExHa.multiLineRepr(genEx)
        else:
            print ExHa.multiLineRepr(genEx)
        if cfg:
            ExHa.exportError2File(genEx,
                                  dataDir.joinpath(resultfile.stem + '.error'))
        else:
            ExHa.exportError2File(genEx, dataDir.joinpath('errors.error'))

        sys.exit(ExHa.oneLineRepr(genEx))
Exemplo n.º 4
0
Arquivo: mgf.py Projeto: hdinkel/isob
        for f in dataDir.glob(fileFilter):
            if not f.is_file():
                # skip any directories
                continue

            # if f.name[:4] in ['6528', '1814', '2032']: continue
            mgf = mgftools(f)
            logger.log.info('Filename:     %s' % f.name)
            if hcdOnly:
                logger.log.info('Export HCD data only')
            else:
                logger.log.info('Using filters: %s' % str(mgf.usefilts))
            rtn = mgf.export(hcdOnly)
            mgf.close()
        if f == 0:
            raise ExHa.MGFprocessingError('no files found for: %s' %
                                          str(dataDir / fileFilter))

    except ExHa.UsageError as useEx:
        ExHa.reformatException(useEx)
        logger.log.info(useEx.context)
    except Exception, genEx:
        ExHa.reformatException(genEx)
        if f:
            ExHa.exportError2File(genEx, f.parent.joinpath(f.stem + '.error'))
        else:
            ExHa.exportError2File(genEx, dataDir.joinpath('errors.error'))
        logger.log.info(ExHa.multiLineRepr(genEx))

    logger.log.info('finished')
Exemplo n.º 5
0
from CommonUtils.LoggingManager import Logger
from CommonUtils.hdf5Base import hdf5Base
from CommonUtils.QuantMethodHandler import QuantMethods
import CommonUtils.ExceptionHandler as ExHa

# pyMSsafe modules
try:
    from xRawFile import XRawFile
except ImportError, ieEx:
    ExHa.reformatException(ieEx)
    ExHa.addContext(ieEx, 'Xcalibur not set up properly')
    configPath = './pymssafe.cfg'
    cfg = pyMSsafeConfigManager(configPath)
    ret = cfg.evaluateCommandLineArgs(sys.argv)
    dataDir = cfg.parameters['runtime']['datadir']
    ExHa.exportError2File(ieEx, dataDir.joinpath('errors.error'))

from datastore import Datamanager


class pymssafe:
    def __init__(self, config):
        """
        @brief initiaise pyMSsafe controller
        @param mode <string>: operational mode of the application
        """

        self.cfg = config

        dataDir = cfg.parameters['runtime']['datadir']
        logParam = cfg.parameters['logging']