Print generator settings.

    Parameters
    ----------
    args : `argparse.Namespace`
        Command arguments.
167570
def cmd_settings(args):
    
    if args.type == SQLITE:
        storage = SqliteStorage
    else:
        storage = JsonStorage
    storage = storage.load(args.state)
    data = storage.settings
    try:
        del data['markov']['nodes']
    except KeyError:
        pass
    pprint(data)
144696
def _generate_input(options):
    
    if options.input:
        fp = open(options.input) if options.input != "-" else sys.stdin
        for string in fp.readlines():
            yield string
    if options.strings:
        for string in options.strings:
            yield string
416502
def print_setting(self):
        
        num, param_list = self.num_param()
        num_linear = self.num_param_linear()

        print("The following model options are chosen:")
        print("Lens models:", self._lens_model_list)
        print("Source models:", self._source_light_model_list)
        print("Lens light models:", self._lens_light_model_list)
        print("Point source models:", self._point_source_model_list)
        print("===================")
        print("The following parameters are being fixed:")
        print("Lens:", self.lensParams.kwargs_fixed)
        print("Source:", self.souceParams.kwargs_fixed)
        print("Lens light:", self.lensLightParams.kwargs_fixed)
        print("Point source:", self.pointSourceParams.kwargs_fixed)
        print("===================")
        print("Joint parameters for different models")
        print("Joint lens with lens:", self._joint_lens_with_lens)
        print("Joint lens with lens light:", self._joint_lens_light_with_lens_light)
        print("Joint source with source:", self._joint_source_with_source)
        print("Joint lens with light:", self._joint_lens_with_light)
        print("Joint source with point source:", self._joint_source_with_point_source)
        print("===================")
        print("Number of non-linear parameters being sampled: ", num)
        print("Parameters being sampled: ", param_list)
        print("Number of linear parameters being solved for: ", num_linear)
1184987
def print_options(self):
        
        options = []

        print("The script is running with the following options:")

        options.append(("dry_run", self.options.dry_run))

        options.append(("worker_config", self.__class__))

        database_config = self.database_config or \
                          self.options.queue_model.database.connection_settings
        options.append(("database", '%s:%s:%s' % (database_config['host'],
                                                  database_config['port'],
                                                  database_config['db'])))

        if self.options.worker_class is not None:
            options.append(("worker-class", self.options.worker_class))

        for name, value in options:
            print(" - %s = %s" % (name.replace('_', '-'), value))

        print("The worker will run with the following options:")
        for name in self.options.worker_class.parameters:
            option = getattr(self.worker, name)
            if name == 'callback' and \
                self.options.worker_class.execute == Worker.execute:
                option = '<jobs "run" method>'
            elif isinstance(option, (list, tuple, set)):
                option = ','.join(option)
            print(" - %s = %s" % (name.replace('_', '-'), option))
106428
def print_help(self, prog_name, subcommand):
        
        parser = self.create_parser(prog_name, subcommand)
        parser.print_help()
152899
def print_all_commands(self, *, no_pager=False):
        
        formatter = self.parent_parser._get_formatter()
        command_names = sorted(self.parent_parser.subparsers.choices.keys())
        max_name_len = max([len(name) for name in command_names]) + 1
        commands = ""
        for name in command_names:
            command = self.parent_parser.subparsers.choices[name]
            extra_padding = max_name_len - len(name)
            command_line = '%s%s%s' % (
                name, ' ' * extra_padding, command.description)
            while len(command_line) > formatter._width:
                lines = textwrap.wrap(command_line, formatter._width)
                commands += "%s\n" % lines[0]
                if len(lines) > 1:
                    lines[1] = (' ' * max_name_len) + lines[1]
                    command_line = ' '.join(lines[1:])
                else:
                    command_line = None
            if command_line:
                commands += "%s\n" % command_line
        if no_pager:
            print(commands[:-1])
        else:
            print_with_pager(commands[:-1])
443677
def print_help_info(self, global_options):
        
        usage = ['',"Type '%s help <subcommand>' for help on a specific subcommand." % self.prog_name,'']
        usage.append('Available subcommands:')
        commands = list(self.get_commands().keys())
        commands.sort()
        for cmd in commands:
            usage.append('  %s' % cmd)
        return '\n'.join(usage)
