Skip to content

Commit

Permalink
Setup from scratch - show sites name to make deployment mistakes easi…
Browse files Browse the repository at this point in the history
…er to catch
  • Loading branch information
davmlaw committed Aug 5, 2024
1 parent 2eff210 commit 5c0caf6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion annotation/templates/annotation/annotation_build_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ <h5>RefSeq GRCh38</h5>
Not installed
{% endif %}
{% install-instructions "Somalier" installed=details.somalier %}
Upload the Somalier sites VCF for {{ build_name }}.
Upload the Somalier sites VCF for {{ build_name }}
{% if expected_somalier_sites_name %}
: '{{ expected_somalier_sites_name }}'
{% endif %}
.
{% endinstall-instructions %}
{% endlabelled %}
{% endif %}
Expand Down
3 changes: 3 additions & 0 deletions annotation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ def annotation_build_detail(request, genome_build_name):
if settings.ANNOTATION_GENE_ANNOTATION_VERSION_ENABLED:
annotation_sub_components.append(gene_annotation_counts)

expected_somalier_sites_name = None
if settings.SOMALIER.get("enabled"):
somalier_cfg = SomalierConfig()
try:
expected_somalier_sites_name = somalier_cfg.get_sites_vcf_name(genome_build)
vcf = somalier_cfg.get_sites_vcf(genome_build)
annotation_details["somalier"] = f"Sites VCF: {vcf.name}"
somalier = True
Expand All @@ -164,6 +166,7 @@ def annotation_build_detail(request, genome_build_name):
"build_name": genome_build.name,
"details": annotation_details,
"cdot_version": cdot.__version__,
"expected_somalier_sites_name": expected_somalier_sites_name,
}
return render(request, "annotation/annotation_build_detail.html", context)

Expand Down
5 changes: 4 additions & 1 deletion snpdb/models/models_somalier.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,11 @@ def get_sites(self, genome_build: 'GenomeBuild'):
sites = self.settings["annotation"]["sites"][genome_build.name]
return self._annotation_dir(sites)

def get_sites_vcf_name(self, genome_build: 'GenomeBuild') -> str:
return os.path.basename(self.get_sites(genome_build))

def get_sites_vcf(self, genome_build: 'GenomeBuild'):
sites_name = os.path.basename(self.get_sites(genome_build))
sites_name = self.get_sites_vcf_name(genome_build)
sites_vcf_kwargs = {"name": sites_name, "genome_build": genome_build}
try:
return VCF.objects.get(**sites_vcf_kwargs)
Expand Down

0 comments on commit 5c0caf6

Please sign in to comment.