Override of build_py.get_data_files that includes out of tree configs.
        These are currently hardcoded to include everything in
         ../shared-data/robot-data, which will move to
        opentrons/config/shared-data
973665
def _get_data_files(self):
        
        files = super()._get_data_files()
        # We don’t really want to duplicate logic used in the original
        # implementation, but we can back out what it did with commonpath -
        # should be something ending in opentrons
        build_base = os.path.commonpath([f[2] for f in files])
        # We want a list of paths to only files relative to ../shared-data
        to_include = get_shared_data_files()
        destination = os.path.join(build_base, DEST_BASE_PATH)
        # And finally, tell the system about our files
        files.append(('opentrons', SHARED_DATA_PATH,
                      destination, to_include))
        return files
806151
def build_job_configs(self, args):
        
        job_configs = {}

        components = Component.build_from_yamlfile(args['comp'])
        NAME_FACTORY.update_base_dict(args['data'])
        ret_dict = make_catalog_comp_dict(sources=args['library'], basedir='.')
        comp_info_dict = ret_dict['comp_info_dict']

        for split_ver, split_dict in comp_info_dict.items():
            for source_key, source_dict in split_dict.items():
                full_key = "%s_%s" % (split_ver, source_key)
                merged_name = "%s_%s" % (source_dict.catalog_info.catalog_name, source_key)
                if source_dict.model_type != 'CompositeSource':
                    continue

                for comp in components:
                    zcut = "zmax%i" % comp.zmax
                    key = "%s_%s" % (full_key, comp.make_key('{ebin_name}_{evtype_name}'))
                    name_keys = dict(zcut=zcut,
                                     sourcekey=full_key,
                                     ebin=comp.ebin_name,
                                     psftype=comp.evtype_name,
                                     coordsys=comp.coordsys,
                                     mktime='none',
                                     irf_ver=NAME_FACTORY.irf_ver())
                    nested_name_keys = dict(zcut=zcut,
                                            sourcekey=source_dict.catalog_info.catalog_name,
                                            ebin=comp.ebin_name,
                                            psftype=comp.evtype_name,
                                            coordsys=comp.coordsys,
                                            mktime='none',
                                            irf_ver=NAME_FACTORY.irf_ver())
                    outfile = NAME_FACTORY.srcmaps(**name_keys)
                    logfile = make_nfs_path(outfile.replace('.fits', '.log'))
                    job_configs[key] = dict(srcmaps=NAME_FACTORY.srcmaps(**nested_name_keys),
                                            expcube=NAME_FACTORY.ltcube(**name_keys),
                                            irfs=NAME_FACTORY.irfs(**name_keys),
                                            bexpmap=NAME_FACTORY.bexpcube(**name_keys),
                                            srcmdl=NAME_FACTORY.srcmdl_xml(**name_keys),
                                            merged=merged_name,
                                            outfile=outfile,
                                            outxml=NAME_FACTORY.nested_srcmdl_xml(**name_keys),
                                            logfile=logfile)

        return job_configs
758568
def _configure_dataset(self, data_root: str=None, download_urls: Iterable[str]=None, **kwargs) -> None:
        
        self._data_root = data_root
        self._download_urls = download_urls
220459
def read(self, config_dir=None, clear=False, config_file=None):
        

        if config_file:
            data_file = os.path.basename(config_file)
            data_path = os.path.dirname(config_file)

            if clear:
                self.clear()

            config = munge.load_datafile(data_file, data_path, default=None)

            if not config:
                raise IOError("Config file not found: %s" % config_file)

            munge.util.recursive_update(self.data, config)
            self._meta_config_dir = data_path
            return
        else:
            return super(Config, self).read(config_dir=config_dir, clear=clear)
1078270
def read(self, config_dir=None, config_name=None, clear=False):
        

# TODO should probably allow config_dir to be a list as well
        # get name of config directory
        if not config_dir:
            config_dir = self._defaults.get('config_dir', None)
        if not config_dir:
            raise KeyError('config_dir not set')

        # get name of config file
        if not config_name:
            config_name = self._defaults.get('config_name', None)
        if not config_name:
            raise KeyError('config_name not set')

        conf_path = os.path.expanduser(config_dir)
        if not os.path.exists(conf_path):
            raise IOError("config dir not found at %s" % (conf_path,))

        config = munge.load_datafile(config_name, conf_path, default=None)

        if not config:
            raise IOError("config file not found in %s" % (conf_path,))

        if clear:
            self.clear()

        munge.util.recursive_update(self.data, config)
        self._meta_config_dir = conf_path
        return self
25204
function (buildConfig) {
        var src;
        if (buildConfig.nodeProject) {
            src = '<%=buildConfig.libDirectory%>/**/*.js';
        } else if (buildConfig.bowerJSON) {
            src = buildConfig.bowerJSON.main;
        }

        return src;
    }
685371
def _write_config_file(items, global_vars, template, project_name, out_dir,
                       remotes):
    
    config_dir = utils.safe_makedir(os.path.join(out_dir, "config"))
    out_config_file = os.path.join(config_dir, "%s.yaml" % project_name)
    out = {"fc_name": project_name,
           "upload": {"dir": "../final"},
           "details": items}
    if remotes.get("base"):
        r_base = objectstore.parse_remote(remotes.get("base"))
        out["upload"]["method"] = r_base.store
        out["upload"]["bucket"] = r_base.bucket
        out["upload"]["folder"] = os.path.join(r_base.key, "final") if r_base.key else "final"
        if r_base.region:
            out["upload"]["region"] = r_base.region
    if global_vars:
        out["globals"] = global_vars
    for k, v in template.items():
        if k not in ["details"]:
            out[k] = v
    if os.path.exists(out_config_file):
        shutil.move(out_config_file,
                    out_config_file + ".bak%s" % datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S"))
    with open(out_config_file, "w") as out_handle:
        yaml.safe_dump(out, out_handle, default_flow_style=False, allow_unicode=False)
    return out_config_file
910261
def DataCopyWithOverlay(self, dcmfilelist, out_dir, overlays):
        
        dcmlist = dcmfilelist
        # data3d = []

        for i in range(len(dcmlist)):
            onefile = dcmlist[i]

            logger.info(onefile)
            data = dicom.read_file(onefile)

            for i_overlay in overlays.keys():
                overlay3d = overlays[i_overlay]
                data = self.encode_overlay_slice(data,
                                                 overlay3d[-1 - i, :, :],
                                                 i_overlay)

            # construct output path
            head, tail = os.path.split(os.path.normpath(onefile))
            filename_out = os.path.join(out_dir, tail)

# save
            data.save_as(filename_out)
233836
def config(remote_base=       'https://raw.githubusercontent.com/SciCrunch/NIF-Ontology/',
           local_base=        None,  # devconfig.ontology_local_repo by default
           branch=            devconfig.neurons_branch,
           core_graph_paths= ['ttl/phenotype-core.ttl',
                              'ttl/phenotypes.ttl'],
           core_graph=        None,
           in_graph_paths=    tuple(),
           out_graph_path=    '/tmp/_Neurons.ttl',
           out_imports=      ['ttl/phenotype-core.ttl'],
           out_graph=         None,
           prefixes=          tuple(),
           force_remote=      False,
           checkout_ok=       ont_checkout_ok,
           scigraph=          None,  # defaults to devconfig.scigraph_api
           iri=               None,
           sources=           tuple(),
           source_file=       None,
           use_local_import_paths=True,
           ignore_existing=   True):
    
    graphBase.configGraphIO(remote_base=remote_base,
                            local_base=local_base,
                            branch=branch,
                            core_graph_paths=core_graph_paths,
                            core_graph=core_graph,
                            in_graph_paths=in_graph_paths,
                            out_graph_path=out_graph_path,
                            out_imports=out_imports,
                            out_graph=out_graph,
                            prefixes=prefixes,
                            force_remote=force_remote,
                            checkout_ok=checkout_ok,
                            scigraph=scigraph,
                            iri=iri,
                            sources=sources,
                            source_file=source_file,
                            use_local_import_paths=use_local_import_paths,
                            ignore_existing=ignore_existing)

    pred = graphBase._predicates
    return pred
154290
def _get_training_data(vrn_files):
    
    out = {"SNP": [], "INDEL": []}
    # SNPs
    for name, train_info in [("train_hapmap", "known=false,training=true,truth=true,prior=15.0"),
                             ("train_omni", "known=false,training=true,truth=true,prior=12.0"),
                             ("train_1000g", "known=false,training=true,truth=false,prior=10.0"),
                             ("dbsnp", "known=true,training=false,truth=false,prior=2.0")]:
        if name not in vrn_files:
            return {}
        else:
            out["SNP"].append((name.replace("train_", ""), train_info, vrn_files[name]))
    # Indels
    if "train_indels" in vrn_files:
        out["INDEL"].append(("mills", "known=true,training=true,truth=true,prior=12.0",
                             vrn_files["train_indels"]))
    else:
        return {}
    return out
481580
async def _update_firmware(filename, loop):
    
    try:
        from opentrons import robot
    except ModuleNotFoundError:
        res = "Unable to find module `opentrons`--not updating firmware"
        rc = 1
        log.error(res)
    else:
        # ensure there is a reference to the port
        if not robot.is_connected():
            robot.connect()

        # get port name
        port = str(robot._driver.port)
        # set smoothieware into programming mode
        robot._driver._smoothie_programming_mode()
        # close the port so other application can access it
        robot._driver._connection.close()

        # run lpc21isp, THIS WILL TAKE AROUND 1 MINUTE TO COMPLETE
        update_cmd = 'lpc21isp -wipe -donotstart {0} {1} {2} 12000'.format(
            filename, port, robot.config.serial_speed)
        proc = await asyncio.create_subprocess_shell(
            update_cmd,
            stdout=asyncio.subprocess.PIPE,
            loop=loop)
        rd = await proc.stdout.read()
        res = rd.decode().strip()
        await proc.communicate()
        rc = proc.returncode

        if rc == 0:
            # re-open the port
            robot._driver._connection.open()
            # reset smoothieware
            robot._driver._smoothie_reset()
            # run setup gcodes
            robot._driver._setup()

    return res, rc
587878
def config(self):
        
        # TODO more efficient to read once and put watch on the file
        config = {}
        if self.config_file.exists():
            with open(self.config_file.as_posix(), 'rt') as f:  # 3.5/pypy3 can't open Path directly
                config = {k:self._override[k] if
                        k in self._override else
                        v for k, v in yaml.safe_load(f).items()}

        return config
338700
def build_job_configs(self, args):
        
        job_configs = {}

        components = Component.build_from_yamlfile(args['comp'])

        datafile = args['data']
        if datafile is None or datafile == 'None':
            return job_configs
        NAME_FACTORY.update_base_dict(args['data'])
        outdir_base = os.path.join(NAME_FACTORY.base_dict['basedir'], 'counts_cubes')

        inputfiles = create_inputlist(args['ft1file'])
        num_files = len(inputfiles)

        for comp in components:
            zcut = "zmax%i" % comp.zmax

            mktimelist = copy.copy(comp.mktimefilters)
            if not mktimelist:
                mktimelist.append('none')
            evtclasslist_keys = copy.copy(comp.evtclasses)
            if not evtclasslist_keys:
                evtclasslist_vals = [NAME_FACTORY.base_dict['evclass']]
            else:
                evtclasslist_vals = copy.copy(evtclasslist_keys)

            for mktimekey in mktimelist:
                for evtclassval in evtclasslist_vals:
                    fullkey = comp.make_key(
                        '%s_%s_{ebin_name}_%s_{evtype_name}' %
                        (evtclassval, zcut, mktimekey))

                    name_keys = dict(zcut=zcut,
                                     ebin=comp.ebin_name,
                                     psftype=comp.evtype_name,
                                     coordsys=comp.coordsys,
                                     irf_ver=NAME_FACTORY.irf_ver(),
                                     mktime=mktimekey,
                                     evclass=evtclassval,
                                     fullpath=True)

                    ccube_name = os.path.basename(NAME_FACTORY.ccube(**name_keys))
                    outfile = os.path.join(outdir_base, ccube_name)
                    infiles = _make_input_file_list(outfile, num_files)
                    logfile = make_nfs_path(outfile.replace('.fits', '.log'))
                    job_configs[fullkey] = dict(args=infiles,
                                                output=outfile,
                                                logfile=logfile)

        return job_configs
1099909
def get_build_files_family(project_tree, dir_relpath, build_ignore_patterns=None):
    """"""
    build_files = set()
    for build in sorted(project_tree.glob1(dir_relpath, '{prefix}*'.format(prefix=BuildFile._BUILD_FILE_PREFIX))):
      if BuildFile._is_buildfile_name(build) and project_tree.isfile(os.path.join(dir_relpath, build)):
        build_files.add(os.path.join(dir_relpath, build))
    return BuildFile._build_files_from_paths(project_tree, build_files, build_ignore_patterns)
648600
function getData (allFiles = [], config) {
  const files = allFiles.reduce((memo, iteratee) => {
    const filePath = path.parse(iteratee)
    if (config.include.includes(filePath.ext) && !config.exclude.includes(filePath.base)) {
      const newFile = {
        file: iteratee.replace(config.content, ''),
        dir: filePath.dir.replace(config.content, ''),
        name: filePath.name,
        base: filePath.base,
        ext: filePath.ext,
      }
      if (filePath.ext === '.md') {
        const file = fs.readFileSync(iteratee, { encoding: 'utf8' })
        const frontMatter = fm(file)
        newFile.attr = frontMatter.attributes
        newFile.body = frontMatter.body
      } else if (filePath.ext === '.png') {
        const image = new PNG.load(iteratee)
        newFile.width = image.width
        newFile.height = image.height
      }
      memo.push(newFile)
    }
    return memo
  }, [])
  return files
}
253701
def _run_concat_variant_files_gatk4(input_file_list, out_file, config):
    
    if not utils.file_exists(out_file):
        with file_transaction(config, out_file) as tx_out_file:
            params = ["-T", "GatherVcfs", "-I", input_file_list, "-O", tx_out_file]
            # Use GATK4 for merging, tools_off: [gatk4] applies to variant calling
            config = utils.deepish_copy(config)
            if "gatk4" in dd.get_tools_off({"config": config}):
                config["algorithm"]["tools_off"].remove("gatk4")
            # Allow specification of verbosity in the unique style this tool uses
            resources = config_utils.get_resources("gatk", config)
            opts = [str(x) for x in resources.get("options", [])]
            if "--verbosity" in opts:
                params += ["--VERBOSITY:%s" % opts[opts.index("--verbosity") + 1]]
            broad_runner = broad.runner_from_config(config)
            broad_runner.run_gatk(params)
    return out_file
486150
def get_tree(config=None):
    ''' 
    '''
    path = os.path.dirname(os.path.abspath(__file__))
    pypath = os.path.realpath(os.path.join(path, '..', 'python'))
    if pypath not in sys.path:
        sys.path.append(pypath)
    os.chdir(pypath)
    from tree.tree import Tree
    tree = Tree(config=config)
    return tree