def main(argv=None): """script main. parses command line options in sys.argv, unless *argv* is given. """ if argv is None: argv = sys.argv # setup command line parser parser = E.OptionParser(version="%prog version: $Id$", usage=globals()["__doc__"]) parser.add_option("-t", "--test", dest="test", type="string", help="supply help") parser.add_option("--time", dest="timepoints", type="string", help="a comma-separated list of time points measured") parser.add_option("--replicates", dest="reps", type="string", help="a comma-separated list of replicate IDs") parser.add_option("--condition", dest="condition", type="string", help="experimental condition") parser.add_option("--resamples", dest="resamples", type="string", help="number of times to resample replicates to" " generate pseudo datasets") parser.add_option("--input-gtf", dest="gtf_file", type="string", help="reference gtf file") parser.add_option("--output-file-directory", dest="output_dir", type="string", help="directory to output" " resampled files to") # add common options (-h/--help, ...) and parse command line (options, args) = E.start(parser, argv=argv) try: infile = IOTools.open_file(argv[-1], "r") except IOError: infile = options.stdin data_frame = pd.read_table(infile, sep="\t", index_col=0, header=0) time_str = options.timepoints.split(",") time_points = [int(x) for x in time_str] replicates = options.reps.split(",") reps = int(options.resamples) its = [time_str, replicates] midx = pd.MultiIndex.from_product(its, names=['times', 'replicates']) TS.genResampleData(data_frame=data_frame, multiple_index=midx, replicates=reps, sample_reps=replicates, times=time_points, condition=options.condition, ref_gtf=options.gtf_file, out_dir=options.output_dir, seed=int(options.random_seed)) # Write footer and output benchmark information. E.stop()
def main(argv=None): """script main. parses command line options in sys.argv, unless *argv* is given. """ if argv is None: argv = sys.argv # setup command line parser parser = E.OptionParser(version="%prog version: $Id$", usage=globals()["__doc__"]) parser.add_option("-t", "--test", dest="test", type="string", help="supply help") parser.add_option("--time", dest="timepoints", type="string", help="a comma-separated list of time points measured") parser.add_option("--replicates", dest="reps", type="string", help="a comma-separated list of replicate IDs") parser.add_option("--condition", dest="condition", type="string", help="experimental condition") parser.add_option("--resamples", dest="resamples", type="string", help="number of times to resample replicates to" " generate pseudo datasets") parser.add_option("--input-gtf", dest="gtf_file", type="string", help="reference gtf file") parser.add_option("--output-file-directory", dest="output_dir", type="string", help="directory to output" " resampled files to") # add common options (-h/--help, ...) and parse command line (options, args) = E.Start(parser, argv=argv) try: infile = IOTools.openFile(argv[-1], "r") except IOError: infile = options.stdin data_frame = pd.read_table(infile, sep="\t", index_col=0, header=0) time_str = options.timepoints.split(",") time_points = [int(x) for x in time_str] replicates = options.reps.split(",") reps = int(options.resamples) its = [time_str, replicates] midx = pd.MultiIndex.from_product(its, names=['times', 'replicates']) TS.genResampleData(data_frame=data_frame, multiple_index=midx, replicates=reps, sample_reps=replicates, times=time_points, condition=options.condition, ref_gtf=options.gtf_file, out_dir=options.output_dir, seed=int(options.random_seed)) # Write footer and output benchmark information. E.Stop()