def main(): args = parser.parse_args() # Determine which mapping type was specified. If neither a default # or custom mapping was specified then throw an error. if args.map_type and args.custom_map_table: sys.exit("Only one of \"--map_type\" or \"--custom_map_table\" can be " "set. Please re-run the command with only one of these " "options.") elif args.map_type: mapfile = default_map[args.map_type] elif args.custom_map_table: mapfile = args.custom_map_table else: sys.exit("A default mapping table needs to be specified with the " "--map_type option, or alternatively a custom mapfile can " "be specified with the --custom_map_table option") tab_w_descrip = add_descrip_col(inputfile=args.input, mapfile=mapfile) # Output the table to file. make_output_dir_for_file(args.output) tab_w_descrip.to_csv(path_or_buf=args.output, sep="\t", index=False, compression="infer")
def main(): args = parser.parse_args() # Determine which input trait table was specified. If neither a default # or custom table was specified then throw an error. if args.in_trait: trait_table = default_tables[args.in_trait] elif args.observed_trait_table: trait_table = args.observed_trait_table else: raise RuntimeError( "A default input trait table needs to be specified with the " + "--in_trait option, or alternatively a custom table can be " + "specified with the --observed_trait_table option") # Check that input filenames exist. check_files_exist([args.tree, trait_table]) # Methods for discrete trait prediction with CI enabled. discrete_set = set(['emp_prob', 'mp']) if args.confidence and args.hsp_method in discrete_set: ci_setting = True else: ci_setting = False count_outfile = args.output_prefix + ".tsv" ci_outfile = args.output_prefix + "_ci.tsv" hsp_table, ci_table = castor_hsp_workflow(tree_path=args.tree, trait_table_path=trait_table, hsp_method=args.hsp_method, chunk_size=args.chunk_size, calc_nsti=args.calculate_NSTI, calc_ci=ci_setting, check_input=args.check, num_proc=args.processes, ran_seed=args.seed) # Output the table to file. make_output_dir_for_file(count_outfile) hsp_table.to_csv(path_or_buf=count_outfile, index_label="sequence", sep="\t") # Output the CI file as well if option set. if ci_setting: make_output_dir_for_file(ci_outfile) ci_table.to_csv(path_or_buf=ci_outfile, index_label="sequence", sep="\t")
def main(): args = parser.parse_args() # Determine which mapping type was specified. If neither a default # or custom mapping was specified then throw an error. if args.map_type: mapfile = default_map[args.map_type] elif args.custom_map_table: mapfile = args.custom_map_table else: sys.exit("A default mapping table needs to be specified with the " + "--map_type option, or alternatively a custom mapfile can " + "be specified with the --custom_map_table option") tab_w_descrip = add_descrip_col(inputfile=args.input, mapfile=mapfile) # Output the table to file. make_output_dir_for_file(args.output) tab_w_descrip.to_csv(path_or_buf=args.output, sep="\t", index=False)
def main(): args = parser.parse_args() # Determine which input trait table was specified. If neither a default # or custom table was specified then throw an error. if args.in_trait: trait_table = default_tables[args.in_trait] elif args.observed_trait_table: trait_table = args.observed_trait_table else: raise RuntimeError( "A default input trait table needs to be specified with the " + "--in_trait option, or alternatively a custom table can be " + "specified with the --observed_trait_table option") # Check that input filenames exist. check_files_exist([args.tree, trait_table]) # No longer support outputting CIs with this script. ci_setting = False hsp_table, ci_table = castor_hsp_workflow(tree_path=args.tree, trait_table_path=trait_table, hsp_method=args.hsp_method, chunk_size=args.chunk_size, calc_nsti=args.calculate_NSTI, calc_ci=ci_setting, check_input=args.check, num_proc=args.processes, ran_seed=args.seed, verbose=args.verbose) # Output the table to file. make_output_dir_for_file(args.output) hsp_table.to_csv(path_or_buf=args.output, index_label="sequence", sep="\t", compression="infer")