Пример #1
0
 def __init__(self):
     submod = get_service_name() or 'kb_fastqc'
     self.userlog = log.log(submod,
                            ip_address=True,
                            authuser=True,
                            module=True,
                            method=True,
                            call_id=True,
                            changecallback=self.logcallback,
                            config=get_config_file())
     self.serverlog = log.log(submod,
                              ip_address=True,
                              authuser=True,
                              module=True,
                              method=True,
                              call_id=True,
                              logfile=self.userlog.get_log_file())
     self.serverlog.set_log_level(6)
     self.rpc_service = JSONRPCServiceCustom()
     self.method_authentication = dict()
     self.rpc_service.add(impl_kb_fastqc.runFastQC,
                          name='kb_fastqc.runFastQC',
                          types=[dict])
     self.method_authentication['kb_fastqc.runFastQC'] = 'required'  # noqa
     self.rpc_service.add(impl_kb_fastqc.status,
                          name='kb_fastqc.status',
                          types=[dict])
     authurl = config.get(AUTH) if config else None
     self.auth_client = _KBaseAuth(authurl)
Пример #2
0
    def setUpClass(cls):
        token = environ.get('KB_AUTH_TOKEN', None)
        config_file = environ.get('KB_DEPLOYMENT_CONFIG', None)
        cls.cfg = {}
        config = ConfigParser()
        config.read(config_file)
        for nameval in config.items('kb_fastqc'):
            cls.cfg[nameval[0]] = nameval[1]
        authServiceUrl = cls.cfg.get(
            'auth-service-url',
            "https://kbase.us/services/authorization/Sessions/Login")
        auth_client = _KBaseAuth(authServiceUrl)
        user_id = auth_client.get_user(token)
        # WARNING: don't call any logging methods on the context object,
        # it'll result in a NoneType error
        cls.ctx = MethodContext(None)
        cls.ctx.update({
            'token':
            token,
            'user_id':
            user_id,
            'provenance': [{
                'service': 'kb_fastqc',
                'method': 'please_never_use_it_in_production',
                'method_params': []
            }],
            'authenticated':
            1
        })
        cls.wsURL = cls.cfg['workspace-url']
        cls.wsClient = workspaceService(cls.wsURL, token=token)
        cls.serviceImpl = kb_fastqc(cls.cfg)

        #retrieve and setup test files
        test_fq_filename = "test_1.fastq.gz"
        output = subprocess.check_output([
            "curl", "-o", test_fq_filename,
            "http://bioseed.mcs.anl.gov/~seaver/Files/Sample_Reads/WT1_S1_L001_R2_001.fastq.gz"
        ])
        cls.large_fq_test_file1 = os.path.join(cls.cfg['scratch'],
                                               test_fq_filename)
        shutil.copy(test_fq_filename, cls.large_fq_test_file1)

        fq_filename = "interleaved.fq"
        cls.small_fq_test_file2 = os.path.join(cls.cfg['scratch'], fq_filename)
        shutil.copy(os.path.join("data", fq_filename), cls.small_fq_test_file2)