Run a CWL preparation pipeline.
420472
def run(args):
    
    dirs, config, run_info_yaml = run_info.prep_system(args.sample_config, args.systemconfig)
    integrations = args.integrations if hasattr(args, "integrations") else {}
    world = run_info.organize(dirs, config, run_info_yaml, is_cwl=True, integrations=integrations)
    create.from_world(world, run_info_yaml, integrations=integrations, add_container_tag=args.add_container_tag)
66155
def runner(self):
        
        logging.info('Starting {} analysis pipeline'.format(self.analysistype))
        if not self.pipeline:
            general = None
            for sample in self.runmetadata.samples:
                general = getattr(sample, 'general')
            if general is None:
                # Create the objects to be used in the analyses
                objects = Objectprep(self)
                objects.objectprep()
                self.runmetadata = objects.samples
        # Run the analyses
        Sippr(self, self.cutoff)
        # Create the reports
        reports = Reports(self)
        Reports.reporter(reports, analysistype=self.analysistype)
        # Print the metadata
        MetadataPrinter(self)
76573
function setupPipeline() {
      var deps = bundler.pipeline.get('deps');
      deps.push(getCache(deps._streams[0].cache));
    }
1028159
def runner(self):
        
        if os.path.isfile(self.report):
            self.report_parse()
        else:
            logging.info('Starting {} analysis pipeline'.format(self.analysistype))
            # Create the objects to be used in the analyses (if required)
            general = None
            for sample in self.runmetadata.samples:
                general = getattr(sample, 'general')
            if general is None:
                # Create the objects to be used in the analyses
                objects = Objectprep(self)
                objects.objectprep()
                self.runmetadata = objects.samples
            # Run the analyses
            MLSTmap(self, self.analysistype, self.cutoff)
            # Create the reports
            self.reporter()
            # Print the metadata to a .json file
            MetadataPrinter(self)
128382
def start_pipeline(conf, args):
    """"""
    host = conf.config['instances'][args.host_instance]
    url = api.build_pipeline_url(build_instance_url(host))
    auth = tuple([conf.creds['instances'][args.host_instance]['user'], conf.creds['instances'][args.host_instance]['pass']])
    runtime_parameters = {}
    verify_ssl = host.get('verify_ssl', True)
    if args.runtime_parameters:
        runtime_parameters = json.loads(args.runtime_parameters)
    start_result = api.start_pipeline(url, args.pipeline_id, auth, verify_ssl, runtime_parameters)

    return start_result
695539
def _organize_tools_on(data, is_cwl):
    
    # want tools_on: [gvcf] if joint calling specified in CWL
    if is_cwl:
        if tz.get_in(["algorithm", "jointcaller"], data):
            val = tz.get_in(["algorithm", "tools_on"], data)
            if not val:
                val = []
            if not isinstance(val, (list, tuple)):
                val = [val]
            if "gvcf" not in val:
                val.append("gvcf")
            data["algorithm"]["tools_on"] = val
    return data
261298
def run(self):
        """"""
        flag = True
        if self._exeng == 'dpkt':
            flag, engine = self.import_test('dpkt', name='DPKT')
            if flag:
                return self._run_dpkt(engine)
        elif self._exeng == 'scapy':
            flag, engine = self.import_test('scapy.all', name='Scapy')
            if flag:
                return self._run_scapy(engine)
        elif self._exeng == 'pyshark':
            flag, engine = self.import_test('pyshark', name='PyShark')
            if flag:
                return self._run_pyshark(engine)
        elif self._exeng == 'pipeline':
            flag, engine = self.import_test('multiprocessing', name='Pipeline Multiprocessing')
            self._flag_m = flag = bool(flag and (self._flag_a and CPU_CNT > 1))
            if self._flag_m:
                return self._run_pipeline(engine)
            warnings.warn(f'extraction engine Pipeline Multiprocessing is not available; '
                          'using default engine instead', EngineWarning, stacklevel=stacklevel())
        elif self._exeng == 'server':
            flag, engine = self.import_test('multiprocessing', name='Server Multiprocessing')
            self._flag_m = flag = bool(flag and (self._flag_a and CPU_CNT > 2))
            if self._flag_m:
                return self._run_server(engine)
            warnings.warn(f'extraction engine Server Multiprocessing is not available; '
                          'using default engine instead', EngineWarning, stacklevel=stacklevel())
        elif self._exeng not in ('default', 'pcapkit'):
            flag = False
            warnings.warn(f'unsupported extraction engine: {self._exeng}; '
                          'using default engine instead', EngineWarning, stacklevel=stacklevel())

        # using default/pcapkit engine
        self._exeng = self._exeng if flag else 'default'
        self.record_header()            # read PCAP global header
        self.record_frames()
374091
def from_cwl(cls, data, __reference__=None):
        """"""
        class_name = data.get('class', None)
        cls = cls.registry.get(class_name, cls)

        if __reference__:
            with with_reference(__reference__):
                self = cls(
                    **{k: v
                       for k, v in iteritems(data) if k != 'class'}
                )
        else:
            self = cls(**{k: v for k, v in iteritems(data) if k != 'class'})
        return self
1247634
def cli(ctx, amount, index, stage):
    """"""
    ctx.obj.say_green('Starting Streaming Pipe')
    res_pull = ctx.invoke(pull, amount=amount, index=index, stage=stage)
    res_tra = False
    if res_pull:
        # amount to transform can be less (or more)
        res_tra = ctx.invoke(
            transform, amount=amount, index=index, stage=stage)
    if res_tra:
        # amount to push can be less (or more)
        res_push = ctx.invoke(push, amount=amount, index=index, stage=stage)
    if res_pull and res_tra and res_push:
        ctx.obj.say_green('Streaming Pipe finsished')
        return True
    return False
