Skip to content

Commit

Permalink
Franklin variant link (#5041)
Browse files Browse the repository at this point in the history
* Add button with variant Franklin link.

* Fix code style issues with Black

* Make specific link for cancer track

* Fix code style issues with Black

* Apply suggestions from code review to simplify track check

Co-authored-by: Daniel Nilsson <[email protected]>

* one more case_obj for the road

* fix sonarcloud complaint

* one more button to link

* it could have said that before - probably did really

---------

Co-authored-by: molu <[email protected]>
Co-authored-by: Lint Action <[email protected]>
Co-authored-by: Chiara Rasi <[email protected]>
  • Loading branch information
4 people authored Nov 19, 2024
1 parent e950cee commit f3a9778
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ About changelog [here](https://keepachangelog.com/en/1.0.0/)

## [unreleased]
### Added
- Variant link to Franklin in database buttons (different depending on rare or cancer track)
- MANE badges on list of variant's Genes/Transcripts/Proteins table, this way also SVs will display MANE annotations
- Export variant type and callers-related info fields when exporting variants from variants pages
- Cases advanced search on the dashboard page
Expand Down
17 changes: 9 additions & 8 deletions scout/server/blueprints/variant/templates/variant/buttons.html
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
{% macro database_buttons(variant) %}
<div class="mt-3">
<a class="btn btn-sm btn-info text-white me-1 mb-1" role="button" href="{{ variant.swegen_link }}" target="_blank">SweGen</a>
<a class="btn btn-sm btn-info text-white me-1 mb-1" role="button" href="{{ variant.beacon_link }}" target="_blank">Beacon</a>
<a class="btn btn-sm btn-info text-white me-1 mb-1" href="{{ variant.swegen_link }}" rel="noreferrer noopener" target="_blank">SweGen</a>
<a class="btn btn-sm btn-info text-white me-1 mb-1" href="{{ variant.beacon_link }}" rel="noreferrer noopener" target="_blank">Beacon</a>
<a class="btn btn-sm btn-info text-white me-1 mb-1" href="{{ variant.franklin_link }}" rel="noreferrer noopener" target="_blank">Franklin</a>
{% if variant.cosmic_links %} <!-- This is a list of tuples : [(id1, link1), (id2, link2), ..] -->
{% for cosmic_link in variant.cosmic_links %}
<a data-bs-toggle="tooltip" title="COSMIC" class="btn btn-sm btn-info text-white me-1 mb-1" role="button" href="{{cosmic_link[1]}}" target="_blank">{{cosmic_link[0]}}</a>
<a data-bs-toggle="tooltip" title="COSMIC" class="btn btn-sm btn-info text-white me-1 mb-1" rel="noreferrer noopener" href="{{cosmic_link[1]}}" target="_blank">{{cosmic_link[0]}}</a>
{% endfor %}
{% endif %}
{% if variant.dbsnp_id %}
{% for snp in variant.dbsnp_id.split(';') %}
<a class="btn btn-sm btn-info text-white me-1 mb-1" role="button" target="_blank" href="{{variant.snp_links[snp]}}">dbSNP ({{ snp }})</a>
<a class="btn btn-sm btn-info text-white me-1 mb-1" target="_blank" rel="noreferrer noopener" href="{{variant.snp_links[snp]}}">dbSNP ({{ snp }})</a>
{% endfor %}
{% endif %}
</div>
<div class="btn-group">
{% if primary_transcript and primary_transcript.varsome_link %}
<a href="{{ primary_transcript.varsome_link }}" class="btn btn-sm btn-info text-white me-1 mb-1" role="button" target="_blank"
<a href="{{ primary_transcript.varsome_link }}" class="btn btn-sm btn-info text-white me-1 mb-1" rel="noreferrer noopener" target="_blank"
data-bs-toggle="tooltip" title="Varsome">V</a>
{% endif %}
{% if primary_transcript and primary_transcript.tp53_link %}
<a href="{{ primary_transcript.tp53_link }}" class="btn btn-sm btn-info text-white me-1 mb-1" role="button" target="_blank"
<a href="{{ primary_transcript.tp53_link }}" class="btn btn-sm btn-info text-white me-1 mb-1" rel="noreferrer noopener" target="_blank"
data-bs-toggle="tooltip" title="MutanTP53">TP53</a>
{% endif %}
{% if primary_transcript and primary_transcript.cbioportal_link %}
<a href="{{ primary_transcript.cbioportal_link }}" class="btn btn-sm btn-info text-white me-1 mb-1" role="button" target="_blank"
<a href="{{ primary_transcript.cbioportal_link }}" class="btn btn-sm btn-info text-white me-1 mb-1" rel="noreferrer noopener" target="_blank"
data-bs-toggle="tooltip" title="cBioPortal">CBP</a>
{% endif %}
{% if primary_transcript and primary_transcript.mycancergenome_link %}
<a href="{{ primary_transcript.mycancergenome_link }}" class="btn btn-sm btn-info text-white me-1 mb-1" role="button" target="_blank"
<a href="{{ primary_transcript.mycancergenome_link }}" class="btn btn-sm btn-info text-white me-1 mb-1" rel="noreferrer noopener" target="_blank"
data-bs-toggle="tooltip" title="MyCancerGenome">MCG</a>
{% endif %}
</div>
Expand Down
20 changes: 19 additions & 1 deletion scout/server/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def add_tx_links(tx_obj, build=37, hgnc_symbol=None):
return tx_obj


## Transcript links
# Transcript links
def refseq(refseq_id):
link = "http://www.ncbi.nlm.nih.gov/nuccore/{}"
if not refseq_id:
Expand Down Expand Up @@ -480,6 +480,7 @@ def get_variant_links(institute_obj: dict, variant_obj: dict, build: int = None)
swegen_link=swegen_link(variant_obj),
cosmic_links=cosmic_links(variant_obj),
beacon_link=beacon_link(variant_obj, build),
franklin_link=franklin_link(variant_obj, build),
ucsc_link=ucsc_link(variant_obj, build),
decipher_link=decipher_link(variant_obj, build),
ensembl_link=ensembl_link(variant_obj, build),
Expand Down Expand Up @@ -633,6 +634,23 @@ def swegen_link(variant_obj):
return url_template.format(this=variant_obj)


def franklin_link(variant_obj: dict, build: int = 37):
"""Compose link to Franklin Variant Frequency Database."""
if variant_obj["category"] in ["cancer", "cancer_sv"]:
url_template = (
"https://franklin.genoox.com/clinical-db/variant/snpTumor/chr{this[chromosome]}-"
"{this[position]}-{this[reference]}-{this[alternative]}"
)
else:
url_template = (
"https://franklin.genoox.com/clinical-db/variant/snp/chr{this[chromosome]}-"
"{this[position]}-{this[reference]}-{this[alternative]}"
)
if build == 38:
url_template += "-hg38"
return url_template.format(this=variant_obj)


def cosmic_links(variant_obj):
"""Compose link to COSMIC Database.
Expand Down

0 comments on commit f3a9778

Please sign in to comment.