Compute LD using Plink.

    :param options: the options.

    :type options: argparse.Namespace

    :returns: the name of the output file (from Plink).
178675
def selectSNPsAccordingToLD(options):
    
    # The plink command
    outPrefix = options.out + ".pruning_" + options.indep_pairwise[2]
    plinkCommand = [
        "plink",
        "--noweb",
        "--bfile", options.bfile,
        "--maf", options.maf,
        "--indep-pairwise",
    ] + options.indep_pairwise + ["--out", outPrefix]

    runCommand(plinkCommand)

    # Finding the autosomal markers
    autosomes = {str(i) for i in range(1, 23)}
    autosomal_snps = set()
    with open(options.bfile + ".bim", "r") as i_file:
        for line in i_file:
            chrom, snp = line.rstrip("\r\n").split("\t")[:2]
            if chrom in autosomes:
                autosomal_snps.add(snp)

    # Reading the pruned markers
    pruned_snps = None
    with open(outPrefix + ".prune.in", "r") as i_file:
        pruned_snps = set(i_file.read().splitlines())

    # Writing the pruned markers located on an autosome
    with open(outPrefix + ".prune.in.autosomal", "w") as o_file:
        for snp in autosomal_snps & pruned_snps:
            print >>o_file, snp

    return outPrefix + ".prune.in.autosomal"
936806
def lib(params = {})
    ldflags   = params[:settings]['ADD_LDFLAGS'] + ' ' + @settings['LDFLAGS']
    objs      = params[:objects].join(' ')
    dep_libs = (params[:libs] + libs_for_binary(params[:lib])).uniq
    libs      = linker_line_for(dep_libs)
    extension = File.extname(params[:lib])

    case extension
      when ('.a')
        # need to use 'touch' for correct timestamp, ar doesn't update the timestamp
        # if archive hasn't changed
        success = sh("#{@settings['AR']} curv #{params[:lib]} #{objs}")
        touch(params[:lib]) if success
      when '.so'
        sh "#{@settings['CXX']} -shared  #{ldflags} #{libs} #{objs} -o #{params[:lib]}"

        if (@config.stripped) && File.exist?(params[:lib])
          FileUtils.cp(params[:lib], "#{params[:lib]}.unstripped", :verbose => true)
          sh "#{@settings['STRIP']} #{params[:lib]}"
        end
      else
        raise "unsupported library extension (#{extension})!"
    end
  end
837055
def get_options(self):
        
        args = self.parse_options(self.args)

        if args:
            self.directory = args[0]

        if self.develop:
            self.skiptag = True
        if not self.develop:
            self.develop = self.defaults.develop
        if not self.develop:
            self.infoflags = self.setuptools.infoflags

        if not self.formats:
            self.formats = self.defaults.formats

        for format in self.formats:
            if format == 'zip':
                self.distributions.append(('sdist', ['--formats="zip"']))
            elif format == 'gztar':
                self.distributions.append(('sdist', ['--formats="gztar"']))
            elif format == 'egg':
                self.distributions.append(('bdist', ['--formats="egg"']))
            elif format == 'wheel':
                self.distributions.append(('bdist_wheel', []))

        if not self.distributions:
            self.distributions.append(('sdist', ['--formats="zip"']))

        if self.list:
            self.list_locations()

        if not self.locations:
            self.locations.extend(self.locations.get_default_location())

        if not (self.skipregister and self.skipupload):
            if not (self.get_skipregister() and self.get_skipupload()):
                self.locations.check_empty_locations()
            self.locations.check_valid_locations()

        if len(args) > 1:
            if self.urlparser.is_url(self.directory):
                self.branch = args[1]
            elif self.urlparser.is_ssh_url(self.directory):
                self.branch = args[1]
            else:
                err_exit('mkrelease: invalid arguments\n%s' % USAGE)

        if len(args) > 2:
            err_exit('mkrelease: too many arguments\n%s' % USAGE)
244865
def extractSNPs(snpsToExtract, options):
    
    outPrefix = options.out + ".pruned_data"
    plinkCommand = ["plink", "--noweb", "--bfile", options.bfile, "--extract",
                    snpsToExtract, "--make-bed", "--out", outPrefix]
    runCommand(plinkCommand)
    return outPrefix
123348
def ParseOptions(self, options):
    
    # The data location is required to list signatures.
    helpers_manager.ArgumentHelperManager.ParseOptions(
        options, self, names=['data_location'])

    # Check the list options first otherwise required options will raise.
    signature_identifiers = self.ParseStringOption(
        options, 'signature_identifiers')
    if signature_identifiers == 'list':
      self.list_signature_identifiers = True

    if self.list_signature_identifiers:
      return

    self._ParseInformationalOptions(options)
    self._ParseLogFileOptions(options)

    self._ParseStorageMediaOptions(options)

    self._destination_path = self.ParseStringOption(
        options, 'path', default_value='export')

    if not self._data_location:
      logger.warning('Unable to automatically determine data location.')

    argument_helper_names = ['artifact_definitions', 'process_resources']
    helpers_manager.ArgumentHelperManager.ParseOptions(
        options, self, names=argument_helper_names)

    self._ParseFilterOptions(options)

    if (getattr(options, 'no_vss', False) or
        getattr(options, 'include_duplicates', False)):
      self._skip_duplicates = False

    self._EnforceProcessMemoryLimit(self._process_memory_limit)