1364958
def write_workflow(self, request, opts, cwd, wftype='cwl'):
        """"""

        workflow_url = request.get("workflow_url")

        # link the cwl and json into the cwd
        if workflow_url.startswith('file://'):
            os.link(workflow_url[7:], os.path.join(cwd, "wes_workflow." + wftype))
            workflow_url = os.path.join(cwd, "wes_workflow." + wftype)
        os.link(self.input_json, os.path.join(cwd, "wes_input.json"))
        self.input_json = os.path.join(cwd, "wes_input.json")

        extra_options = self.sort_toil_options(opts.getoptlist("extra"))
        if wftype == 'cwl':
            command_args = ['toil-cwl-runner'] + extra_options + [workflow_url, self.input_json]
        elif wftype == 'wdl':
            command_args = ['toil-wdl-runner'] + extra_options + [workflow_url, self.input_json]
        elif wftype == 'py':
            command_args = ['python'] + extra_options + [workflow_url]
        else:
            raise RuntimeError('workflow_type is not "cwl", "wdl", or "py": ' + str(wftype))

        return command_args
452782
function runProtractorAoT(appDir, outputFile) {
  fs.appendFileSync(outputFile, '++ AoT version ++\n');
  const aotBuildSpawnInfo = spawnExt('yarn', ['build:aot'], {cwd: appDir});
  let promise = aotBuildSpawnInfo.promise;

  const copyFileCmd = 'copy-dist-files.js';
  if (fs.existsSync(appDir + '/' + copyFileCmd)) {
    promise = promise.then(() => spawnExt('node', [copyFileCmd], {cwd: appDir}).promise);
  }
  const aotRunSpawnInfo = spawnExt('yarn', ['serve:aot'], {cwd: appDir}, true);
  return runProtractorSystemJS(promise, appDir, aotRunSpawnInfo, outputFile);
}
40863
def run(self):
        
        for build_dir in self.build_dirs:
            if os.path.isdir(build_dir):
                sys.stdout.write('Removing %s%s' % (build_dir, os.linesep))
                shutil.rmtree(build_dir)

        for (root, dirs, files) in os.walk(self.cwd):
            for name in files:
                fullpath = os.path.join(root, name)
                if any(fullpath.endswith(ext) for ext in self.build_artifacts):
                    sys.stdout.write('Removing %s%s' % (fullpath, os.linesep))
                    os.remove(fullpath)
853644
def run(self):
        

        # download and compile solvers
        prepare.do(to_install)

        # now, do standard build
        distutils.command.build.build.run(self)
1012599
def run(cls, command, cwd=".", **kwargs):
        
        assert isinstance(command, six.string_types)
        command_result = CommandResult()
        command_result.command = command
        use_shell = cls.USE_SHELL
        if "shell" in kwargs:
            use_shell = kwargs.pop("shell")

        # -- BUILD COMMAND ARGS:
        if six.PY2 and isinstance(command, six.text_type):
            # -- PREPARE-FOR: shlex.split()
            # In PY2, shlex.split() requires bytes string (non-unicode).
            # In PY3, shlex.split() accepts unicode string.
            command = codecs.encode(command, "utf-8")
        cmdargs = shlex.split(command)

        # -- TRANSFORM COMMAND (optional)
        command0 = cmdargs[0]
        real_command = cls.COMMAND_MAP.get(command0, None)
        if real_command:
            cmdargs0 = real_command.split()
            cmdargs = cmdargs0 + cmdargs[1:]
        preprocessors = cls.PREPROCESSOR_MAP.get(command0)
        if preprocessors:
            cmdargs = cls.preprocess_command(preprocessors, cmdargs, command, cwd)


        # -- RUN COMMAND:
        try:
            process = subprocess.Popen(cmdargs,
                            stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE,
                            universal_newlines=True,
                            shell=use_shell,
                            cwd=cwd, **kwargs)
            out, err = process.communicate()
            if six.PY2: # py3: we get unicode strings, py2 not
                default_encoding = 'UTF-8'
                out = six.text_type(out, process.stdout.encoding or default_encoding)
                err = six.text_type(err, process.stderr.encoding or default_encoding)
            process.poll()
            assert process.returncode is not None
            command_result.stdout = out
            command_result.stderr = err
            command_result.returncode = process.returncode
            if cls.DEBUG:
                print("shell.cwd={0}".format(kwargs.get("cwd", None)))
                print("shell.command: {0}".format(" ".join(cmdargs)))
                print("shell.command.output:\n{0};".format(command_result.output))
        except OSError as e:
            command_result.stderr = u"OSError: %s" % e
            command_result.returncode = e.errno
            assert e.errno != 0

        postprocessors = cls.POSTPROCESSOR_MAP.get(command0)
        if postprocessors:
            command_result = cls.postprocess_command(postprocessors, command_result)
        return command_result
1131907
def run(self, tokens):
        """"""
        for fn in self._stack:
            results = []
            for i, token in enumerate(tokens):
                # JS ignores additional arguments to the functions but we
                # force pipeline functions to declare (token, i, tokens)
                # or *args
                result = fn(token, i, tokens)
                if not result:
                    continue
                if isinstance(result, (list, tuple)):  # simulate Array.concat
                    results.extend(result)
                else:
                    results.append(result)
            tokens = results

        return tokens
606066
def main(folder):
    """"""
    raw_datapath, outputpath, p_queue = get_parameters(folder)
    create_preprocessed_dataset(raw_datapath, outputpath, p_queue)
    utils.create_run_logfile(folder)
776306
def prepare(self):
        """"""
        self.target = self.fn
        self.targetheader = reader.get_tsv_header(self.target)
        self.decoyheader = reader.get_tsv_header(self.decoyfn)