Exemplo n.º 1
0
    def setUp(self):
        self.logger = create_logger(__name__, 'ERROR')

        self.pathway = rpPathway.from_rpSBML(
            infile=self.rpsbml_path,
            logger=self.logger
        )
Exemplo n.º 2
0
 def setUp(self):
     self.logger = create_logger(__name__, 'ERROR')
     # Create persistent temp folder
     # to deflate compressed data file so that
     # it remains reachable outside of this method.
     # Has to remove manually it in tearDown() method
     self.temp_d = mkdtemp()
     self.rpsbml = rpSBML(inFile=self.e_coli_model_path, logger=self.logger)
Exemplo n.º 3
0
 def setUp(self):
     self.logger = create_logger(__name__, 'ERROR')
     self.rxn_1 = rpReaction(
         id='rxn_1',
         reactants={
             'MNXM188': 1,
             'MNXM4': 1,
             'MNXM6': 1,
             'MNXM1': 3
         },
         products={
             'CMPD_0000000004': 1,
             'CMPD_0000000003': 1,
             'MNXM13': 1,
             'MNXM15': 3,
             'MNXM5': 1
         },
     )
     self.rxn_2 = rpReaction(
         id='rxn_2',
         reactants={
             'MNXM4': 1,
             'CMPD_0000000003': 2
         },
         products={
             'MNXM1': 1,
             'TARGET_0000000001': 1
         },
     )
     self.rxn_3 = rpReaction(
         id='rxn_3',
         reactants={
             'CMPD_0000000004': 3,
             'MNXM4': 1,
             'MNXM6': 1
         },
         products={
             'MNXM13': 1,
             'MNXM5': 1
         },
     )
     self.reactions = [self.rxn_1, self.rxn_2, self.rxn_3]
     self.sto_mat_1 = [[-3.0, 1.0, 0.0], [-1.0, -1.0, -1.0],
                       [1.0, 0.0, 1.0], [3.0, 0.0, 0.0], [1.0, 0.0, -3.0],
                       [1.0, 0.0, 1.0], [0.0, 1.0, 0.0], [1.0, -2.0, 0.0],
                       [-1.0, 0.0, 0.0], [-1.0, 0.0, -1.0]]
Exemplo n.º 4
0
def _cli():
    parser = build_args_parser()
    args = parse_and_check_args(parser)

    if args.log.lower() in ['silent', 'quiet'] or args.silent:
        args.log = 'CRITICAL'

    # Store KNIME vars into a dictionary
    kvars = set_vars(args.kexec, args.kver, args.kpkg_install, args.kwf)

    # Print out configuration
    if not args.silent and args.log.lower() not in ['critical', 'error']:
        print_conf(kvars, prog=parser.prog)

    # Create logger
    logger = create_logger(parser.prog, args.log)

    logger.debug('args: ' + str(args))
    logger.debug('kvars: ' + str(kvars))

    r_code, result_files = retropath2(sink_file=args.sink_file,
                                      source_file=args.source_file,
                                      rules_file=args.rules_file,
                                      outdir=args.outdir,
                                      kvars=kvars,
                                      max_steps=args.max_steps,
                                      topx=args.topx,
                                      dmin=args.dmin,
                                      dmax=args.dmax,
                                      mwmax_source=args.mwmax_source,
                                      mwmax_cof=args.mwmax_cof,
                                      timeout=args.timeout,
                                      logger=logger)

    if r_code == 'OK' or r_code == 'TimeLimit':
        logger.info('{attr1}Results{attr2}'.format(attr1=attr('bold'),
                                                   attr2=attr('reset')))
        logger.info('   |- Checking... ')
        r_code = check_results(result_files, logger)
        logger.info('   |--path: ' + args.outdir)
    else:
        logger.error('Exiting...')

    return __ERROR_CODES__[r_code]
Exemplo n.º 5
0
def init(parser: ArgumentParser, args: Namespace) -> Logger:
    from brs_utils import create_logger
    from rptools._version import __version__

    if args.log.lower() in ['silent', 'quiet'] or args.silent:
        args.log = 'CRITICAL'

    # Create logger
    logger = create_logger(parser.prog, args.log)

    logger.info(
        '{color}{typo}rptools {version}{rst}{color} ({prog}){rst}\n'.format(
            prog=logger.name,
            version=__version__,
            color=fg('white'),
            typo=attr('bold'),
            rst=attr('reset')))
    logger.debug(args)

    return logger
Exemplo n.º 6
0
def init(parser: 'ArgumentParser', args: 'Namespace') -> Logger:
    from brs_utils import create_logger
    from rr_cache._version import __version__

    if args.log.lower() in ['silent', 'quiet'] or args.silent:
        args.log = 'CRITICAL'

    if args.log.lower() in ['silent', 'quiet', 'def_info'] or args.silent:
        disable_rdkit_logging()
        # # Disable RDKIT logging
        # from rdkit import RDLogger
        # RDLogger.DisableLog('rdApp.*')

    # Create logger
    logger = create_logger(parser.prog, args.log)

    logger.info('{color}{typo}rr_cache {version}{rst}{color}{rst}\n'.format(
        version=__version__,
        color=fg('white'),
        typo=attr('bold'),
        rst=attr('reset')))
    logger.debug(args)

    return logger
Exemplo n.º 7
0
 def setUp(self):
     self.logger = create_logger(__name__, 'ERROR')
Exemplo n.º 8
0
 def test_call(self):
     logger = create_logger('TEST', 'INFO')
     self.assertTrue(True)
Exemplo n.º 9
0
 def setUp(self, logger: Logger = None):
     if logger is None:
         self.logger = create_logger(__name__, 'ERROR')
     else:
         self.logger = logger