1032864
def main(print_cfg):
    """"""
    parser = argparse.ArgumentParser(description="mvmany.py -- MVtest helper script.", epilog="""
mvmany.py should be run with all arguments you would pass to mvtest.py, except
for those which are specific to a single node's settings (such as chromosome and
BP range). It will then generate a number of scripts which can be run
simultaneously on a cluster. Please be aware that this script does not attempt
to adjust walltimes according to size, and that the user should choose a
walltime that is long enough to allow the largest run to complete.
    """)
    parser.add_argument("-v", action="store_true", help="Print version number")

    parser.add_argument("--mvpath", type=str, default="mvtest.py", help="The path to mvtest.py if it's not found in PATH")
    parser.add_argument("--logpath", type=str, default="log", help="Where to write the logs to")
    parser.add_argument("--res-path", type=str, default="result", help="Where to write the results to")
    parser.add_argument("--script-path", type=str, default="scripts", help="Where to write the various scripts to")
    parser.add_argument("--template", type=argparse.FileType('r'), help="File containing cluster related information that will be written as header to the various files")
    parser.add_argument("--snps-per-job", type=float, default=1.0, help="Allow the user to .")
    parser.add_argument("--mem", type=str, default="2G", help="Memory required during runs")
    parser.add_argument("--walltime", type=str, default="3:00:00", help="Walltime to use")

    # Most of these will just be passed on directly to the various MVTest scripts.
    parser.add_argument("--exclude", type=str, help="Comma-delimited list of rsids to be excluded")
    parser.add_argument("--keep", type=str, help="Comma-delimited list of individuals to be analyzed")
    parser.add_argument("--remove", type=str, help="Comma-delimited list of individuals to be removed from analysis")

    parser.add_argument("--file", type=str, help="Prefix for .ped and .map files")
    parser.add_argument("--ped", type=argparse.FileType('r'), help="PLINK compatible .ped file")
    parser.add_argument("--map", type=argparse.FileType('r'), help="PLINK compatible .map file")
    parser.add_argument("--map3", action='store_true', help="MAP file has only 3 columns")
    parser.add_argument("--no-sex", action='store_true', help="Pedigree file doesn't have column 5 (sex)")
    parser.add_argument("--no-parents", action="store_true", help="Pedigree file doesn't have columns 3 and 4 (parents)")
    parser.add_argument("--no-fid", action="store_true", help="Pedigree file doesn't have column 1 (family ID)")
    parser.add_argument("--no-pheno", action="store_true", help="Pedigree file doesn't have column 6 (phenotype")
    parser.add_argument("--liability", action="store_true", help="Pedigree file has column 7 (liability)")

    parser.add_argument("--bfile", type=str, help="Prefix for .bed, .bim and .fam files")
    parser.add_argument("--bed", type=argparse.FileType('r'), help="Binary Ped file (.bed)")
    parser.add_argument("--bim", type=argparse.FileType('r'), help="Binary ped marker file (.bim)")
    parser.add_argument("--fam", type=argparse.FileType('r'), help="Binary ped family file (.fam)")

    parser.add_argument("--tfile", type=str, help="Prefix for .tped and .tfam files")
    parser.add_argument("--tped", type=argparse.FileType('r'), help="Transposed Pedigree file (.tped)")
    parser.add_argument("--tfam", type=argparse.FileType('r'), help="Transposed pedigre Family file (.tfam)")
    parser.add_argument("--compressed", action="store_true", help="Ped/TPed compressed with gzip (named .ped.tgz or .tped.tgz)")


    parser.add_argument("--impute", type=argparse.FileType('r'), help="File containing list of impute output for analysis")
    parser.add_argument("--impute-fam", type=argparse.FileType('r'), help="File containing family details for impute data")
    parser.add_argument("--impute-count", type=int, help="Number of impute files to process on a single node")
    parser.add_argument("--impute-uncompressed", action="store_true", help="Indicate that the impute input is not gzipped, but plain text")
    parser.add_argument("--impute-encoding", type=str, choices=['additive', 'dominant', 'recessive', 'genotype'], help='Genetic model to be used')
    parser.add_argument("--impute-info-ext", type=str, help="Portion of filename denotes info filename")
    parser.add_argument("--impute-gen-ext", type=str, help="Portion of filename that denotes gen file")
    parser.add_argument("--impute-info-thresh", type=float, help="Threshold for filtering imputed SNPs with poor 'info' values")
    parser.add_argument("--impute-files-per-job", type=int, help="How many gen files to run per job")

    parser.add_argument("--mach", type=argparse.FileType('r'), help="File containing list of MACH output for analysis")
    parser.add_argument("--mach-uncompressed", action="store_true", help="Indicate that the mach input is not gzipped")
    parser.add_argument("--mach-info-ext", type=str, help="Portion of filename denotes info filenames")
    parser.add_argument("--mach-dose-ext", type=str, help="Portion of filename that denotes dose files")
    parser.add_argument("--mach-min-rsquared", type=float, help="Filter out loci with RSquared < this value")
    parser.add_argument("--mach-files-per-job", type=int, help="How many dosage files to run per job")
    parser.add_argument("--mach-chunk-size", type=int, help="How many loci to keep in memory at once")
    parser.add_argument("--mach-count", type=int, help="Number of mach files to process for each job")

    parser.add_argument("--pheno", type=argparse.FileType('r'), help="File containing phenotypes")
    parser.add_argument("--sample-pheno", type=argparse.FileType('r'), help="(Mach) Sample file containing phenotypes")
    parser.add_argument("--mphenos", type=str, help="Column number(s) for phenotype to be analyzed if number of columns > 1")
    parser.add_argument("--pheno-names", type=str, help="Name for phenotype(s) to be analyzed (must be in --pheno file)")
    parser.add_argument("--all-pheno", action="store_true", help="Analyze all columns from the phenotype file")

    parser.add_argument("--covar", type=argparse.FileType('r'), help="File containing covariates")
    parser.add_argument("--sample-covar", type=argparse.FileType('r'), help="(Mach) Sample file containing covariates")
    parser.add_argument("--covar-numbers", type=str, help="Comma-separated list of covariate indices")
    parser.add_argument("--covar-names", type=str, help="Comma-separated list of covariate names")
    parser.add_argument("--sex", action='store_true', help="Use sex from the pedigree file as a covariate")
    parser.add_argument("--missing-phenotype", type=float, help="Encoding for missing phenotypes")

    parser.add_argument("--maf", type=float, help="Minimum MAF allowed for analysis")
    parser.add_argument("--max-maf", type=float, help="MAX MAF allowed for analysis")
    parser.add_argument("--geno", type=float, help="MAX per-SNP missing for analysis")
    parser.add_argument("--mind", type=float, help="MAX per-person missing")

    parser.set_defaults(all_pheno=False, sex=False)
    args = parser.parse_args()

    # Report version, if requested, and exit
    if args.v:
        print >> sys.stderr, "%s: %s" % (os.path.basename(__file__), __version__)
        sys.exit(0)
    mkdir(args.script_path)
    mkdir(args.res_path)
    mkdir(args.logpath)

    if args.mach:
        args.mach = args.mach.name
    if args.impute:
        args.impute = args.impute.name
    if args.impute_fam:
        args.impute_fam = args.impute_fam.name
    if args.covar:
        args.covar = args.covar.name
    if args.pheno:
        args.pheno = args.pheno.name

    general_arguments = []
    for flag in ("exclude,keep,remove,file,ped,map,map3,no-sex,no-parents,no-fid,no-pheno,liability," + \
                        "bfile,bed,bim,fam,tfile,tped,tfam,compressed," + \
                        "impute,impute-fam,impute-uncompresed,impute-encoding,impute-info-ext,impute-gen-ext,impute-info-thresh," +\
                        "mach,mach-uncompressed,mach-info-ext,mach-dose-ext,mach-min-rsquared,mach-chunk-size," +\
                        "pheno,sample-pheno,pheno-names,mphenos,all-pheno," + \
                        "covar,sample-covar,covar-numbers,covar-names,sex,missing-phenotype,maf,max-maf,gen,mind").split(","):
        check_and_append(args, flag, general_arguments)

    args.template = get_template_file(args)
    job_list = None
    map_file = None
    impute_file_list = None
    if args.file:
        map_file = "%s.map" % (args.file)
    elif args.map:
        map_file = args.map
    elif args.bfile:
        map_file = "%s.bim" % (args.bfile)
    elif args.bim:
        map_file = args.bim
    elif args.tfile:
        map_file = "%s.tped"
    elif args.tped:
        map_file = args.tped
    elif args.impute:
        impute_file_list = args.impute

    max_snp_count = args.snps_per_job

    if map_file is not None:
        job_list = split_chrom_jobs(args, map_file)

    elif args.impute is not None:
        job_list = split_impute_jobs(args, args.impute)

    elif args.mach is not None:
        job_list = split_mach_jobs(args, args.mach)

    if job_list is None or len(job_list) == 0:
        parser.print_usage(sys.stderr)
        print >> sys.stderr, "\nThere were not jobs created. Did you specify the necessary data?"
    else:
        generate_jobs(args, job_list, " ".join(general_arguments))
    sys.exit(0)
