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

New website display + some cleanup #309

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
24 changes: 14 additions & 10 deletions .gcloudignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# from your .gitignore file, remove the corresponding line
# below:
.git
.github/
.github
.gitignore

# Static directories (GAE uses the ones in /static instead)
Expand All @@ -20,27 +20,31 @@
/curation_tracker/static/

# Curation and release directories (not needed for the website)
/curation/
/release/
/curation_tracker/scripts/
/curation
/release
/curation_tracker/scripts

# Migrations
**/migrations/
**/migrations

# Tests
**/tests/
**/tests
**/tests.py

# Python pycache:
**/__pycache__/
**/__pycache__
# Ignored by the build system
/setup.cfg

# Other
/rest_api/fixtures/
/static/CACHE/
/rest_api/fixtures
/static/CACHE
app.yaml_template
pgs-catalog-cred.json_template
requirements_local.txt
LICENSE.md
README.md
requirements_local.txt
**/.DS_Store

## Only for Live Webiste ##
#/curation_tracker
14 changes: 9 additions & 5 deletions app.yaml_template
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [START django_app]

runtime: python310
runtime: python311

# For the live site, comment the following line (it uses the default service value 'default')
service: <service_name>
Expand Down Expand Up @@ -38,28 +38,32 @@ env_variables:
PGS_LIVE_SITE: '<False_or_True>' # Need to be set to True for live website
PGS_CURATION_SITE: '<False_or_True>' # Line optional: Only used for the curation website
ALLOWED_HOSTS: '*'
# PGS database #

## PGS database ##
DATABASE_NAME: '<db_name>'
DATABASE_USER: '<db_user>'
DATABASE_PASSWORD: '<db_password>'
DATABASE_PORT: '<db_port>'
DATABASE_PORT_LOCAL: '<db_port_local>'
DATABASE_HOST: '<db_host>' # e.g.: localhost, IP address, /cloudsql/...
# PGS Benchmark database

## PGS Benchmark database ##
DATABASE_NAME_2: '<benchmark_db_name>'
DATABASE_USER_2: '<db_user>'
DATABASE_PASSWORD_2: '<db_password>'
DATABASE_PORT_2: '<db_port>'
DATABASE_PORT_LOCAL_2: '<db_port_local>'
DATABASE_HOST_2: '<db_host>' # e.g.: localhost, IP address, /cloudsql/...
# Curation Tracker database #

## Curation Tracker database ##
DATABASE_NAME_TRACKER: '<db_name>' # e.g.: pgs_curation_tracker
DATABASE_USER_TRACKER: '<db_user>'
DATABASE_PASSWORD_TRACKER: '<db_password>'
DATABASE_PORT_TRACKER: '<db_port>'
DATABASE_PORT_LOCAL_TRACKER: '<db_port_local>'
DATABASE_HOST_TRACKER: '<db_host>' # e.g.: localhost, IP address, /cloudsql/...
# Search

## Search ##
ELASTICSEARCH_URL_ROOT: '<url_to_elasticsearch_service>'

# [END django_app]
36 changes: 10 additions & 26 deletions benchmark/static/benchmark/benchmark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,6 @@ $chart_font_family:"Verdana", "Arial", "sans-serif";
}
}

// .filter_container {
// border:1px solid $pgs_darkC;
// border-radius:4px;
// padding:4px 10px;
// }
// .filter_header {
// font-weight: 200;
// border-bottom:1px solid $pgs_darkC;
// color: $pgs_dark0;
// padding-bottom:4px;
// text-align:center;
// }

.tooltip {
font-size: 12px;
}
Expand Down Expand Up @@ -100,7 +87,7 @@ $pgs_benchmark_colours: (
.pgs_benchmark_anc_#{$label} {
&:before {
color: $colour;
font-family: "Font Awesome 5 Free";
font-family: "Font Awesome 6 Free";
content: "\f068";
font-weight:900;
}
Expand All @@ -110,22 +97,19 @@ $pgs_benchmark_colours: (
&:before {
padding-right:5px;
color: $colour;
// font-family: "Font Awesome 5 Free";
// content: "\f0c8";
// font-weight:900;
}
}
}

.pgs_benchmark_shape_circle:before {
font-size: 10px;
font-family: "Font Awesome 5 Free";
font-family: "Font Awesome 6 Free";
content: "\f111";
font-weight:900;
}
.pgs_benchmark_shape_circle_o:before {
font-size: 10px;
font-family: "Font Awesome 5 Free";
font-family: "Font Awesome 6 Free";
content: "\f111";
}

