예제 #1
0
def read_params(args):
    parser = argparse.ArgumentParser(description='''beta cluster wrapper | v1.0 at 2015/10/16 by liangzb ''')
    parser.add_argument('--jackknifed_beta_diversity', dest='jack_soft', metavar='STR', type=str,
                        default="jackknifed_beta_diversity.py",
                        help="set the jackknifed_beta_diversity.py, default find in env")
    parser.add_argument('--make_bootstrapped_tree', dest='bootstrap_soft', metavar='STR', type=str,
                        default="make_bootstrapped_tree.py",
                        help="set the make_bootstrapped_tree.py, default find in env")
    parser.add_argument('-i', '--otu_biom', dest='otu_biom', metavar='FILE', type=str, required=True,
                        help="set the otu biom file")
    parser.add_argument('-t', '--tree_file', dest='tree_file', metavar='FILE', type=str, required=True,
                        help="set the tree file")
    parser.add_argument('-g', '--group_file', dest='group_file', metavar='FILE', type=str, default=None,
                        help="set the group file")
    parser.add_argument('-s', '--seqs_per_sample', dest='seqs', metavar="INT", type=int, default=None,
                        help="set the seqs_per_sample, can be overrited if set stat_file")
    parser.add_argument('--stat_file', dest='stat_file', metavar='FILE', type=str, default=None,
                        help="set the stat file produced by 01_stat.py")
    parser.add_argument('--add_params', dest='add_params', metavar='STR', type=str, default=None,
                        help="add params commands")
    parser.add_argument('-o', '--out_dir', dest='out_dir', metavar='DIR', type=str, required=True,
                        help="set the output dir")
    args = parser.parse_args()
    params = vars(args)
    if params['stat_file'] is not None:
        maximum, minimum = parse_stat_file(params['stat_file'], group_file=params['group_file'])
        params['seqs'] = minimum
    if params['group_file'] is not None:
        params['group'] = parse_group_file(params['group_file'])
    if params['seqs'] is None and params['stat_file'] is None:
        parser.print_help()
        sys.exit()
    return params
def read_params(args):
    parser = argparse.ArgumentParser(description='''downsize script | v1.0 at 2015/09/28 by liangzb ''')
    parser.add_argument('-m', '--minimum', dest='minimum', metavar='INT', type=int, default=None,
                        help="set the minimum to downsize, [default is None]")
    parser.add_argument('-s', '--in_statfile', dest='statfile', metavar='INT', type=str, default=None,
                        help="find the minimum from statfile which produced by 01_stat, can be overrited by MINIMUM")
    parser.add_argument('-i', '--otu_mapfile', dest='otu_map', metavar='STR', type=str, required=True,
                        help="set the otu_mapfile")
    parser.add_argument('-o', '--outfile', dest='outfile', metavar='OUTFILE', type=str, required=True,
                        help="set the output file")
    parser.add_argument('--out_statfile', dest='outstatfile', metavar='FILE', type=str, default=None,
                        help="set the stat file")
    parser.add_argument('--keep_small_size', dest='keep', action='store_true',
                        help="keep the small size [default]")
    parser.add_argument('--no_keep_small_size', dest='keep', action='store_false',
                        help="do not keep the small size")
    parser.set_defaults(keep=True)
    parser.add_argument('--random', dest='random', action='store_true',
                        help="downsize random [default]")
    parser.add_argument('--no_random', dest='random', action='store_false',
                        help="do not downsize random")
    parser.set_defaults(random=True)
    parser.add_argument('-g', '--group', dest='group', metavar='FILE', type=str, default=None,
                        help="if set the group file, in_stat_file will be overwrited")

    args = parser.parse_args()
    params = vars(args)
    if params['minimum'] is None and params['statfile'] is None:
        parser.print_help()
        sys.exit()
    if params['minimum'] is None and params['statfile'] is not None:
        maximum, params['minimum'] = parse_stat_file(params['statfile'], group_file=params['group'])
    params['group'] = parse_group_file(params['group'])
    return params
