示例#1
0
 def __init__(self):
     parser = argument_parser()
     parser.add_argument('-m','--mpileup', help = 'mpileup path')
     parser.add_argument('-s','--snps', help = 'snp table path')
     parser.add_argument('-o','--output', help = 'output path')
     args = parser.parse_args()
     self.__dict__.update(args.__dict__)
示例#2
0
def main():
    a = argparse.argument_parser(description='Set up Kibana default '
                                 'parameters automaticaaly.')
    a.add_argument('ACTION', choices=['reset', 'configure', 'show'])
    a.add_argument('-u', '--url', help='Kibana server URL',
                   default=Kibana.DEFAULT_URL)
    args = a.parse_args()
    kibana = Kibana(args.url)
    func = getattr(kibana, args.ACTION)
    func()
def process_program_arguments():
    ap = argument_parser(description=(
        "Aggregates the results of multiple runs of benchmark results stored in "
        "CSV format."))

    ap.add_argument(
        "-d",
        "--dependent-variable",
        help=(
            "Treat the specified three variables as a dependent variable. The "
            "1st variable is the measured quantity, the 2nd is the uncertainty "
            "of the measurement and the 3rd is the sample size. The defaults "
            "are the dependent variables of Thrust's benchmark suite. May be "
            "specified multiple times."),
        action="append",
        type=str,
        dest="dependent_variables",
        metavar="QUANTITY,UNCERTAINTY,SAMPLES")

    ap.add_argument(
        "-p",
        "--preserve-whitespace",
        help=(
            "Don't trim leading and trailing whitespace from each CSV cell."),
        action="store_true",
        default=False)

    ap.add_argument(
        "-o",
        "--output-file",
        help=("The file that results are written to. If `-`, results are "
              "written to stdout."),
        action="store",
        type=str,
        default="-",
        metavar="OUTPUT")

    ap.add_argument(
        "input_files",
        help=(
            "Input CSV files. The first two rows should be a header. The 1st "
            "header row specifies the name of each variable, and the 2nd "
            "header row specifies the units for that variable."),
        type=str,
        nargs="+",
        metavar="INPUTS")

    return ap.parse_args()
def process_program_arguments():
  ap = argument_parser(
    description = (
      "Aggregates the results of multiple runs of benchmark results stored in "
      "CSV format."
    )
  )

  ap.add_argument(
    "-d", "--dependent-variable",
    help = ("Treat the specified three variables as a dependent variable. The "
            "1st variable is the measured quantity, the 2nd is the uncertainty "
            "of the measurement and the 3rd is the sample size. The defaults "
            "are the dependent variables of Thrust's benchmark suite. May be "
            "specified multiple times."),
    action = "append", type = str, dest = "dependent_variables",
    metavar = "QUANTITY,UNCERTAINTY,SAMPLES"
  )

  ap.add_argument(
    "-p", "--preserve-whitespace",
    help = ("Don't trim leading and trailing whitespace from each CSV cell."),
    action = "store_true", default = False
  )

  ap.add_argument(
    "-o", "--output-file",
    help = ("The file that results are written to. If `-`, results are "
            "written to stdout."),
    action = "store", type = str, default = "-",
    metavar = "OUTPUT"
  )

  ap.add_argument(
    "input_files",
    help = ("Input CSV files. The first two rows should be a header. The 1st "
            "header row specifies the name of each variable, and the 2nd "
            "header row specifies the units for that variable."),
    type = str, nargs = "+",
    metavar = "INPUTS"
  )

  return ap.parse_args()
示例#5
0
###############################################################################


def print_file(p):
    """Open the path `p` and print its contents to `stdout`."""
    print "********************************************************************************"
    with open(p) as f:
        for line in f:
            print line,
    print "********************************************************************************"


###############################################################################

ap = argument_parser(description=(
    "CUDA Eris driver script: runs a benchmark suite multiple times, combines "
    "the results, and outputs them in the CUDA Eris performance result format."
))

ap.add_argument(
    "-b",
    "--benchmark",
    help=("The location of the benchmark suite executable to run."),
    type=str,
    default=join(dirname(realpath(__file__)), "bench"),
    metavar="R")

