예제 #1
0
파일: qc.py 프로젝트: yangluom/chilin
def fastqc_detailed_figure(input={
    "template": "",
    "dbaccessor": "",
    "json": ""
},
                           output={
                               "R": "",
                               "pdf": ""
                           },
                           param={"ids": ""}):
    quality_medians = []
    stat = json_load(input["json"])['stat']
    for s in param['ids']:
        quality_medians.append(stat[s]['median'])

    ## from dbaccessor module
    historic_data = db_fastqc(input["dbaccessor"])
    # The table of fastqc_summary that will be used for rendering
    # Col 1: sample ID
    # Col 2: sequence length
    # Col 3: median of sequence quality
    fastqc_dist_r = JinjaTemplateCommand(
        template=input["template"],
        param={
            'historic_data': historic_data,
            'current_data': quality_medians,
            'ids': [underline_to_space(i) for i in param["ids"]],
            'cutoff': 25,
            "need_smooth_curve": True,
            "section": "FastQC score distribution",
            "pdf": output["pdf"],
            "render_dump": output["R"]
        })
    template_dump(fastqc_dist_r)
    r_exec(fastqc_dist_r)
예제 #2
0
파일: tex.py 프로젝트: asntech/chilin
def long_tex(input, output, param):
   latex = JinjaTemplateCommand(
       name="mapping quality",
       template=input["template"],
       param={"phan": input["figure"],
              "render_dump": output["latex"]})
   template_dump(latex)
예제 #3
0
파일: tex.py 프로젝트: asntech/chilin
def latex_contamination(input, output, param):
    """
    input bowtie json files generated from mapping to different species
    :param input:
    :param output:
    :param param:
    :return:
    """
    json_dict = json_load(input["json"])

    if len(json_dict["stat"]["meta"]["species"]) < 1:
        section_name = ""
    else:
        section_name = "library_contamination"

    contam_values = json_dict["stat"]["value"]
    for sample in contam_values:
        for species in contam_values[sample]:
            contam_values[sample][species] = decimal_to_latex_percent(contam_values[sample][species])

    library_quality_latex = JinjaTemplateCommand(
        name="library contamination",
        template=input["template"],
        param={"section_name": section_name,
               "library_contamination": json_dict["stat"],
               'prefix_dataset_id': json_dict["param"]['id'],
               'layout': param['layout'],
               "render_dump": output["latex"]})
    template_dump(library_quality_latex)
예제 #4
0
파일: qc.py 프로젝트: asntech/chilin
def fastqc_detailed_figure(input = {"template": "", "dbaccessor": "", "json": ""},output = {"R":"", "pdf":""},
                           param={"ids": ""}):
    quality_medians = []
    stat = json_load(input["json"])['stat']
    for s in param['ids']:
        quality_medians.append(stat[s]['median'])

    ## from dbaccessor module
    historic_data = db_fastqc(input["dbaccessor"])
    # The table of fastqc_summary that will be used for rendering
    # Col 1: sample ID
    # Col 2: sequence length
    # Col 3: median of sequence quality
    fastqc_dist_r = JinjaTemplateCommand(
        template=input["template"],
        param={'historic_data': historic_data,
               'current_data': quality_medians,
               'ids': [underline_to_space(i) for i in param["ids"]],
               'cutoff': 25,
               "need_smooth_curve": True,
               "section": "FastQC score distribution",
               "pdf": output["pdf"],
               "render_dump": output["R"]})
    template_dump(fastqc_dist_r)
    r_exec(fastqc_dist_r)
예제 #5
0
파일: tex.py 프로젝트: yangluom/chilin
def long_tex(input, output, param):
    latex = JinjaTemplateCommand(name="mapping quality",
                                 template=input["template"],
                                 param={
                                     "phan": input["figure"],
                                     "render_dump": output["latex"]
                                 })
    template_dump(latex)
