Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EVA-3525 update validation report #39

Merged
merged 3 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions bin/eva-sub-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ def get_version():
'upload to the EVA')
credential_group.add_argument("--username", help="Username used for connecting to the ENA webin account")
credential_group.add_argument("--password", help="Password used for connecting to the ENA webin account")
argparser.add_argument("--resume", default=False, action='store_true',
help="Resume the process execution from where it left of. This is currently only supported "
"for the upload part of the SUBMIT task.")

args = argparser.parse_args()

Expand Down
10 changes: 7 additions & 3 deletions eva_sub_cli/jinja_templates/fasta_check.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@

{% macro fasta_check_report(validation_results, file_name) -%}
{% set results_for_fasta = validation_results['fasta_check'][file_name] %}

{% set expand_icon = "" %}
<!-- All INSDC check results -->
{% if results_for_fasta.get('all_insdc') %}
{% set icon = "&#10004;" %}
{% set row_class = "report-section pass" %}
{% set text = "All sequences are INSDC accessioned" %}
{% else %}
{% set expand_icon = "&#9654;" %}
{% set icon = "&#10060;" %}
{% set row_class = "report-section fail collapsible" %}
{% set text = "Some sequences are not INSDC accessioned" %}
{% endif %}
<div class='{{ row_class }}'>{{ icon }} {{ text }} </div>
<div class='{{ row_class }}'><span class="expand_icon">{{ expand_icon }}</span> {{ icon }} {{ text }} </div>
{% if not results_for_fasta.get('all_insdc') %}
<div class="error-list">
<div class="error-description">First 10 sequences not in INSDC. <strong>Full report:</strong> {{ results_for_fasta.get('report_path', '') }}</div>
Expand All @@ -35,22 +36,25 @@
{% if 'metadata_assembly_compatible' in results_for_fasta %}
<!-- found assembly in metadata, so definitely know the analysis -->
{% set analysis_text = results_for_fasta.get('associated_analyses')|join(", ") %}
{% set expand_icon = "" %}
{% if results_for_fasta.get('metadata_assembly_compatible') %}
{% set icon = "&#10004;" %}
{% set row_class = "report-section pass" %}
{% set text = analysis_text + ": Assembly accession in metadata is compatible" %}
{% else %}
{% set expand_icon = "&#9654;" %}
{% set icon = "&#10060;" %}
{% set row_class = "report-section fail collapsible" %}
{% set text = analysis_text + ": Assembly accession in metadata is not compatible" %}
{% endif %}
{% else %}
<!-- has possible assemblies but no metadata assembly -->
{% set expand_icon = "&#9654;" %}
{% set icon = "&#10060;" %}
{% set row_class = "report-section fail collapsible" %}
{% set text = "No assembly accession found in metadata" %}
{% endif %}
<div class='{{ row_class }}'>{{ icon }} {{ text }} </div>
<div class='{{ row_class }}'><span class="expand_icon">{{ expand_icon }}</span> {{ icon }} {{ text }} </div>
{% if 'metadata_assembly_compatible' not in results_for_fasta or not results_for_fasta['metadata_assembly_compatible'] %}
<div class="error-list">
<div class="error-description"><strong>Full report:</strong> {{ results_for_fasta.get('report_path', '') }}</div>
Expand Down
10 changes: 7 additions & 3 deletions eva_sub_cli/jinja_templates/file_validation.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@
{% macro vcf_check(vcf_check_result) %}
{% set critical_count = vcf_check_result.get("critical_count", 0) %}
{% set error_count = vcf_check_result.get("error_count", 0) %}
{% set warning_count = vcf_check_result.get("warning_count", 0) %}
{% set expand_icon = "" %}
{% if critical_count > 0 %}
{% set expand_icon = "&#9654;" %}
{% set icon = "&#10060;" %}
{% set row_class = "report-section fail collapsible" %}
{% elif error_count > 0 %}
{% set expand_icon = "&#9654;" %}
{% set icon = "&#10060;" %}
{% set row_class = "report-section warn collapsible" %}
{% else %}
{% set icon = "&#10004;" %}
{% set row_class = "report-section pass" %}
{% endif %}
<div class='{{ row_class }}'>{{ icon }} VCF check: {{ critical_count }} critical errors, {{ error_count }} non-critical errors, {{ warning_count }} warnings </div>
<div class='{{ row_class }}'><span class="expand_icon">{{ expand_icon }}</span> {{ icon }} VCF check: {{ critical_count }} critical errors, {{ error_count }} non-critical errors </div>
{% set critical_list = vcf_check_result.get("critical_list") %}
{% set error_list = vcf_check_result.get("error_list") %}

Expand Down Expand Up @@ -54,14 +56,16 @@
{% set nb_match = assembly_check_result.get("match", 0) %}
{% set nb_total = assembly_check_result.get("total", 0) %}
{% set match_percentage = nb_match / nb_total * 100 if nb_total else 0 %}
{% set expand_icon = "" %}
{% if assembly_check_result.get("nb_mismatch", 0) > 0 %}
{% set expand_icon = "&#9654;" %}
{% set icon = "&#10060;" %}
{% set row_class = "report-section fail collapsible" %}
{% else %}
{% set icon = "&#10004;" %}
{% set row_class = "report-section pass" %}
{% endif %}
<div class='{{ row_class }}'>{{ icon }} Assembly check: {{ nb_match }}/{{ nb_total }} ({{ match_percentage|round(2) }}%)</div>
<div class='{{ row_class }}'><span class="expand_icon">{{ expand_icon }}</span> {{ icon }} Assembly check: {{ nb_match }}/{{ nb_total }} ({{ match_percentage|round(2) }}%)</div>
{% set mismatch_list = assembly_check_result.get("mismatch_list") %}
{% set error_list = assembly_check_result.get("error_list") %}
{% if mismatch_list or error_list %}
Expand Down
38 changes: 26 additions & 12 deletions eva_sub_cli/jinja_templates/html_report.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!DOCTYPE html>
{% from 'project_details.html' import project_details_report %}
{% from 'file_validation.html' import file_validation_report %}
{% from 'sample_name_check.html' import sample_name_check_report %}
{% from 'fasta_check.html' import fasta_check_report %}
Expand All @@ -20,15 +21,17 @@
.description { padding-bottom: 10px}
.error-description { padding: 10px 0px 10px}

.report-section { padding: 12px; border: 1px solid white; }
.active, .collapsible:hover, .fail { background-color: #e6a3ae; }
.report-section { padding: 12px; border: 1px solid white; margin-bottom: 5px}
.active, .collapsible:hover.fail { background-color: #e6a3ae; }
.active, .collapsible:hover.info { background-color: #c0c0c0; }

table { border-collapse: collapse; padding: 10px; }
table { border-collapse: collapse; padding: 10px; margin-bottom: 20px}
th, td { border: 1px solid black; padding: 8px; text-align: left; }
th { background-color: lightgrey; }
.fail { background-color: #FFB6C1; }
.pass { background-color: #90EE90; }
.error-list { display: none; }
.info { background-color: #dadada; }
.error-list, .no-show { display: none; }
</style>
</head>
<body>
Expand All @@ -38,28 +41,31 @@
<img src="data:image/png;base64,{{ logo_data }}" width="100" height="100" alt="EVA logo">
</div>
<div class="title">
{% if project_title %}
<h1>Validation Report: {{ project_title }}</h1>
{% else %}
<h1>Validation Report</h1>
{% endif %}
Generated at {{ validation_date }}
<h1>Validation Report</h1>
</div>
</header>

<section>
<h2>Project Summary</h2>
<div class="description">
General details about the project
</div>
{{ project_details_report(project_title, validation_date, submission_dir, vcf_fasta_analysis_mapping) }}
</section>

<section>
<h2>Metadata validation results</h2>
<div class="description">
Ensures that required fields are present and values are formatted correctly.
For requirements, please refer to the <a href="https://www.ebi.ac.uk/eva/?Submit-Data">EVA website</a>.
For requirements, please refer to the <a href="https://www.ebi.ac.uk/eva/?Submit-Data" target=”_blank”>EVA website</a>.
</div>
{{ metadata_validation_report(validation_results) }}
</section>

<section>
<h2>VCF validation results</h2>
<div class="description">
Checks whether each file is compliant with the <a href="http://samtools.github.io/hts-specs/VCFv4.3.pdf">VCF specification</a>.
Checks whether each file is compliant with the <a href="http://samtools.github.io/hts-specs/VCFv4.3.pdf" target=”_blank”>VCF specification</a>.
Also checks whether the variants' reference alleles match against the reference assembly.
</div>
{% for file_name in vcf_files %}
Expand Down Expand Up @@ -93,6 +99,14 @@ <h3>{{ file_name }}</h3>
for (let collapsible of collapsibles) {
collapsible.addEventListener('click', function() {
this.classList.toggle('active');

let icon = this.querySelector('.expand_icon');
if (this.classList.contains('active')) {
icon.innerHTML = '&#9660;';
} else {
icon.innerHTML = '&#9654;';
}

let content = this.nextElementSibling;
if (content.style.display === 'block') {
content.style.display = 'none';
Expand Down
3 changes: 2 additions & 1 deletion eva_sub_cli/jinja_templates/metadata_validation.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
{% set results = validation_results.get('metadata_check', {}) %}
{% set spreadsheet_errors = results.get('spreadsheet_errors', []) %}
{% if spreadsheet_errors %}
{% set expand_icon = "&#9654;" %}
{% set icon = "&#10060;" %}
{% set row_class = "report-section fail collapsible" %}
{% else %}
{% set icon = "&#10004;" %}
{% set row_class = "report-section pass" %}
{% endif %}
<div class='{{ row_class }}'>{{ icon }} Metadata validation check </div>
<div class='{{ row_class }}'><span class="expand_icon">{{ expand_icon }}</span> {{ icon }} Metadata validation check </div>
{% if spreadsheet_errors %}
<div class="error-list">
<div class="error-description"><strong>Full report:</strong> {{ results.get('spreadsheet_report_path', '') }}</div>
Expand Down
35 changes: 35 additions & 0 deletions eva_sub_cli/jinja_templates/project_details.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{% macro project_details_report(project_title, validation_date, submission_dir, vcf_fasta_analysis_mapping) -%}
<div class="report-section info">
{% if project_title %}
<p><b>Project Title:</b> {{ project_title }}</p>
{% else %}
<p><b>Project Title:</b> Not Found</p>
{% endif %}
<p><b>Validation Date:</b> {{ validation_date }}</p>
<p><b>Submission Directory:</b> {{ submission_dir }}</p>
</div>

{% if vcf_fasta_analysis_mapping %}
{% set row_class = "report-section info collapsible" %}
{% set expand_icon = "&#9654;" %}
<div class='{{ row_class }}'><span class="expand_icon">{{ expand_icon }}</span> Files mapping</div>
<div class="no-show">
<table>
<tr>
<th><strong>VCF File</strong></th>
<th><strong>Fasta File</strong></th>
<th><strong>Analysis</strong></th>
</tr>
{% for mapping in vcf_fasta_analysis_mapping %}
<tr>
<td>{{ mapping.vcf_file }}</td>
<td>{{ mapping.fasta_file }}</td>
<td>{{ mapping.analysis }}</td>
</tr>
{% endfor %}
</table>
</div>
</div>
{% endif %}

{%- endmacro %}
5 changes: 4 additions & 1 deletion eva_sub_cli/jinja_templates/sample_name_check.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
{% set results = validation_results.get('sample_check', {}) %}
{% for analysis, results_for_analysis in results.get('results_per_analysis', {}).items() %}
{% if results_for_analysis.get('difference') %}
{% set expand_icon = "&#9654;" %}
{% set icon = "&#10060;" %}
{% set row_class = "report-section fail collapsible" %}
{% set text = "Sample names in metadata do not match with those in VCF files" %}
{% else %}
{% set icon = "&#10004;" %}
{% set row_class = "report-section pass" %}
{% set text = "Sample names in metadata match with those in VCF files" %}
{% endif %}
<div class='{{ row_class }}'>{{ icon }} {{ analysis }}: Sample names concordance check </div>
<div class='{{ row_class }}'><span class="expand_icon">{{ expand_icon }}</span> {{ icon }} {{ analysis }}: {{ text }} </div>
{% if results_for_analysis.get('difference') %}
<div class="error-list">
<div class="error-description">First 10 errors per category are below. <strong>Full report:</strong> {{ results.get('report_path', '') }}</div>
Expand Down
Loading
Loading