ap.add_argument(
    "-p",
    "--postprocess",
    help=("The location of the postprocessing script to run to combine the "
          "results."),
示例#6
0
 def __init__(self):
     parser = argument_parser()
     parser.add_argument('-i','--input', help = 'input path')
     parser.add_argument('-o','--output', help = 'output path')
     args = parser.parse_args()
     self.__dict__.update(args.__dict__)
def process_program_arguments():
  ap = argument_parser(
    description = (
      "Compares two sets of combined performance results and identifies "
      "statistically significant changes."
    )
  )

  ap.add_argument(
    "baseline_input_file",
    help = ("CSV file containing the baseline performance results. The first "
            "two rows should be a header. The 1st header row specifies the "
            "name of each variable, and the 2nd header row specifies the units "
            "for that variable. The baseline results may be a superset of the "
            "observed performance results, but the reverse is not true. The "
            "baseline results must contain data for every datapoint in the "
            "observed performance results."),            
    type = str
  )

  ap.add_argument(
    "observed_input_file",
    help = ("CSV file containing the observed performance results. The first "
            "two rows should be a header. The 1st header row specifies the name "
            "of header row specifies the units for that variable."),
    type = str
  )

  ap.add_argument(
    "-o", "--output-file",
    help = ("The file that results are written to. If `-`, results are "
            "written to stdout."),
    action = "store", type = str, default = "-",
    metavar = "OUTPUT"
  )

  ap.add_argument(
    "-c", "--control-variable",
    help = ("Treat the specified variable as a control variable. This means "
            "it will be filtered out when forming dataset keys. For example, "
            "this could be used to ignore a timestamp variable that is "
            "different in the baseline and observed results. May be specified "
            "multiple times."),
    action = "append", type = str, dest = "control_variables", default = [],
    metavar = "QUANTITY"
  )

  ap.add_argument(
    "-d", "--dependent-variable",
    help = ("Treat the specified three variables as a dependent variable. The "
            "1st variable is the measured quantity, the 2nd is the uncertainty "
            "of the measurement and the 3rd is the sample size. The defaults "
            "are the dependent variables of Thrust's benchmark suite. May be "
            "specified multiple times."),
    action = "append", type = str, dest = "dependent_variables", default = [],
    metavar = "QUANTITY,UNCERTAINTY,SAMPLES"
  )

  ap.add_argument(
    "-t", "--change-threshold",
    help = ("Treat relative changes less than this amount (a percentage) as "
            "statistically insignificant. The default is 5%%."),
    action = "store", type = float, default = 5,
    metavar = "PERCENTAGE"
  )

  ap.add_argument(
    "-p", "--preserve-whitespace",
    help = ("Don't trim leading and trailing whitespace from each CSV cell."),
    action = "store_true", default = False
  )

  ap.add_argument(
    "--output-all-variables",
    help = ("Don't omit original absolute values in output."),
    action = "store_true", default = False
  )

  ap.add_argument(
    "--output-all-datapoints",
    help = ("Don't omit datapoints that are statistically indistinguishable "
            "in output."),
    action = "store_true", default = False
  )

  ap.add_argument(
    "-a", "--output-all",
    help = ("Equivalent to `--output-all-variables --output-all-datapoints`."),
    action = store_true_multiple("output_all_variables", "output_all_datapoints")
  )

  return ap.parse_args()
示例#8
0
def get_arguments():
    '''
    Read in the arguments to run moca. Can either be command line or the arguments file
    '''

    parser = argument_parser()
    parser.add_argument("-a", "--argumentfile", dest="ArgumentFile", default="Arguments", \
                            help="Use an argument file rather than the command line. Supply the name of the argument file. Note: POSE automatically looks for './Arguments'.")
    parser.add_argument("-b", "--seed", dest="Seed", default=0, type=int, \
                            help="Supply a 'seed' (and supply a long int) when output reproducility is required (controls stochastic components of algorithm)")
    parser.add_argument("-c", "--correlated", dest="Correlated", action="store_true", default=True, \
                            help="Do increasing POSE score correlate with the value of the measurement, or are these numbers anticorrelated?")
    parser.add_argument("-d", "--debug", dest="Debug", action="store_true", default=False, \
                            help="run in python debug mode 'pdb'")

    parser.add_argument("-f", "--filename", dest="Filename", default="Default", \
                            help="Input/output filname prefix for reading/writing files. By default, filename prefix is the string provided to the mutation command + '.' Mode (e.g., CFTR.POSE")
    parser.add_argument("-g", "--structure", dest="Structure", action="store_true", default=False, \
                            help="Provide PDB-formatted structure file to calculate and consider residue burial for scoreing mutations")
    #h = help
    parser.add_argument("-i", "--optimizationparameters", dest="OptimizationParameters", nargs=3, default=[100, 0.01, 10], \
                            help="The first param specifies the frequency to repopulate the sequence pool with top predicting POSEs, the second param specificies the percent of top POSEs to repopulate the pool, and the third is the number to write to disk for each trial. Defaults specify that every 100 optimizations the top-performing 1%% of POSEs go back into the sequence pool, and when a whole trial is done, write the top 10 POSEs to disk.")
    parser.add_argument("-j", "--mode", dest="Mode", default="POSE", \
                            help="Use POSE for binary phenotypes and ePOSE for continuous phenotype (i.e., endophenotypes)")
    parser.add_argument("-k", "--identitysegment", dest="IdentitySegment", nargs=2, default=[0, 0], \
                            help="Sometimes you don't want the entire protein sequence to be included when determining the sequence weights. For instance, you might be scoring mutations from a evolutionarily modular domain, so some of the full sequences in the initial pool might be irrelevant outside of this domain. Accounts for python slicing (i.e., enter the exact resiues you want 'upstream', 'downstream')")
    parser.add_argument("-l", "--leavesomeout", dest="LeaveSomeOut", default=0, type=int, \
                            help="Specificy the number to leave out for a leave-some-out cross-validation")
    parser.add_argument("-m", "--mutations", dest="Mutations", nargs="*", \
                            help="Give me the name you used to point to mutation files in the paths file. See the Paths and Arguments files from the tutorial for example POSE and ePOSE usage")
    parser.add_argument("-n", "--maxrandomsequences", dest="MaxRandomSequences", default=150, type=int, \
                            help="Maxium number of random sequences sampled during a single iteration of POSE construction")
    parser.add_argument("-o", "--optimizations", dest="Optimizations", default=1000, type=int, \
                            help="How many many random sequences samples to rank for a single trial (t)")
    parser.add_argument("-p", "--pathfile", dest="PathFile", default="Paths", \
                            help="Show me where the path file is. Default is './Paths'")
    parser.add_argument("-q", "--chain", dest="Chain", default=" ", \
                            help="If structure is called, should I be looking at a particular chain in the PDB file. Note: Burial calculations consider all atoms in the PDB, but I need to know which residues to consider for scoring purposes")
    parser.add_argument("-r", "--makepose", dest="MakePOSE", action="store_true", default=False, \
                            help="Default mode for constructing phenotype-optimized sequences ensembles")

    parser.add_argument("-t", "--trials", dest="Trials", default=1, type=int, \
                            help="How many times should I start POSE optimization from the beginning. This is important because each start can lead to different local minima")
    parser.add_argument("-u", "--multiprocessmode", dest="MultiProcessMode", nargs=2, default=[0, 1], \
                            help="If distributing jobs accross multiple processors, the first option determines which node is running the job, and the second argument determines how many nodes are running")
    parser.add_argument("-v", "--annotation", dest="Annotation", action="store_true", default=False, \
                            help="Provid an annotation file if desired. e.g.: the line '231 HGF 0.5' would mean if residue 231 is mutated to either an H, G, or F, then further penalize the mutation by 0.5 score units. You can have as many lines as you like in your annotation file.")
    parser.add_argument("-w", "--postprocess", dest="PostProcess", action="store_true", default=False, \
                            help="Choose a method for postproccessing your POSE results")

    parser.add_argument("-y", "--mypose", dest="MyPOSE", action="store_true", default=False, \
                            help="Build your own POSE module!")
    parser.add_argument("-z", "--profile", dest="Profile", action="store_true", default=False, \
                            help="Prints an itemized report of algorithmic run performance sorted by cummulative time spent executing each function")

    Arguments = parser.parse_args()

    #Overwrite  any defaults from the Arguments file
    if os.path.isfile(Arguments.ArgumentFile):
        Arguments = get_argument_file(Arguments)

    return Arguments
示例#9
0
#!/usr/bin/python3
import os
import getpass
import argparse

parser = argparse.argument_parser()
parser.add_argument('-l','--login', action='store', help='username')
parser.add_argument('-p','--port', action='store', default='22', help='port')
parser.add_argument('-L','--list', action='store', help='file list of IPs')
parser.add_argument('-i','--ip-address', action='store', nargs='+', metavar='host' help='ip or list of ips')

args = parser.parse_args()
if not args.login:
    print("You need a login, broski!")
    return 0

if args.list:
    ips = [i for i in open(args.list, 'r').readlines()]
    passwd = getpass.getpass('Password: '******'ssh-id-copy {0}@{1} -p {2}'.format(ip,args.port,passwd)            
        os.system('sshpass -p ' + passwd + ' ' + cmd)
        print("Key added: ", ip)   # prints if successful
        # ex: sshpass -p passwd ssh-id-copy [email protected]

elif args.host:
    ip = args.host
    cmd = 'ssh-id-copy {0}@{1} -p {2}'.format(ip,args.port,passwd)
    os.system('sshpass -p ' + passwd + ' ' + cmd)
    print("Key added: ", ip)   # prints if successful
示例#10
0
def get_arguments():
    '''
    Read in the arguments to run moca. Can either be command line or the arguments file
    '''

    parser = argument_parser()
    parser.add_argument("-a", "--argumentfile", dest="ArgumentFile", default="Arguments", \
                            help="Use an argument file rather than the command line. Supply the name of the argument file. Note: POSE automatically looks for './Arguments'.")
    parser.add_argument("-b", "--seed", dest="Seed", default=0, type=int, \
                            help="Supply a 'seed' (and supply a long int) when output reproducility is required (controls stochastic components of algorithm)")
    parser.add_argument("-c", "--correlated", dest="Correlated", action="store_true", default=True, \
                            help="Do increasing POSE score correlate with the value of the measurement, or are these numbers anticorrelated?")
    parser.add_argument("-d", "--debug", dest="Debug", action="store_true", default=False, \
                            help="run in python debug mode 'pdb'")
    
    parser.add_argument("-f", "--filename", dest="Filename", default="Default", \
                            help="Input/output filname prefix for reading/writing files. By default, filename prefix is the string provided to the mutation command + '.' Mode (e.g., CFTR.POSE")
    parser.add_argument("-g", "--structure", dest="Structure", action="store_true", default=False, \
                            help="Provide PDB-formatted structure file to calculate and consider residue burial for scoreing mutations")
    #h = help
    parser.add_argument("-i", "--optimizationparameters", dest="OptimizationParameters", nargs=3, default=[100, 0.01, 10], \
                            help="The first param specifies the frequency to repopulate the sequence pool with top predicting POSEs, the second param specificies the percent of top POSEs to repopulate the pool, and the third is the number to write to disk for each trial. Defaults specify that every 100 optimizations the top-performing 1%% of POSEs go back into the sequence pool, and when a whole trial is done, write the top 10 POSEs to disk.")
    parser.add_argument("-j", "--mode", dest="Mode", default="POSE", \
                            help="Use POSE for binary phenotypes and ePOSE for continuous phenotype (i.e., endophenotypes)")
    parser.add_argument("-k", "--identitysegment", dest="IdentitySegment", nargs=2, default=[0, 0], \
                            help="Sometimes you don't want the entire protein sequence to be included when determining the sequence weights. For instance, you might be scoring mutations from a evolutionarily modular domain, so some of the full sequences in the initial pool might be irrelevant outside of this domain. Accounts for python slicing (i.e., enter the exact resiues you want 'upstream', 'downstream')")
    parser.add_argument("-l", "--leavesomeout", dest="LeaveSomeOut", default=0, type=int, \
                            help="Specificy the number to leave out for a leave-some-out cross-validation")
    parser.add_argument("-m", "--mutations", dest="Mutations", nargs="*", \
                            help="Give me the name you used to point to mutation files in the paths file. See the Paths and Arguments files from the tutorial for example POSE and ePOSE usage") 
    parser.add_argument("-n", "--maxrandomsequences", dest="MaxRandomSequences", default=150, type=int, \
                            help="Maxium number of random sequences sampled during a single iteration of POSE construction")
    parser.add_argument("-o", "--optimizations", dest="Optimizations", default=1000, type=int, \
                            help="How many many random sequences samples to rank for a single trial (t)")
    parser.add_argument("-p", "--pathfile", dest="PathFile", default="Paths", \
                            help="Show me where the path file is. Default is './Paths'")
    parser.add_argument("-q", "--chain", dest="Chain", default=" ", \
                            help="If structure is called, should I be looking at a particular chain in the PDB file. Note: Burial calculations consider all atoms in the PDB, but I need to know which residues to consider for scoring purposes")
    parser.add_argument("-r", "--makepose", dest="MakePOSE", action="store_true", default=False, \
                            help="Default mode for constructing phenotype-optimized sequences ensembles")
    
    parser.add_argument("-t", "--trials", dest="Trials", default=1, type=int, \
                            help="How many times should I start POSE optimization from the beginning. This is important because each start can lead to different local minima")
    parser.add_argument("-u", "--multiprocessmode", dest="MultiProcessMode", nargs=2, default=[0, 1], \
                            help="If distributing jobs accross multiple processors, the first option determines which node is running the job, and the second argument determines how many nodes are running")
    parser.add_argument("-v", "--annotation", dest="Annotation", action="store_true", default=False, \
                            help="Provid an annotation file if desired. e.g.: the line '231 HGF 0.5' would mean if residue 231 is mutated to either an H, G, or F, then further penalize the mutation by 0.5 score units. You can have as many lines as you like in your annotation file.")
    parser.add_argument("-w", "--postprocess", dest="PostProcess", action="store_true", default=False, \
                            help="Choose a method for postproccessing your POSE results")

    parser.add_argument("-y", "--mypose", dest="MyPOSE", action="store_true", default=False, \
                            help="Build your own POSE module!")
    parser.add_argument("-z", "--profile", dest="Profile", action="store_true", default=False, \
                            help="Prints an itemized report of algorithmic run performance sorted by cummulative time spent executing each function")
    
    
    Arguments = parser.parse_args()
    
    #Overwrite  any defaults from the Arguments file
    if os.path.isfile(Arguments.ArgumentFile): Arguments = get_argument_file(Arguments)
    
    return Arguments  
示例#11
0
def get_arguments():
    '''
    Read in the MOCA defaults. Override defaults with from the command line or arguments file
    See UsersManual.pdf for more detail on commands
    '''

    parser = argument_parser()
    parser.add_argument("-a",
                        "--pairwise",
                        dest="Pairwise",
                        action="store_true",
                        default=False,
                        help="Run regular pairwise MOCA")
    parser.add_argument(
        "-b",
        "--bandwidth",
        dest="Bandwidth",
        action="store_true",
        default=False,
        help=
        "Allow more than one of the same continuous-valued features, but with different cutoffs, into the same setwork. See MOCA user's manual for all options (default=False)"
    )
    parser.add_argument(
        "-c",
        "--datatype",
        dest="DataType",
        nargs=1,
        default=False,
        help=
        "For the purpose of preprocessing, tell MOCA if data if 'Binary', 'Continuous', or 'Categorical'"
    )
    parser.add_argument(
        "-d",
        "--data",
        dest="Data",
        nargs="*",
        help="Tell me which data types to run (e.g., Mutation, Drug, etc.).")
    parser.add_argument(
        "-e",
        "--ejectpassengers",
        dest="EjectPassengers",
        default=0.1,
        type=float,
        help=
        "Remove features from setworks that aren't actually contributing to the significance of the setwork. See the MOCA user's manual for more details (default=0.1)."
    )
    parser.add_argument(
        "-f",
        "--filename",
        dest="Filename",
        default="Default",
        help=
        "Input/output filname prefix for reading/writing files. If you don't specify, MOCA will use other parameters to make the filename"
    )
    parser.add_argument(
        "-g",
        "--featuremin",
        dest="FeatureMin",
        nargs="*",
        default=3,
        type=int,
        help=
        "Minimum number of postives (i.e., values of '1') required in a vector for MOCA to consider it in any comparison. See MOCA user's manual for all options (default=3)"
    )
    #h is reserved for help and cannot be used!
    parser.add_argument(
        "-i",
        "--booleansets",
        dest="BooleanSets",
        nargs=3,
        default=[0, 0, 0],
        help=
        "For a given setwork, this is the max number of features to be combined using the union, intersection, and difference Boolean set operations. See MOCA user's manual for all option"
    )
    parser.add_argument(
        "-j",
        "--minimumperformance",
        dest="MinimumPerformance",
        nargs="*",
        default=False,
        help=
        "When writing output files, only include features that meet a certain performance criteria. For instance, spec=0.8 sens=0.8. See MOCA user's manual for all option (default=False)."
    )
    parser.add_argument(
        "-k",
        "--correctionmethod",
        dest="CorrectionMethod",
        default="BH",
        help=
        "Which method do you want to use to correct p-values? See MOCA user's manual for all options (default=Benjamini & Hochberg)."
    )
    parser.add_argument("-l", "--leavesomeout", dest="LeaveSomeOut", default=0, type=int, \
                        help="Specificy the number to leave out for a leave-some-out cross-validation")
    parser.add_argument(
        "-m",
        "--mode",
        dest="Mode",
        default="PreProcess",
        help=
        "'PreProcess' formats data for subsequent calculations. 'PostProcess' for analyzing results. See MOCA user's manual for all options (default=PreProcess)"
    )
    parser.add_argument(
        "-n",
        "--normalize",
        dest="Normalize",
        action="store_true",
        default=False,
        help=
        "Normalize the data before applying a 'Threshold'? As of now, the only type of normalization possible is z-score normalization"
    )
    parser.add_argument(
        "-o",
        "--optimization",
        dest="Optimization",
        nargs=3,
        default=[1000, 100, 0.01],
        help=
        "Total cycles, frequency of feature-pool repopulation, and what fraction of top performers to repopulate with. See MOCA user's manual for more details (default=[1000, 100, 0.01]."
    )
    parser.add_argument(
        "-p",
        "--phenotype",
        dest="Phenotype",
        action="store_true",
        default=False,
        help=
        "Name of the phenotype (e.g., Drug, Cyst, Survival). Required for sets, optional for pairs (this would be the feature(s) you'd like to select markers for)."
    )
    parser.add_argument(
        "-q",
        "--fdr",
        dest="FDR",
        default=0.05,
        type=float,
        help=
        "Minimum, adjusted p-value threshold -- anything larger is filtered. Default = 0.05."
    )
    parser.add_argument(
        "-r",
        "--reports",
        dest="Reports",
        action="store_true",
        default=False,
        help=
        "Tell me about the data in MOCA.data or MOCA.results. Options are 'Data' or 'Results'. Default=False"
    )
    parser.add_argument(
        "-s",
        "--seed",
        dest="Seed",
        default=0,
        type=int,
        help=
        "Supply an interger seed (controls stochastic components of algorithm) -- if you don't, MOCA will. All seeds can be accessed using the Reports = Results argument"
    )
    parser.add_argument(
        "-t",
        "--threshold",
        dest="Threshold",
        nargs="*",
        default=False,
        help=
        "During 'PreProcessing' mode, tell MOCA how to threshold and dichotomize continuous-valued input. See MOCA user's manual for details (default=False)"
    )
    parser.add_argument(
        "-u",
        "--multiprocessmode",
        dest="MultiProcessMode",
        nargs=2,
        default=[0, 1],
        help=
        "If distributing jobs accross multiple processors, the first option determines which node is running the job, and the second argument determines how many nodes are running"
    )
    parser.add_argument("-v", "--na", dest="NA", default="NA", \
                        help="Tells MOCA what convention is used to delineate any missing values, such as 'nan' or 'NA' (default)")
    parser.add_argument(
        "-w",
        "--permutephenotype",
        dest="PermutePhenotype",
        action="store_true",
        default=False,
        help=
        "Permutation testing via shuffling the phenotype vector(s). Useful to see if, given your feature vectors, you could derive biomarkers for a permutation if your phenotype."
    )
    parser.add_argument(
        "-x",
        "--priors",
        dest="Priors",
        default=False,
        help=
        "Give MOCA a list of features to bias the search. Typically employed to focus the search if you know some features are important.  See users manual for details"
    )
    parser.add_argument(
        "-y",
        "--labellist",
        dest="LabelList",
        default=False,
        help=
        "Provide MOCA with a list (one label per line), and the calculation will be restricted to that subset of labels"
    )
    parser.add_argument(
        "-z",
        "--featurelist",
        dest="FeatureList",
        default=False,
        help=
        "Provide MOCA with a list (one feature per line), and the calculation will be restricted to that subset of features"
    )
    parser.add_argument(
        "--forcecooccurring",
        dest="ForceCooccurring",
        default=False,
        help=
        "If set to true, this will reject all MutuallyExclusive interactions -- some might find this easier to interpret"
    )
    parser.add_argument("--combinedata",
                        dest="CombineData",
                        default=False,
                        help="")

    #Post-processing options get capital letters
    parser.add_argument(
        "-H",
        "--heatmap",
        dest="Heatmap",
        nargs="*",
        help=
        "Supply arguments to alter the default behavior for making heatmaps in MOCA (see the user's manual for options)."
    )
    parser.add_argument(
        "-O",
        "--orderby",
        dest="OrderBy",
        nargs="*",
        help=
        "For various plotting functions, specify the ordering of features (eg., columns in a heatmap). Options are complex, see the user's manual for details."
    )
    parser.add_argument("-P",
                        "--postprocess",
                        dest="PostProcess",
                        default=False,
                        help="")
    parser.add_argument(
        "-R",
        "--rankmethod",
        dest="RankMethod",
        default="BalancedAccuracy",
        help=
        "Tell MOCA how to sort and optimize features (default=BalancedAccuracy (arithmetic mean of sensitivity and specificity))"
    )
    parser.add_argument(
        "-T",
        "--topinteractions",
        dest="TopInteractions",
        nargs="*",
        default=100,
        type=int,
        help=
        "Number of 'top' interactions (associations) to return during various post-processing tasks. 'Top' is defined by the score function you provide. (default=100)"
    )
    parser.add_argument(
        "-U",
        "--untransformeddata",
        dest="UntransformedData",
        nargs="*",
        help=
        "Useful for postprocessing and making plots, particular with data that was initially continuous valued. Tells MOCA which data to use in it's untransformed state."
    )

    #Developer options
    parser.add_argument("--mymoca",
                        dest="MyMOCA",
                        action="store_true",
                        default=False,
                        help="Build your own MOCA module! See MyMOCA.py")
    parser.add_argument("--profile",
                        dest="Profile",
                        action="store_true",
                        default=False,
                        help="Profile to find inefficient code blocks")
    parser.add_argument("--debug",
                        dest="Debug",
                        action="store_true",
                        default=False,
                        help="run in python debug mode 'pdb'")

    Arguments = parser.parse_args()

    #Overwrite defaults and command line arguments if the Arguments file exists
    if os.path.isfile("Arguments"): Arguments = get_argument_file(Arguments)

    return Arguments
示例#12
0
def get_arguments():
    '''
    Read in the MOCA defaults. Override defaults with from the command line or arguments file
    See UsersManual.pdf for more detail on commands
    '''

    parser = argument_parser()
    parser.add_argument("-a", "--pairwise", dest="Pairwise", action="store_true", default=False,
                        help="Run regular pairwise MOCA")
    parser.add_argument("-b", "--bandwidth", dest="Bandwidth", action="store_true", default=False,
                        help="Allow more than one of the same continuous-valued features, but with different cutoffs, into the same setwork. See MOCA user's manual for all options (default=False)")
    parser.add_argument("-c", "--datatype", dest="DataType", nargs=1, default=False,
                        help="For the purpose of preprocessing, tell MOCA if data if 'Binary', 'Continuous', or 'Categorical'")
    parser.add_argument("-d", "--data", dest="Data", nargs="*", 
                        help="Tell me which data types to run (e.g., Mutation, Drug, etc.).")
    parser.add_argument("-e", "--ejectpassengers", dest="EjectPassengers", default=0.1, type=float,
                        help="Remove features from setworks that aren't actually contributing to the significance of the setwork. See the MOCA user's manual for more details (default=0.1).")
    parser.add_argument("-f", "--filename", dest="Filename", default="Default", 
                        help="Input/output filname prefix for reading/writing files. If you don't specify, MOCA will use other parameters to make the filename")
    parser.add_argument("-g", "--featuremin", dest="FeatureMin", nargs="*", default=3, type=int, 
                        help="Minimum number of postives (i.e., values of '1') required in a vector for MOCA to consider it in any comparison. See MOCA user's manual for all options (default=3)")
    #h is reserved for help and cannot be used!
    parser.add_argument("-i", "--booleansets", dest="BooleanSets", nargs=3, default=[0, 0, 0], 
                        help="For a given setwork, this is the max number of features to be combined using the union, intersection, and difference Boolean set operations. See MOCA user's manual for all option")
    parser.add_argument("-j", "--minimumperformance", dest="MinimumPerformance", nargs="*", default=False, 
                        help="When writing output files, only include features that meet a certain performance criteria. For instance, spec=0.8 sens=0.8. See MOCA user's manual for all option (default=False).")
    parser.add_argument("-k", "--correctionmethod", dest="CorrectionMethod", default="BH",
                        help="Which method do you want to use to correct p-values? See MOCA user's manual for all options (default=Benjamini & Hochberg).")
    parser.add_argument("-l", "--leavesomeout", dest="LeaveSomeOut", default=0, type=int, \
                        help="Specificy the number to leave out for a leave-some-out cross-validation")
    parser.add_argument("-m", "--mode", dest="Mode", default="PreProcess", 
                        help="'PreProcess' formats data for subsequent calculations. 'PostProcess' for analyzing results. See MOCA user's manual for all options (default=PreProcess)")
    parser.add_argument("-n", "--normalize", dest="Normalize", action="store_true", default=False, 
                        help="Normalize the data before applying a 'Threshold'? As of now, the only type of normalization possible is z-score normalization")
    parser.add_argument("-o", "--optimization", dest="Optimization", nargs=3, default=[1000, 100, 0.01], 
                        help="Total cycles, frequency of feature-pool repopulation, and what fraction of top performers to repopulate with. See MOCA user's manual for more details (default=[1000, 100, 0.01].")
    parser.add_argument("-p", "--phenotype", dest="Phenotype",  action="store_true", default=False, 
                        help="Name of the phenotype (e.g., Drug, Cyst, Survival). Required for sets, optional for pairs (this would be the feature(s) you'd like to select markers for).")
    parser.add_argument("-q", "--fdr", dest="FDR", default=0.05, type=float, 
                        help="Minimum, adjusted p-value threshold -- anything larger is filtered. Default = 0.05.")
    parser.add_argument("-r", "--reports", dest="Reports", action="store_true", default=False, 
                        help="Tell me about the data in MOCA.data or MOCA.results. Options are 'Data' or 'Results'. Default=False")
    parser.add_argument("-s", "--seed", dest="Seed", default=0, type=int, 
                        help="Supply an interger seed (controls stochastic components of algorithm) -- if you don't, MOCA will. All seeds can be accessed using the Reports = Results argument")
    parser.add_argument("-t", "--threshold", dest="Threshold", nargs="*", default=False,
                        help="During 'PreProcessing' mode, tell MOCA how to threshold and dichotomize continuous-valued input. See MOCA user's manual for details (default=False)")
    parser.add_argument("-u", "--multiprocessmode", dest="MultiProcessMode", nargs=2, default=[0, 1], 
                        help="If distributing jobs accross multiple processors, the first option determines which node is running the job, and the second argument determines how many nodes are running")
    parser.add_argument("-v", "--na", dest="NA", default="NA", \
                        help="Tells MOCA what convention is used to delineate any missing values, such as 'nan' or 'NA' (default)")
    parser.add_argument("-w","--permutephenotype",dest="PermutePhenotype", action="store_true", default=False,
                        help="Permutation testing via shuffling the phenotype vector(s). Useful to see if, given your feature vectors, you could derive biomarkers for a permutation if your phenotype.")
    parser.add_argument("-x","--priors",dest="Priors", default=False,
                        help="Give MOCA a list of features to bias the search. Typically employed to focus the search if you know some features are important.  See users manual for details")
    parser.add_argument("-y","--labellist",dest="LabelList", default=False,
                        help="Provide MOCA with a list (one label per line), and the calculation will be restricted to that subset of labels")
    parser.add_argument("-z","--featurelist",dest="FeatureList", default=False,
                        help="Provide MOCA with a list (one feature per line), and the calculation will be restricted to that subset of features")
    parser.add_argument("--forcecooccurring",dest="ForceCooccurring", default=False,
                        help="If set to true, this will reject all MutuallyExclusive interactions -- some might find this easier to interpret")
    parser.add_argument("--combinedata",dest="CombineData", default=False,
                        help="")
    
    #Post-processing options get capital letters
    parser.add_argument("-H", "--heatmap", dest="Heatmap", nargs="*",
                        help="Supply arguments to alter the default behavior for making heatmaps in MOCA (see the user's manual for options).")
    parser.add_argument("-O", "--orderby", dest="OrderBy", nargs="*",
                        help="For various plotting functions, specify the ordering of features (eg., columns in a heatmap). Options are complex, see the user's manual for details.")
    parser.add_argument("-P","--postprocess",dest="PostProcess", default=False,
                        help="")
    parser.add_argument("-R", "--rankmethod", dest="RankMethod", default="BalancedAccuracy",
                        help="Tell MOCA how to sort and optimize features (default=BalancedAccuracy (arithmetic mean of sensitivity and specificity))")
    parser.add_argument("-T", "--topinteractions", dest="TopInteractions", nargs="*", default=100, type=int, 
                        help="Number of 'top' interactions (associations) to return during various post-processing tasks. 'Top' is defined by the score function you provide. (default=100)")
    parser.add_argument("-U", "--untransformeddata", dest="UntransformedData", nargs="*",
                        help="Useful for postprocessing and making plots, particular with data that was initially continuous valued. Tells MOCA which data to use in it's untransformed state.")
    
    #Developer options
    parser.add_argument("--mymoca", dest="MyMOCA", action="store_true", default=False, 
                        help="Build your own MOCA module! See MyMOCA.py")
    parser.add_argument("--profile", dest="Profile", action="store_true", default=False,
                        help="Profile to find inefficient code blocks")
    parser.add_argument("--debug", dest="Debug", action="store_true", default=False,
                        help="run in python debug mode 'pdb'")
    
    Arguments = parser.parse_args()
    
    #Overwrite defaults and command line arguments if the Arguments file exists
    if os.path.isfile("Arguments"): Arguments = get_argument_file(Arguments)
    
    return Arguments  
示例#13
0
###############################################################################

def print_file(p):
  """Open the path `p` and print its contents to `stdout`."""
  print "********************************************************************************"
  with open(p) as f:
    for line in f:
      print line,
  print "********************************************************************************"

###############################################################################

ap = argument_parser(
  description = (
    "CUDA Eris driver script: runs a benchmark suite multiple times, combines "
    "the results, and outputs them in the CUDA Eris performance result format."
  )
)

ap.add_argument(
  "-b", "--benchmark", 
  help = ("The location of the benchmark suite executable to run."),
  type = str,
  default = join(dirname(realpath(__file__)), "bench"), 
  metavar = "R"
)

ap.add_argument(
  "-p", "--postprocess", 
  help = ("The location of the postprocessing script to run to combine the "
          "results."),