166353
def main():
    
    prog = sys.argv[0]

    arg_parser = create_parser(prog)

    opts = parse_cmdline(arg_parser)

    print('Parameters: server=%s\n username=%s\n namespace=%s\n'
          ' classname=%s\n max_pull_size=%s\n use_pull=%s' %
          (opts.server, opts.user, opts.namespace, opts.classname,
           opts.max_object_count, opts.usepull))

    # call method to connect to the server
    conn = WBEMConnection(opts.server, (opts.user, opts.password),
                          default_namespace=opts.namespace,
                          no_verification=True,
                          use_pull_operations=opts.usepull)

    #Call method to create iterator
    instances = []
    try:
        iter_instances = conn.IterEnumerateInstances(
            opts.classname,
            MaxObjectCount=opts.max_object_count)

        # generate instances with
        for instance in iter_instances:
            print(' %s %s' % (type(instances), type(instance)))
            instances.append(instance)
            print('\npath=%s\n%s' % (instance.path, instance.tomof()))

    # handle exceptions
    except CIMError as ce:
        print('Operation Failed: CIMError: code=%s, Description=%s' %
              (ce.status_code_name, ce.status_description))
        sys.exit(1)
    except Error as err:
        print ("Operation failed: %s" % err)
        sys.exit(1)

    inst_paths = [inst.path for inst in instances]

    paths = []
    try:
        iter_paths = conn.IterEnumerateInstancePaths(
            opts.classname,
            MaxObjectCount=opts.max_object_count)

        # generate instances with
        for path in iter_paths:
            print('path=%s' % path)
            paths.append(path)

        if len(paths) != len(paths):
            print('Error path and enum response sizes different enum=%s path=%s'
                  % (len(paths), len(paths)))
        for path in paths:
            found = False
            for inst_path in inst_paths:                
                if path == inst_path:
                    found = True
                    break
                else:
                    print('No match \n%s\n%s' %(path, inst_path))
            if not found:
                print('Path %s not found in insts' % path)
    # handle exceptions
    except CIMError as ce:
        print('Operation Failed: CIMError: code=%s, Description=%s' %
              (ce.status_code_name, ce.status_description))
        sys.exit(1)
    except Error as err:
        print ("Operation failed: %s" % err)
        sys.exit(1)

    return 0