def read_params(args):
    parser = argparse.ArgumentParser(description='multiple_rarefactions | v1.0 at 2015/09/21 by liangzb')
    parser.add_argument('-r', '--multiple_rarefactions', dest='multiple_rarefactions', metavar='STR',
                        default='multiple_rarefactions.py',
                        help="set the path of multiple_rarefactions.py, default will find in PATH")
    parser.add_argument('-i', '--infile', dest='infile', metavar='FILE', type=str, required=True,
                        help="set the input biom file")
    parser.add_argument('-o', '--outdir', dest='outdir', metavar='OUTDIR', type=str, default='./rarefaction',
                        help="set the output dir, [default is PWD/rarefaction ]")
    parser.add_argument('-m', '--min', dest='min', metavar='INT', type=int, default=10,
                        help="minimum of seqs for rarefaction, [default is 10]")
    parser.add_argument('-s', '--step', dest='step', metavar='INT', type=int, default=4000,
                        help="size of steps between min/max, [default is 4000]")
    parser.add_argument('-c', '--choice_mode', dest='mode', metavar='STR', choices=['MIN', 'MAX'], default='MAX',
                        help="set the stat pick method, MIN or MAX, [default is 'MAX']")
    parser.add_argument('-x', '--max', dest='max', metavar='INT', type=int,
                        help="maximum of seqs for rarefaction, make sure that at least one sample's seq num "
                             "must over this number it can be overrited by STATFILE")
    parser.add_argument('-t', '--statfile', dest='statfile', metavar='FILE', type=str, default=None,
                        help="set the statfile produced by 01_stat.py")
    parser.add_argument('-g', '--group', dest='group_file', metavar='FILE', type=str, default=None,
                        help="set the group_file ")

    args = parser.parse_args()
    params = vars(args)
    if params['statfile'] is not None:
        maximum, minimum = parse_stat_file(params['statfile'], group_file=params['group_file'])
	print "maximum is :%s" % maximum
	print "minimum is : %s" % minimum
        if params['mode'] == 'MAX':
            params['max'] = maximum
        elif params['mode'] == 'MIN':
            params['max'] = minimum
    if params['max'] is None and params['statfile'] is None:
        parser.print_help()
        sys.exit()
    return params
예제 #4
0
def read_params(args):
    parser = argparse.ArgumentParser(
        description='multiple_rarefactions | v1.0 at 2015/09/21 by liangzb')
    parser.add_argument(
        '-r',
        '--multiple_rarefactions',
        dest='multiple_rarefactions',
        metavar='STR',
        default='multiple_rarefactions.py',
        help=
        "set the path of multiple_rarefactions.py, default will find in PATH")
    parser.add_argument('-i',
                        '--infile',
                        dest='infile',
                        metavar='FILE',
                        type=str,
                        required=True,
                        help="set the input biom file")
    parser.add_argument(
        '-o',
        '--outdir',
        dest='outdir',
        metavar='OUTDIR',
        type=str,
        default='./rarefaction',
        help="set the output dir, [default is PWD/rarefaction ]")
    parser.add_argument(
        '-m',
        '--min',
        dest='min',
        metavar='INT',
        type=int,
        default=10,
        help="minimum of seqs for rarefaction, [default is 10]")
    parser.add_argument(
        '-s',
        '--step',
        dest='step',
        metavar='INT',
        type=int,
        default=4000,
        help="size of steps between min/max, [default is 4000]")
    parser.add_argument(
        '-c',
        '--choice_mode',
        dest='mode',
        metavar='STR',
        choices=['MIN', 'MAX'],
        default='MAX',
        help="set the stat pick method, MIN or MAX, [default is 'MAX']")
    parser.add_argument(
        '-x',
        '--max',
        dest='max',
        metavar='INT',
        type=int,
        help=
        "maximum of seqs for rarefaction, make sure that at least one sample's seq num "
        "must over this number it can be overrited by STATFILE")
    parser.add_argument('-t',
                        '--statfile',
                        dest='statfile',
                        metavar='FILE',
                        type=str,
                        default=None,
                        help="set the statfile produced by 01_stat.py")
    parser.add_argument('-g',
                        '--group',
                        dest='group_file',
                        metavar='FILE',
                        type=str,
                        default=None,
                        help="set the group_file ")

    args = parser.parse_args()
    params = vars(args)
    if params['statfile'] is not None:
        maximum, minimum = parse_stat_file(params['statfile'],
                                           group_file=params['group_file'])
        print "maximum is :%s" % maximum
        print "minimum is : %s" % minimum
        if params['mode'] == 'MAX':
            params['max'] = maximum
        elif params['mode'] == 'MIN':
            params['max'] = minimum
    if params['max'] is None and params['statfile'] is None:
        parser.print_help()
        sys.exit()
    return params