Expand Down Expand Up @@ -186,37 +170,37 @@ $pgs_benchmark_colours: (

.pgs_benchmark_shape_square:before {
font-size: 10px;
font-family: "Font Awesome 5 Free";
font-family: "Font Awesome 6 Free";
content: "\f0c8";
font-weight:900;
}
.pgs_benchmark_shape_square_o:before {
font-size: 10px;
font-family: "Font Awesome 5 Free";
font-family: "Font Awesome 6 Free";
content: "\f0c8";
}

.pgs_benchmark_shape_star:before {
font-size: 10px;
font-family: "Font Awesome 5 Free";
font-family: "Font Awesome 6 Free";
content: "\f005";
font-weight:900;
}
.pgs_benchmark_shape_star_o:before {
font-size: 10px;
font-family: "Font Awesome 5 Free";
font-family: "Font Awesome 6 Free";
content: "\f005";
}

.pgs_benchmark_shape_cross:before {
font-size: 10px;
font-family: "Font Awesome 5 Free";
content: "\f067";
font-family: "Font Awesome 6 Free";
content: "\2b";
font-weight:900;
}
.pgs_benchmark_shape_cross_o:before {
font-size: 10px;
font-family: "Font Awesome 5 Free";
font-family: "Font Awesome 6 Free";
content: "\f0fe";
font-weight:900;
}
Expand Down
2 changes: 1 addition & 1 deletion benchmark/templates/benchmark/benchmark.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</nav>

<h2>
<span class="pgs_benchmark_logo pr-2"></span>Trait: <span class="pgs_title">{{ trait.label }}</span>
<span class="pgs_benchmark_logo pgs_color_2 pr-2"></span>Trait <small class="fa-solid fa-angle-right pgs_color_2"></small> <span class="pgs_title">{{ trait.label }}</span>
<span class="ml-4" style="border:2px solid #BE4A81;padding:4px;border-radius:5px;font-size:16px;line-height:37px;vertical-align:middle;color:#BE4A81">
<span class="fas fa-cogs pr-1 pgs_color_2"></span>Prototype
</span>
Expand Down
9 changes: 4 additions & 5 deletions benchmark/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def add_global_data(data, cohort_name, entry_name, data_type):

def benchmark(request):
trait_id = 'EFO_0000378'
efotrait = BM_EFOTrait.objects.using('benchmark').prefetch_related('phenotype_structured').get(id=trait_id)
efotrait = BM_EFOTrait.objects.using(bm_db).prefetch_related('phenotype_structured').get(id=trait_id)

pgs_data, cohort_max_sample = benchmark_data(efotrait)

Expand All @@ -174,11 +174,10 @@ def benchmark(request):
for score in pgs_data['pgs_ids'][cohort]:
scores.add(score)

score_only_attributes = ['id','name','publication','trait_efo','trait_reported','variants_number','publication__id','publication__date_publication','publication__journal','publication__firstauthor']
table_scores = BM_Browse_ScoreTable(Score.objects.only(*score_only_attributes).select_related('publication').filter(id__in=list(scores)).prefetch_related(pgs_prefetch['trait']), order_by="num")
score_defer = ['publication__title','publication__PMID','publication__doi','publication__authors','publication__curation_status','publication__curation_notes','publication__date_released','curation_notes']
table_scores = BM_Browse_ScoreTable(Score.objects.defer(*score_defer).select_related('publication').filter(id__in=list(scores)).prefetch_related(pgs_prefetch['trait']), order_by="num")


bm_cohorts = BM_Cohort.objects.using('benchmark').filter(name_short__in=cohorts).prefetch_related('cohort_sample').distinct()
bm_cohorts = BM_Cohort.objects.using(bm_db).filter(name_short__in=cohorts).prefetch_related('cohort_sample').distinct()

cohort_data = {}
for bm_cohort in bm_cohorts:
Expand Down
22 changes: 20 additions & 2 deletions catalog/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,24 @@ def pgs_search_examples(request):
'pgs_search_examples': html
}

def pgs_browse_examples(request):
eg_count = 0
html = ''
# Build the list of search examples
for example in constants.BROWSE_EXAMPLES:
link = f'<a href="/browse/scores?bq={example}">{example}</a>'
eg_count += 1
if eg_count > 1:
if eg_count == 4:
html += '<span class="extra_example">'
html += ', '
html += link
if eg_count > 3:
html += '</span>'
return {
'pgs_browse_examples': html
}

def pgs_info(request):
return {
'pgs_citation': constants.PGS_CITATION,
Expand All @@ -63,11 +81,11 @@ def get_group_index(group_private_index):
groups_to_print.append(group)
group_index = groups_to_print.index(group) + 1
return(f'<a title="{group_name}" style="border-bottom: 0px;">{group_index}</a>')

def html_author(author):
name = author['name']
group_sup = ','.join(map(get_group_index,author['group']))

return f'<span>{ name }<sup>{ group_sup }</sup></span>'

html += ', '.join(map(html_author,constants.PGS_CONTRIBUTORS))
Expand Down
Loading