955018
def get_cwd(options):
    
    if not options.cwd:
        return None
    if not os.path.exists(options.cwd):
        raise exceptions.InvalidCwd(
            "can't --cwd to invalid path {0!r}".format(options.cwd))
    return options.cwd
126183
def _ewp_ilink_set(self, ewp_dic, project_dic):
        
        index_ilink = self._get_option(ewp_dic, 'ILINK')
        index_option = self._get_option(ewp_dic[index_ilink]['data']['option'], 'IlinkIcfFile')
        self._set_option(ewp_dic[index_ilink]['data']['option'][index_option], project_dic['linker_file'])

        ilink_dic = ewp_dic[index_ilink]['data']['option']
        self._ewp_flags_set(ilink_dic, project_dic, 'ld_flags', self.FLAG_TO_IAR['ld_flags'])
5702
function (options, iterationInfo) {
        var files;
        var modules = {};

        // check if the counter has reached the desired depth indicated in options.depth
        if (typeof options.depth !== 'undefined' &&
            iterationInfo.currentDepth >= options.depth) {
            return;
        }

        // remember the starting directory
        try {
            files = fs.readdirSync(iterationInfo.dirName);
        } catch (e) {
            if (options.optional)
                return {};
            else
                throw new Error('Directory not found: ' + iterationInfo.dirName);
        }

        // iterate through files in the current directory
        files.forEach(function (fileName) {
            iterationInfo.fileName = fileName;
            //get absolute path
            iterationInfo.absolutePath = rtrim(iterationInfo.dirName, '/');
            iterationInfo.absoluteFullPath = iterationInfo.absolutePath + '/' + fileName;
            //get relative path
            iterationInfo.relativePath = iterationInfo.absolutePath.replace(iterationInfo.initialDirName, '');
            iterationInfo.relativeFullPath = iterationInfo.absoluteFullPath.replace(iterationInfo.initialDirName, '');
            // make sure a slash exists on the left side of relative paths
            iterationInfo.relativePath = '/' + ltrim(iterationInfo.relativePath, '/');
            iterationInfo.relativeFullPath = '/' + ltrim(iterationInfo.relativeFullPath, '/');

            if (fs.statSync(iterationInfo.absoluteFullPath).isDirectory()) {
                processDirectory(options, iterationInfo, modules)
            }
            else {
                processFile(options, iterationInfo, modules);
            }
        });

        return modules;
    }
997471
def namespace(self, mid: ModuleId) -> YangIdentifier:
        
        try:
            mdata = self.modules[mid]
        except KeyError:
            raise ModuleNotRegistered(*mid) from None
        return mdata.main_module[0]
427287
def _get_paths(options):
    
    opts = options

    docroot = path(opts.get('docroot', 'docs'))
    if not docroot.exists():
        raise BuildFailure("Sphinx documentation root (%s) does not exist."
                           % docroot)

    builddir = docroot / opts.get("builddir", ".build")

    srcdir = docroot / opts.get("sourcedir", "")
    if not srcdir.exists():
        raise BuildFailure("Sphinx source file dir (%s) does not exist"
                           % srcdir)

    # Where is the sphinx conf.py file?
    confdir = path(opts.get('confdir', srcdir))

    # Where should output files be generated?
    outdir = opts.get('outdir', '')
    if outdir:
        outdir = path(outdir)
    else:
        outdir = builddir / opts.get('builder', 'html')

    # Where are doctrees cached?
    doctrees = opts.get('doctrees', '')
    if not doctrees:
        doctrees = builddir / "doctrees"
    else:
        doctrees = path(doctrees)

    return Bunch(locals())
104406
def finalize_options(self):
        
        self.cwd = os.path.abspath(os.path.dirname(__file__))
        self.test_dir = os.path.join(self.cwd, 'tests')
400121
def ls(self, src, extra_args=[]):
        ''''''
        src = [self._full_hdfs_path(x) for x in src]
        output = self._getStdOutCmd([self._hadoop_cmd, 'fs', '-ls'] + extra_args + src, True)
        return self._transform_ls_output(output, self.hdfs_url)
1188210
def which(software, strip_newline=True):
    '''
    '''
    if software is None:
        software = "singularity"
    cmd = ['which', software ]
    try:
        result = run_command(cmd)
        if strip_newline is True:
            result['message'] = result['message'].strip('\n')
        return result

    except: # FileNotFoundError
        return None
1240568
def cygpath(filename):
    """"""
    if sys.platform == 'cygwin':
        proc = Popen(['cygpath', '-am', filename], stdout=PIPE)
        return proc.communicate()[0].strip()
    else:
        return filename
1345779
def output_to_graphviz(file, namer=_graphviz_default_namer, block=None):
    
    print(block_to_graphviz_string(block, namer), file=file)
1203202
def _getPFilename(self,native,prompt):
        
        return self.get(native=native,prompt=prompt)
926057
def handle_container_output_args(options, parser):
    
    if options.result_files:
        result_files_patterns = [os.path.normpath(p) for p in options.result_files if p]
        for pattern in result_files_patterns:
            if pattern.startswith(".."):
                parser.error("Invalid relative result-files pattern '{}'.".format(pattern))
    else:
        result_files_patterns = ["."]

    output_dir = options.output_directory
    if os.path.exists(output_dir) and not os.path.isdir(output_dir):
        parser.error("Output directory '{}' must not refer to an existing file.".format(output_dir))
    return {
        'output_dir': output_dir,
        'result_files_patterns': result_files_patterns,
        }