예제 #6
0
파일: tex.py 프로젝트: asntech/chilin
def latex_conservation(input, output, param):
    latex = JinjaTemplateCommand(
        name = "conservation",
        template = input["template"],
        param={"conservation_compare_graph": param["prefix"] + "_conserv_compare.pdf",
               "conservation_graph": param["prefix"] + "_conserv.pdf",
               "render_dump": output["latex"]})
    template_dump(latex)
예제 #7
0
def load_gc_latex(input, output, param):
    latex = JinjaTemplateCommand(template=input["template"],
                                 param={
                                     "gccontent_graphs":
                                     input["gccontent_graphs"],
                                     "render_dump": output["latex"]
                                 })
    template_dump(latex)
예제 #8
0
def latex_summary_table(input, output, param):
    summary = summary_table(param["conf"])

    latex = JinjaTemplateCommand(
        template=input["template"],
        param={"summary_table": summary,
               "layout": param["layout"],
               "render_dump": output["latex"]})
    template_dump(latex)
예제 #9
0
def latex_summary_table(input, output, param):
    summary = summary_table(param["conf"])

    latex = JinjaTemplateCommand(template=input["template"],
                                 param={
                                     "summary_table": summary,
                                     "layout": param["layout"],
                                     "render_dump": output["latex"]
                                 })
    template_dump(latex)
예제 #10
0
def latex_seqpos(input, output, param):
    json_dict = json_load(input["json"])
    latex = JinjaTemplateCommand(
        name="motif finding",
        template=input["template"],
        param={
            "motif_table":
            json_dict["stat"]["satisfied_motifs"][:5],  ## use top 5 motif
            "render_dump": output["tex"]
        })
    template_dump(latex)
예제 #11
0
파일: tex.py 프로젝트: cfce/chilin
def load_latex(input, output, param):
    json_dict = json_load(input["json"])
    frip_table = []
    stat = json_dict["stat"]
    for sample in stat: #sample is the keys in the stat dictionary
        frip_table.append([underline_to_space(str(sample)), stat[sample]["info_tag"], stat[sample]["total_tag"], decimal_to_latex_percent(stat[sample]["frip"])])
    latex = JinjaTemplateCommand(
        template=input["template"],
        param={"frip_table": frip_table,
               "render_dump": output["latex"]})
    template_dump(latex)
예제 #12
0
파일: tex.py 프로젝트: yangluom/chilin
def latex_conservation(input, output, param):
    if os.path.exists(param["prefix"] + "_conserv_compare.pdf"):
        latex = JinjaTemplateCommand(name="conservation",
                                     template=input["template"],
                                     param={
                                         "conservation_compare_graph":
                                         param["prefix"] +
                                         "_conserv_compare.pdf",
                                         "conservation_graph":
                                         param["prefix"] + "_conserv_img.png",
                                         "render_dump":
                                         output["latex"]
                                     })
        template_dump(latex)
예제 #13
0
파일: qc.py 프로젝트: yangluom/chilin
def bwa_figures(input={"dbaccessor": "", "json": ""}, output = {"figure": ""}, param = {}):
    historyData = db_bwa(input["dbaccessor"])
    json_dict = json_load(input["json"])
    mappable_rates = [float(json_dict["stat"][i]["mapped"])/json_dict["stat"][i]['total'] for i in param["sample"]]
    mappable_rate_R = JinjaTemplateCommand(template=input["template"],
                                           param={'historic_data': historyData,
                                                  'current_data': mappable_rates,
                                                  'ids': param['sample'],
                                                  'cutoff': 0.5,
                                                  'section': 'Unique mapped rate',
                                                  "need_smooth_curve": True,
                                                  "render_dump": output["R"],
                                                  "pdf": output["pdf"]})
    template_dump(mappable_rate_R)
    r_exec(mappable_rate_R)
예제 #14
0
파일: qc.py 프로젝트: asntech/chilin
def bwa_figures(input={"dbaccessor": "", "json": ""}, output = {"figure": ""}, param = {}):
    historyData = db_bwa(input["dbaccessor"])
    json_dict = json_load(input["json"])
    mappable_rates = [float(json_dict["stat"][i]["mapped"])/json_dict["stat"][i]['total'] for i in param["sample"]]
    mappable_rate_R = JinjaTemplateCommand(template=input["template"],
                                           param={'historic_data': historyData,
                                                  'current_data': mappable_rates,
                                                  'ids': param['sample'],
                                                  'cutoff': 0.5,
                                                  'section': 'Unique mapped rate',
                                                  "need_smooth_curve": True,
                                                  "render_dump": output["R"],
                                                  "pdf": output["pdf"]})
    template_dump(mappable_rate_R)
    r_exec(mappable_rate_R)
예제 #15
0
파일: tex.py 프로젝트: cfce/chilin
def load_latex(input, output, param):
    json_dict = json_load(input["json"])
    fastqc_summary = []
    stat = json_dict["stat"]
    for sample in stat:
        fastqc_summary.append([underline_to_space(sample), stat[sample]["sequence_length"], stat[sample]["median"]])
    latex = JinjaTemplateCommand(
        template=input["template"],
        param={"section_name": "sequence_quality",
               "path": input["pdf"],
               "fastqc_table": fastqc_summary,
               "fastqc_graph": input["pdf"],
               'prefix_dataset_id': [ underline_to_space(i) for i in stat.keys() ],
               "render_dump": output["latex"]})
    template_dump(latex)
예제 #16
0
파일: tex.py 프로젝트: yangluom/chilin
def load_latex(input, output, param):
    json_dict = json_load(input["json"])
    frip_table = []
    stat = json_dict["stat"]
    for sample in stat:  #sample is the keys in the stat dictionary
        frip_table.append([
            underline_to_space(str(sample)), stat[sample]["info_tag"],
            stat[sample]["total_tag"],
            decimal_to_latex_percent(stat[sample]["frip"])
        ])
    latex = JinjaTemplateCommand(template=input["template"],
                                 param={
                                     "frip_table": frip_table,
                                     "render_dump": output["latex"]
                                 })
    template_dump(latex)
예제 #17
0
def load_latex(input, output, param):
    json_dict = json_load(input["json"])
    fastqc_summary = []
    stat = json_dict["stat"]
    for sample in stat:
        fastqc_summary.append([
            underline_to_space(sample), stat[sample]["sequence_length"],
            stat[sample]["median"]
        ])
    latex = JinjaTemplateCommand(
        template=input["template"],
        param={
            "section_name": "sequence_quality",
            "path": input["pdf"],
            "fastqc_table": fastqc_summary,
            "fastqc_graph": input["pdf"],
            'prefix_dataset_id': [underline_to_space(i) for i in stat.keys()],
            "render_dump": output["latex"]
        })
    template_dump(latex)
예제 #18
0
파일: tex.py 프로젝트: yangluom/chilin
def latex_contamination(input, output, param):
    """
    input bowtie json files generated from mapping to different species
    :param input:
    :param output:
    :param param:
    :return:
    """
    json_dict = json_load(input["json"])

    if len(json_dict["stat"]["meta"]["species"]) < 1:
        section_name = ""
    else:
        section_name = "library_contamination"

    contam_values = json_dict["stat"]["value"]
    for sample in contam_values:
        for species in contam_values[sample]:
            contam_values[sample][species] = decimal_to_latex_percent(
                contam_values[sample][species])

    library_quality_latex = JinjaTemplateCommand(name="library contamination",
                                                 template=input["template"],
                                                 param={
                                                     "section_name":
                                                     section_name,
                                                     "library_contamination":
                                                     json_dict["stat"],
                                                     'prefix_dataset_id':
                                                     json_dict["param"]['id'],
                                                     'layout':
                                                     param['layout'],
                                                     "render_dump":
                                                     output["latex"]
                                                 })
    template_dump(library_quality_latex)
예제 #19
0
파일: tex.py 프로젝트: cfce/chilin
def load_gc_latex(input, output, param):
    latex = JinjaTemplateCommand(
        template=input["template"],
        param={"gccontent_graphs": input["gccontent_graphs"],
               "render_dump": output["latex"]})
    template_dump(latex)