Commit 604885e6 authored by MARIJON Pierre's avatar MARIJON Pierre

Extract some information about original dataset in canu correction report

parent 7a3695ff
......@@ -9,6 +9,7 @@ canu_gkp_store = os.path.join(in_path, "unitigging", canu_project_name + ".gk
canu_ovl_store = os.path.join(in_path, "unitigging", canu_project_name + ".ovlStore")
canu_bog = os.path.join(in_path, "unitigging", "4-unitigger", canu_project_name + ".best.edges")
canu_bog_readname = os.path.join(canu_gkp_store, "readNames.txt")
canu_correction_report = os.path.join(in_path, "correction.html")
# File generate by pipeline
canu_paf = os.path.join(in_path, "canu_paf")
......
......@@ -24,6 +24,7 @@ rule report:
rule create_report:
input:
canu_correction = canu_correction_report,
canu_fasta = canu_contigs + ".fasta",
canu_bog_gfa = canu_bog + ".gfa",
canu_bog = canu_bog + ".png",
......@@ -46,7 +47,7 @@ rule create_report:
shell:
" ".join([
package_path + config['report_generator']['bin'], "canu_miniasm",
os.path.join(package_path, "template"), "{input.canu_fasta}",
os.path.join(package_path, "template"), "{input.canu_correction}", "{input.canu_fasta}",
"{input.canu_bog_gfa}", "{input.canu_bog}", "{input.canu_paf}",
"{input.canu_con}", "{input.canu_uni}", "{input.canu_on_minimap_paf}", "{input.canu_on_minimap_legend}",
"{input.canu_contig_report_csv}", "{input.canu_contig_report_png}",
......
......@@ -23,6 +23,7 @@ rule report:
rule create_report:
input:
canu_correction = canu_correction_report,
canu_fasta = canu_contigs + ".fasta",
canu_bog_gfa = canu_bog + ".gfa",
canu_bog = canu_bog + ".png",
......@@ -43,7 +44,7 @@ rule create_report:
shell:
" ".join([
package_path + config['report_generator']['bin'], "canu_minimap",
os.path.join(package_path, "template"), "{input.canu_fasta}",
os.path.join(package_path, "template"), "{input.canu_correction}", "{input.canu_fasta}",
"{input.canu_bog_gfa}", "{input.canu_bog}", "{input.canu_paf}",
"{input.canu_con}", "{input.canu_uni}", "{input.canu_on_minimap_paf}", "{input.canu_on_minimap_legend}",
"{input.canu_contig_report_csv}", "{input.canu_contig_report_png}",
......
......@@ -21,6 +21,7 @@ rule report:
rule create_report:
input:
canu_correction = canu_correction_report,
canu_fasta = canu_contigs + ".fasta",
canu_bog_gfa = canu_bog + ".gfa",
canu_bog = canu_bog + ".png",
......@@ -38,12 +39,12 @@ rule create_report:
shell:
" ".join([
package_path + config['report_generator']['bin'], "canu_only",
os.path.join(package_path, "template"), "{input.canu_fasta}",
"{input.canu_bog_gfa}", "{input.canu_bog}", "{input.canu_paf}",
"{input.canu_con}", "{input.canu_uni}", "{input.canu_on_paf}",
"{input.canu_on_paf_legend}", "{input.canu_contig_report_csv}",
"{input.canu_contig_report_png}", "{input.path_between_contig}", "\""+in_path+"\"",
"{output}"
os.path.join(package_path, "template"), "{input.canu_correction}",
"{input.canu_fasta}", "{input.canu_bog_gfa}", "{input.canu_bog}",
"{input.canu_paf}", "{input.canu_con}", "{input.canu_uni}",
"{input.canu_on_paf}", "{input.canu_on_paf_legend}",
"{input.canu_contig_report_csv}", "{input.canu_contig_report_png}",
"{input.path_between_contig}", "\""+in_path+"\"", "{output}"
])
# Graph projection
......
......@@ -39,6 +39,8 @@ import matplotlib.patches as mpatches
from io import BytesIO
from bs4 import BeautifulSoup
def generate_legend(path):
patch_list = list()
label_list = list()
......@@ -61,9 +63,22 @@ def generate_legend(path):
return figfile
def read_canu_input_dataset(canu_correction):
nb_keep_read_td = "no data sorry"
nb_not_keep_read_td = "no data sorry"
with open(canu_correction) as fd:
soup = BeautifulSoup(fd, 'html.parser')
fastq_td = soup.find("td", string="FASTQ")
nb_keep_read_td = fastq_td.find_next("td")
nb_not_keep_read_td = nb_keep_read_td.find_next("td")
return nb_keep_read_td.get_text(), nb_not_keep_read_td.get_text()
@begin.subcommand
def canu_only(template_path, canu_fasta, canu_bog_gfa, canu_bog, canu_paf,
canu_contig, canu_unitig, canu_contig_on_paf,
def canu_only(template_path, canu_correction_report, canu_fasta, canu_bog_gfa,
canu_bog, canu_paf, canu_contig, canu_unitig, canu_contig_on_paf,
canu_contig_on_paf_legend, canu_contig_report_csv,
canu_contig_report_png, path_search_result, list_input_file, out_filename):
......@@ -93,6 +108,7 @@ def canu_only(template_path, canu_fasta, canu_bog_gfa, canu_bog, canu_paf,
# Build dict for complet template
param = dict()
param["list_input"] = list_input_file
param["info_input_dataset"] = read_canu_input_dataset(canu_correction_report)
param["canu_bog"] = str(base64.b64encode(open(canu_bog, "rb").read()))[2:-1]
param["canu_paf"] = str(base64.b64encode(open(canu_paf, "rb").read()))[2:-1]
param["canu_contig"] = str(base64.b64encode(open(canu_contig, "rb").read()))[2:-1]
......@@ -130,10 +146,12 @@ def canu_only(template_path, canu_fasta, canu_bog_gfa, canu_bog, canu_paf,
f.write(template.render(param))
@begin.subcommand
def canu_minimap(template_path, canu_fasta, canu_bog_gfa, canu_bog, canu_paf,
canu_contig, canu_unitig, canu_contig_on_minimap, canu_contig_on_minimap_legend,
def canu_minimap(template_path, canu_correction_report, canu_fasta, canu_bog_gfa,
canu_bog, canu_paf, canu_contig, canu_unitig,
canu_contig_on_minimap, canu_contig_on_minimap_legend,
canu_contig_report_csv, canu_contig_report_png, minimap_paf,
minimap_png, canu_path_search_result, mini_path_search_result, list_input_file, out_filename):
minimap_png, canu_path_search_result, mini_path_search_result,
list_input_file, out_filename):
# generate stat from canu_fasta
total_len = 0
......@@ -175,6 +193,7 @@ def canu_minimap(template_path, canu_fasta, canu_bog_gfa, canu_bog, canu_paf,
# Build dict for complet template
param = dict()
param["list_input"] = list_input_file
param["info_input_dataset"] = read_canu_input_dataset(canu_correction_report)
param["canu_bog"] = str(base64.b64encode(open(canu_bog, "rb").read()))[2:-1]
param["canu_paf"] = str(base64.b64encode(open(canu_paf, "rb").read()))[2:-1]
param["canu_contig"] = str(base64.b64encode(open(canu_contig, "rb").read()))[2:-1]
......@@ -238,8 +257,9 @@ def canu_minimap(template_path, canu_fasta, canu_bog_gfa, canu_bog, canu_paf,
f.write(template.render(param))
@begin.subcommand
def canu_miniasm(template_path, canu_fasta, canu_bog_gfa, canu_bog, canu_paf,
canu_contig, canu_unitig, canu_contig_on_minimap, canu_contig_on_minimap_legend,
def canu_miniasm(template_path, canu_correction_report, canu_fasta, canu_bog_gfa,
canu_bog, canu_paf, canu_contig, canu_unitig,
canu_contig_on_minimap, canu_contig_on_minimap_legend,
canu_contig_report_csv, canu_contig_report_png, minimap_paf,
minimap_png, miniasm_gfa, miniasm_png, canu_path_search_result,
mini_path_search_result, list_input_file, out_filename):
......@@ -298,6 +318,7 @@ def canu_miniasm(template_path, canu_fasta, canu_bog_gfa, canu_bog, canu_paf,
# Build dict for complet template
param = dict()
param["list_input"] = list_input_file
param["info_input_dataset"] = read_canu_input_dataset(canu_correction_report)
param["canu_bog"] = str(base64.b64encode(open(canu_bog, "rb").read()))[2:-1]
param["canu_paf"] = str(base64.b64encode(open(canu_paf, "rb").read()))[2:-1]
param["canu_contig"] = str(base64.b64encode(open(canu_contig, "rb").read()))[2:-1]
......
......@@ -10,12 +10,7 @@
<body>
<!-- INPUT REPORT -->
<h1>Input</h1>
<p>
{{list_input}}
</p>
{% include 'input_report.jinja2.html' %}
<!-- CANU REPORT -->
{% include 'canu_report.jinja2.html' %}
......
......@@ -9,12 +9,7 @@
<body>
<!-- INPUT REPORT -->
<h1>Input</h1>
<p>
{{list_input}}
</p>
{% include 'input_report.jinja2.html' %}
{% include 'canu_report.jinja2.html' %}
......
......@@ -9,12 +9,7 @@
<body>
<!-- INPUT REPORT -->
<h1>Input</h1>
<p>
{{list_input}}
</p>
{% include 'input_report.jinja2.html'%}
{% include 'canu_report.jinja2.html' %}
......
<h1>Input</h1>
<p>
{{list_input}}
</p>
<p>
Information extract by Canu on dataset :
<ul>
<li>Read and base keept : {{info_input_dataset[0]}}</li>
<li>Read and base not keept : {{info_input_dataset[1]}}</li>
</ul>
</p>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment