Skip to content

Commit

Permalink
EVA-3581 Add option to see all errors of all categories for a sample (#…
Browse files Browse the repository at this point in the history
…41)

* add option to see all errors of all categories for a sample
  • Loading branch information
nitin-ebi authored Jun 17, 2024
1 parent 0233459 commit 690610e
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bin/xlsx2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
ANALYSIS_ALIAS_KEY = 'Analysis Alias'
SAMPLE_NAME_IN_VCF_KEY = 'Sample Name in VCF'
SAMPLE_ACCESSION_KEY = 'Sample Accession'
SAMPLE_NAME_KEY = 'Sample Name'
SAMPLE_NAME_KEY = 'BioSample Name'
SCIENTIFIC_NAME_KEY = 'Scientific Name'
SPECIES = 'species'

Expand Down
Binary file modified eva_sub_cli/etc/EVA_Submission_template.xlsx
Binary file not shown.
4 changes: 2 additions & 2 deletions eva_sub_cli/etc/spreadsheet2json_conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Sample:
Sample Name in VCF: sampleInVCF
optional:
Sample Accession: bioSampleAccession
Sample Name: bioSampleName
BioSample Name: bioSampleName
Title: title
Description: description
Unique Name: uniqueName
Expand Down Expand Up @@ -114,7 +114,7 @@ Sample:
serovar: serovar
cast:
Sample ID: string
Sample Name: string
BioSample Name: string


Files:
Expand Down
12 changes: 12 additions & 0 deletions eva_sub_cli/jinja_templates/html_report.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,18 @@ <h3>{{ file_name }}</h3>
}
});
}

function toggleSampleAllErrorsList(id) {
var element = document.getElementById(id);
var link = document.querySelector(`a[onclick="toggleSampleAllErrorsList('${id}'); return false;"]`);
if (element.style.display === "none" || element.style.display === "") {
element.style.display = "block";
link.innerHTML = "Hide All Errors for Category";
} else {
element.style.display = "none";
link.innerHTML = "Show All Errors for Category";
}
}
</script>
</body>
</html>
35 changes: 30 additions & 5 deletions eva_sub_cli/jinja_templates/sample_name_check.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

{% macro sample_name_check_report(validation_results) -%}
{% set results = validation_results.get('sample_check', {}) %}
{% macro format_error(error) %}
{{ error | replace(' ', '•') }}
{% endmacro %}

{% for analysis, results_for_analysis in results.get('results_per_analysis', {}).items() %}
{% if results_for_analysis.get('difference') %}
{% set expand_icon = "&#9654;" %}
Expand All @@ -12,23 +16,44 @@
{% set row_class = "report-section pass" %}
{% set text = "Sample names in metadata match with those in VCF files" %}
{% endif %}
<div class='{{ row_class }}'><span class="expand_icon">{{ expand_icon }}</span> {{ icon }} {{ analysis }}: {{ text }} </div>
<div class='{{ row_class }}'><span class="expand_icon">{{ expand_icon }}</span> {{ icon }} <b>{{ analysis }}</b>: {{ 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>
<table>
<tr>
<th>Category</th><th>Error</th>
<th>Category</th><th>First 5 Errors For Category</th><th>Link To View All Errors</th>
</tr>
<tr>
<td><strong>Samples described in the metadata but not in the VCF files</strong></td>
<td>{{ results_for_analysis.get('more_metadata_submitted_files')[:10]|join(", ") }}</td>
<td>{{ results_for_analysis.get('more_metadata_submitted_files')[:5]|join(", ") }}</td>
<td> <a href="#" onclick="toggleSampleAllErrorsList('metadata-{{ loop.index0 }}'); return false;">Show All Errors For Category</a></td>
</tr>
<tr>
<td><strong>Samples in the VCF files but not described in the metadata</strong></td>
<td>{{ results_for_analysis.get('more_submitted_files_metadata')[:10]|join(", ") }}</td>
<td>{{ results_for_analysis.get('more_submitted_files_metadata')[:5]|join(", ") }}</td>
<td> <a href="#" onclick="toggleSampleAllErrorsList('vcf-{{ loop.index0 }}'); return false;">Show All Errors For Category</a></td>
</tr>
</table>

<div id="metadata-{{ loop.index0 }}" class="description no-show">
<div class="error-description"><strong>All Errors For Category - Samples described in the metadata but not in the VCF files:</strong></div>
<ol>
{% for error in results_for_analysis.get('more_metadata_submitted_files') %}
<li>{{ format_error(error) }}</li>
{% endfor %}
</ol>
<a href="#" onclick="toggleSampleAllErrorsList('metadata-{{ loop.index0 }}'); return false;">Hide</a>
</div>

<div id="vcf-{{ loop.index0 }}" class="description no-show">
<div class="error-description"><strong>All Errors For Category - Samples in the VCF files but not described in the metadata:</strong></div>
<ol>
{% for error in results_for_analysis.get('more_submitted_files_metadata') %}
<li>{{ format_error(error) }}</li>
{% endfor %}
</ol>
<a href="#" onclick="toggleSampleAllErrorsList('vcf-{{ loop.index0 }}'); return false;">Hide</a>
</div>
</div>
{% endif %}
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion eva_sub_cli/validators/docker_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
logger = logging_config.get_logger(__name__)

container_image = 'ebivariation/eva-sub-cli'
container_tag = 'v0.0.1.dev7'
container_tag = 'v0.0.1.dev8'
container_validation_dir = '/opt/vcf_validation'
container_validation_output_dir = 'vcf_validation_output'

Expand Down
Binary file modified tests/resources/EVA_Submission_test.xlsx
Binary file not shown.
Binary file modified tests/resources/EVA_Submission_test_fails.xlsx
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/resources/validation_reports/expected_report.html

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions tests/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,21 @@
'results_per_analysis': {
'Analysis A': {
'difference': True,
'more_metadata_submitted_files': ['Sample1'],
'more_metadata_submitted_files': [' SampleA1', 'SampleA2 ','SampleA3', 'SampleA4', 'SampleA5', 'SampleA6', 'SampleA7','SampleA8', 'SampleA9', 'SampleA10'],
'more_per_submitted_files_metadata': {},
'more_submitted_files_metadata': ['1Sample']
'more_submitted_files_metadata': ['A1Sample ', ' A2Sample', 'A3Sample', 'A4Sample', 'A5Sample', 'A6Sample', 'A7Sample', 'A8Sample', 'A9Sample', 'A10Sample']
},
'Analysis B': {
'difference': False,
'more_metadata_submitted_files': [],
'more_per_submitted_files_metadata': {},
'more_submitted_files_metadata': []
},
'Analysis C': {
'difference': True,
'more_metadata_submitted_files': ['SampleC1 ', ' SampleC2', 'SampleC3', 'SampleC4'],
'more_per_submitted_files_metadata': {},
'more_submitted_files_metadata': ['C1Sample ', ' C2Sample', 'C3Sample', 'C4Sample']
}
}
},
Expand Down

0 comments on commit 690610e

Please sign in to comment.