Skip to content

Commit

Permalink
Fixed reporting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
GallVp committed Feb 27, 2024
1 parent 294c4a2 commit 321de30
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 33 deletions.
7 changes: 6 additions & 1 deletion bin/assemblyqc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
from report_modules.parsers.circos_parser import parse_circos_folder

if __name__ == "__main__":
params_dict, params_table = parse_params_json()
params_dict, params_table = parse_params_json("params_json.json")
params_summary_dict, params_summary_table = parse_params_json(
"params_summary_json.json"
)
tools_dict, tools_table = parse_tools_yaml()

data_from_tools = {}
Expand All @@ -51,6 +54,8 @@
data_from_tools = {
"PARAMS_DICT": params_dict,
"PARAMS_TABLE": params_table,
"PARAMS_SUMMARY_DICT": params_summary_dict,
"PARAMS_SUMMARY_TABLE": params_summary_table,
"TOOLS_DICT": tools_dict,
"TOOLS_TABLE": tools_table,
"VERSIONS": {
Expand Down
29 changes: 3 additions & 26 deletions bin/report_modules/parsers/params_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,9 @@ def highlight_json(json_string):
return highlight(json_string, lexer, formatter)


def format_params_dict(json_dict):
formatted_dict = {}
for key, value in json_dict.items():
if key in ["max_cpus", "max_memory", "max_time"]:
continue

if not isinstance(value, dict):
formatted_dict[key] = value
continue

if "skip" in value.keys():
if value["skip"] == 1:
formatted_dict[key] = "Skipped"
continue

formatted_dict[key] = value
formatted_dict[key].pop("skip", None)

return formatted_dict


def parse_params_json():
with open("params_json.json", "r") as f:
def parse_params_json(file_name):
with open(file_name, "r") as f:
params_dict = json.load(f)
formatted_dict_json = highlight_json(
json.dumps(format_params_dict(params_dict), indent=4)
)
formatted_dict_json = highlight_json(json.dumps(params_dict, indent=4))

return params_dict, formatted_dict_json
2 changes: 1 addition & 1 deletion bin/report_modules/templates/params/contents.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<div class="section-heading">Pipeline Parameters</div>
</div>
<div class="section-para-wrapper"><p class="section-para">Only displaying parameters that differ from the pipeline defaults.</p></div>
{{ all_stats_dicts['PARAMS_TABLE'] }}
{{ all_stats_dicts['PARAMS_SUMMARY_TABLE'] }}
</div>
</div>
4 changes: 4 additions & 0 deletions lib/WorkflowAssemblyqc.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class WorkflowAssemblyqc {
}

public static String jsonifyParams(params) {
return JsonOutput.toJson(params).toString()
}

public static String jsonifySummaryParams(params) {

def summary = [:]
for (group in params.keySet()) {
Expand Down
19 changes: 15 additions & 4 deletions modules/local/createreport.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ process CREATEREPORT {
tag "AssemblyQC"
label 'process_single'

// container "docker.io/gallvp/python3npkgs:v0.4"
container "docker.io/gallvp/python3npkgs:v0.6"

input:
path fastavalidator_logs, stageAs: 'fastavalidator_logs/*'
Expand All @@ -19,19 +19,30 @@ process CREATEREPORT {
path circos_outputs, stageAs: 'circos_outputs/*'
path versions
val params_json
val params_summary_json

output:
path 'report.html' , emit: html
path 'report.json' , emit: json
path "versions.yml" , emit: versions
path 'versions.yml' , emit: versions

when:
task.ext.when == null || task.ext.when

script:
"""
echo -n '$params_json' > params_json.json
assemblyqc.py > report.html
echo \\
-n \\
'$params_json' \\
> params_json.json
echo \\
-n \\
'$params_summary_json' \\
> params_summary_json.json
assemblyqc.py \\
> report.html
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
3 changes: 2 additions & 1 deletion workflows/assemblyqc.nf
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@ workflow ASSEMBLYQC {
ch_hic_html .collect().ifEmpty([]),
ch_synteny_plot .collect().ifEmpty([]),
CUSTOM_DUMPSOFTWAREVERSIONS .out.yml,
Channel.of ( WorkflowAssemblyqc.jsonifyParams ( summary_params ) )
Channel.of ( WorkflowAssemblyqc.jsonifyParams ( params ) ),
Channel.of ( WorkflowAssemblyqc.jsonifySummaryParams ( summary_params ) )
)
}

Expand Down

0 comments on commit 321de30

Please sign in to comment.