def qc_main(args): import paplot.qc as qc # config [config, conf_file] = tools.load_config(tools.win_to_unix(args.config_file)) input_list = tools.get_inputlist(tools.win_to_unix(args.input)) if len(input_list) == 0: print("input no file.") return [sec_in, sec_out] = tools.get_section("qc") id_list = tools.get_idlist(input_list, tools.config_getstr(config, sec_in, "suffix")) # dirs output_html_dir = prep.create_dirs(tools.win_to_unix(args.output_dir), args.project_name, config) output_data = "data_%s%s" % (args.ellipsis, os.path.splitext( input_list[0])[1]) positions = merge.merge_result(input_list, id_list, output_html_dir + "/" + output_data, "qc", config, extract=True) if positions == {}: print("merge.merge_result: input file is invalid.") return html_name = "graph_%s.html" % args.ellipsis params_html = { "dir": output_html_dir, "data": output_data, "js": "data_%s.js" % args.ellipsis, "html": html_name, "project": args.project_name, "title": args.title, } qc.output_html(params_html, positions, config) prep.create_index(config, tools.win_to_unix(args.output_dir), html_name, args.project_name, args.title, overview=args.overview, remarks=args.remarks)
def ca_main(args): ''' ca main script Parameters ---------- args: argparse.Namespace : Args contains the arguments specified in the paplot command Args parameters ---------- input : string : Input file path output_dir : string : Output directory path project_name: string : Project name path config_file : string : Config file path title : string : Report title name ellipsis : string : File name identifier for report overview : string : Report summary remarks : string : Additional information about report func : function: This function (ca_main) Return ------ None ''' # The default values of the variables are defined in the file: ../../paplot # config_file: "" : # title : "CA graphs" : This value is replaced by {title} in ./templates/graph_ca.html # ellipsis : "ca" : This value is used as part of file names, such as graph_ca.html # overview : "Chromosomal Aberration.": This value is used in _convert_index_item function in ./prep.py # remarks : "" : This value is replaced by {remarks} in ./templates/index.html import paplot.ca as ca # config [config, conf_file] = tools.load_config(tools.win_to_unix(args.config_file)) # input_list: a list with input data files as elements input_list = tools.get_inputlist(tools.win_to_unix(args.input)) if len(input_list) == 0: print("input no file.") return [sec_in, sec_out] = tools.get_section("ca") # id_list is used when the column candidates defined in the config file are not in the header of input files # see ids veriable of with_header function in ./subcode/merge.py for details id_list = tools.get_idlist(input_list, tools.config_getstr(config, sec_in, "suffix")) # output_html_dir: The absolute path of the project directory # output_data : File name like data_ca.csv # : This file is created by the merge.merge_result function and placed in the project directory # : The contents of the file are formatted from the input file to match the configuration file # : After that, read the contents and convert it to Json format in ca.output_html function # positions : A nested dictionary: {'must' : {key1: title1, ...}, 'option': {key2: title2, ...}} output_html_dir = prep.create_dirs(tools.win_to_unix(args.output_dir), args.project_name, config) output_data = "data_%s%s" % (args.ellipsis, os.path.splitext( input_list[0])[1]) positions = merge.merge_result(input_list, id_list, output_html_dir + "/" + output_data, "ca", config, extract=True) if positions == {}: print("merge.merge_result: input file is invalid.") return # Create JavaScript file and HTML file for CA html_name = "graph_%s.html" % args.ellipsis params_html = { "dir": output_html_dir, # Project directory full path "data": output_data, # Data file name like csv "js": "data_%s.js" % args.ellipsis, # JavaScript file name "html": html_name, # HTML file name "project": args.project_name, # Project name given by user on command line "title": args.title, # 'CA graphs' as default } ca.output_html(params_html, positions, config) # Create homepage prep.create_index(config, tools.win_to_unix(args.output_dir), html_name, args.project_name, args.title, overview=args.overview, remarks=args.remarks)