53873
def _print(self, *args):
        '''
        '''
        string = ' '.join([str(arg) for arg in args])
        print(string, end='', file=self._stream)
662875
def print_options(self):
        
        summary = []
        for opt_name, opt in self.options.items():
            if opt.hidden:
                continue
            summary.append(opt.summary())
        print("\n".join(summary))
986989
def _print_help(self):
        
        options = self._print_usage('\n  ', file=sys.stdout)
        if self.docstring:
            print()
            try:
                doc_string = self.docstring.format(**self._variables)
            except KeyError:
                doc_string = self.docstring
            for doc in doc_string.split('\n'):
                doc = doc.strip()
                if len(doc) > 2:
                    print(textwrap.fill(textwrap.dedent(doc).strip(),
                                        width=80, initial_indent='  ',
                                        subsequent_indent='   '))
        print()
        if options:
            print('Options:')
            width = max(len(k) for k in self._options)
            for x, t in self._options.items():
                print(self._format_option(x, t, width))
            if self._get_variable('VERSION'):
                print('{0:{1}}'.format(self._version_options[0], width), end=' ')
                print('| ' + ' | '.join(self._version_options[1:]), 'print version',
                      '(%s)' % self._get_variable('VERSION'))
            print('{0:{1}}'.format(self._help_options[0], width), end=' ')
            print('| ' + ' | '.join(self._help_options[1:]), 'print this help')
            print()
697470
def print_config(self, _):
        '''  '''
        for section in self.config.sections():
            print '[%s]' % section
            items = dict(self.config.items(section))
            for k in items:
                print "%(a)s=%(b)s" % {'a': k, 'b': items[k]}
            print ''
593281
def print_user_sets(wordsets, print_terms):
    
    if not wordsets:
        print('No sets found')
    else:
        print('Found sets: {}'.format(len(wordsets)))
        for wordset in wordsets:
            print('    {}'.format(wordset))
            if print_terms:
                for term in wordset.terms:
                    print('        {}'.format(term))
926666
def print_parameters(self):
        
        self.print_info(u"Available parameters:")
        self.print_generic(u"\n" + u"\n".join(self.PARAMETERS) + u"\n")
        return self.HELP_EXIT_CODE
1249738
def show(self, args: argparse.Namespace, parameter: str = '') -> None:
        
        param = utils.norm_fold(parameter.strip())
        result = {}
        maxlen = 0

        for p in self.settable:
            if (not param) or p.startswith(param):
                result[p] = '{}: {}'.format(p, str(getattr(self, p)))
                maxlen = max(maxlen, len(result[p]))

        if result:
            for p in sorted(result):
                if args.long:
                    self.poutput('{} # {}'.format(result[p].ljust(maxlen), self.settable[p]))
                else:
                    self.poutput(result[p])

            # If user has requested to see all settings, also show read-only settings
            if args.all:
                self.poutput('\nRead only settings:{}'.format(self.cmdenvironment()))
        else:
            self.perror("Parameter '{}' not supported (type 'set' for list of parameters).".format(param),
                        traceback_war=False)
483427
def print_help(self, prog_name, subcommand):
        
        parser = self.get_parser(prog_name, subcommand)
        parser.print_help()