Skip to content

Commit

Permalink
Merge branch 'release/0.1.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
abought committed Feb 14, 2020
2 parents 2b29eb0 + 03de8ba commit 47d6a59
Show file tree
Hide file tree
Showing 12 changed files with 917 additions and 963 deletions.
6 changes: 4 additions & 2 deletions assets/js/pages/gwas_region.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import Vue from 'vue';
import App from '../../vue/gwas_region.vue';

import { paramsFromUrl } from 'locuszoom/dist/ext/lz-dynamic-urls.min';
import { stateUrlMapping } from 'locuszoom-tabix/src/util/lz-helpers';

import { getBasicSources, createStudyLayout, getBasicLayout } from 'locuszoom-tabix/src/util/lz-helpers';
import { stateUrlMapping, getBasicSources, createStudyLayout, getBasicLayout } from 'localzoom/src/util/lz-helpers';
import count_region_view from 'localzoom/src/util/metrics';
import { createStudyAssocSources } from '../util/lz-helpers';

function makePlot(template_vars) {
Expand Down Expand Up @@ -38,4 +38,6 @@ function makePlot(template_vars) {
})}).$mount('#app');
}

// On page load, generate a plot, and send Google Analytics metrics for first plot rendered
window.lz_widget = makePlot(window.template_args);
count_region_view();
1 change: 1 addition & 0 deletions assets/js/pages/gwas_summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function createTopHitsTable(selector, data, region_url) {
{
title: 'Nearest gene(s)',
field: 'nearest_genes',
sorter: 'string',
formatter: cell => {
const genes = cell.getValue() || []; // There will be studies that predate this feature, and won't have a value
// Convert the list of ensg/symbol objects to a string- eventually we can add links to ext DB
Expand Down
6 changes: 3 additions & 3 deletions assets/js/pages/gwas_upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import pako from 'pako';

import App from '../../vue/gwas_upload.vue';

import { isHeader } from 'locuszoom-tabix/src/gwas/sniffers';
import { makeParser } from 'locuszoom-tabix/src/gwas/parsers';
import { isHeader } from 'localzoom/src/gwas/sniffers';
import { makeParser } from 'localzoom/src/gwas/parsers';

const PREVIEW_BYTES = 5000; // enough for 50-100 lines
const MAX_UPLOAD_SIZE = 1048576 * 1000; // 1000 MiB # FIXME: Currently upload limit is only implemented in the frontend
Expand Down Expand Up @@ -185,7 +185,7 @@ fileField.addEventListener('click', function(e) {
e.target.value = null;
});

fileField.addEventListener('change', function (e) {
fileField.addEventListener('change', function (event) {
// Custom validators for uploaded file
// Ref: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation#Limiting_the_size_of_a_file_before_its_upload
fileField.setCustomValidity('');
Expand Down
2 changes: 1 addition & 1 deletion assets/js/util/lz-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import LocusZoom from 'locuszoom';

import { sourceName} from 'locuszoom-tabix/src/util/lz-helpers';
import { sourceName} from 'localzoom/src/util/lz-helpers';

LocusZoom.KnownDataSources.extend('AssociationLZ', 'AssociationApi', {
getURL(state, chain,fields) {
Expand Down
6 changes: 5 additions & 1 deletion assets/js/util/pheweb_plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ function fmt(format) {

function create_gwas_plot(variant_bins, unbinned_variants, {url_prefix = null, tooltip_template = null} = {}) {
// FIXME: Replace global variables with options object
// Order from weakest to strongest pvalue, so that the strongest variant will be on top (z-order) and easily hoverable
// In the DOM, later siblings are displayed over top of (and occluding) earlier siblings.
unbinned_variants = _.sortBy(unbinned_variants, function(d) { return d.neg_log_pvalue; });

const get_chrom_offsets = _.memoize(function() {
const chrom_padding = 2e7;
const chrom_extents = {};
Expand Down Expand Up @@ -120,7 +124,7 @@ function create_gwas_plot(variant_bins, unbinned_variants, {url_prefix = null, t
const plot_margin = {
'left': 70,
'right': 30,
'top': 10,
'top': 20,
'bottom': 50,
};
const plot_width = svg_width - plot_margin.left - plot_margin.right;
Expand Down
8 changes: 4 additions & 4 deletions assets/vue/gwas_region.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script>
// Custom interactivity attached to the "GWAS Region/LocusZoom plot" page
import BatchSpec from 'locuszoom-tabix/src/components/BatchSpec.vue';
import BatchScroller from 'locuszoom-tabix/src/components/BatchScroller.vue';
import PlotPanes from 'locuszoom-tabix/src/components/PlotPanes.vue';
import RegionPicker from 'locuszoom-tabix/src/components/RegionPicker.vue';
import BatchSpec from 'localzoom/src/components/BatchSpec.vue';
import BatchScroller from 'localzoom/src/components/BatchScroller.vue';
import PlotPanes from 'localzoom/src/components/PlotPanes.vue';
import RegionPicker from 'localzoom/src/components/RegionPicker.vue';
const MAX_REGION_SIZE = 1000000;
Expand Down
2 changes: 1 addition & 1 deletion assets/vue/gwas_upload.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
// Custom interactivity associated with the "Upload your own GWAS" page.
// This enhances just one part of the upload form.
import AdderWizard from 'locuszoom-tabix/src/components/AdderWizard.vue';
import AdderWizard from 'localzoom/src/components/AdderWizard.vue';
export default {
name: 'gwas_upload',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.0.13 on 2020-02-14 19:19

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('gwas', '0005_auto_20190929_0344'),
]

operations = [
migrations.AlterModelOptions(
name='analysisinfo',
options={'verbose_name_plural': 'GWAS Analysis Metadata'},
),
]
29 changes: 1 addition & 28 deletions locuszoom_plotting_service/templates/gwas/gwas_region.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{% block title %}Region plot- {{ gwas.label }}{% endblock %}
{% block css %}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/locuszoom@0.9.0/dist/locuszoom.css" type="text/css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/locuszoom@0.10.1/dist/locuszoom.css" type="text/css"/>
{% endblock %}

{% block content %}
Expand Down Expand Up @@ -41,31 +41,4 @@
{# {{ js_vars | json_script: 'js-vars' }}#}
{# Define the LocusZoom plot #}
{% render_bundle 'gwas_region' %}

{% if GOOGLE_ANALYTICS_ID %}
<script>
// Track an aggregate sum of all possible region plots generated.
// This section contains a hack around the fact that there is no direct event for `history.pushState`
// Ref: https://stackoverflow.com/a/25673911/1422268
var _wr = function(type) {
var orig = history[type];
return function() {
var rv = orig.apply(this, arguments);
var e = new Event(type);
e.arguments = arguments;
window.dispatchEvent(e);
return rv;
};
};
// Monkey-patching: icky, but necessary.
history.pushState = _wr('pushState'); // Define a synthetic DOM event by wrapping the history function.

var listener = function() { gtag('event', 'regionview'); };
// Count a new region plot on page load, and whenever url changes (forward = pushState, back = popstate);
listener();
window.addEventListener('popstate', listener);
window.addEventListener('pushState', listener); // synthetic event
</script>
{% endif %}

{% endblock %}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"d3": "3.5.16",
"d3-tip": "0.9.0",
"gwas-credible-sets": "^0.1.0",
"locuszoom": "0.10.0",
"locuszoom-tabix": "https://github.com/statgen/localzoom#918fd75",
"localzoom": "https://github.com/statgen/localzoom#v0.5.3",
"locuszoom": "https://github.com/statgen/locuszoom#42f7c64127893f5f1b00ddf9b81acf369179dc36",
"pako": "^1.0.8",
"underscore": "1.8.3",
"vue": "^2.6.10",
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ pyyaml # Required for OpenAPI rendering
boltons~=19.1
scipy~=1.2
python-magic==0.4.15
zorp==0.1.1
git+git://github.com/abought/zorp.git@893d383
genelocator==1.1.1
Loading

0 comments on commit 47d6a59

Please sign in to comment.