Skip to content

Commit

Permalink
Merge branch 'release/0.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
abought committed Oct 16, 2019
2 parents 8ea5435 + aed63e9 commit 3037700
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 19 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "localzoom",
"version": "0.3.0",
"version": "0.3.1",
"license": "MIT",
"main": "lib/LzTabix.umd.min.js",
"scripts": {
Expand All @@ -16,7 +16,7 @@
"bootstrap": "^4.1.3",
"bootstrap-vue": "^2.0.0-rc.11",
"gwas-credible-sets": "^0.1.0",
"locuszoom": "https://github.com/statgen/locuszoom#develop",
"locuszoom": "https://github.com/statgen/locuszoom#8b06580",
"lodash": "^4.17.11",
"tabix-reader": "https://github.com/abought/tabix-reader",
"tabulator-tables": "^4.1.4",
Expand Down
12 changes: 10 additions & 2 deletions src/components/ExportData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,35 @@ export default {
// How should the table display this set of fields? Determined once at component load.
const base = [
{ title: 'Chrom', field: 'chromosome' },
{ title: 'Pos', field: 'position' },
{ title: 'Pos', field: 'position', sorter: 'number' },
{ title: 'Ref', field: 'ref_allele' },
{ title: 'Alt', field: 'alt_allele' },
{ title: '-log<sub>10</sub>(p)', field: 'log_pvalue', formatter: formatSciNotation },
{
title: '-log<sub>10</sub>(p)',
field: 'log_pvalue',
formatter: formatSciNotation,
sorter: 'number',
},
{
title: '&beta;',
field: 'beta',
formatter: 'money',
formatterParams: { precision: 3 },
sorter: 'number',
},
{
title: 'SE(&beta;)',
field: 'stderr_beta',
formatter: 'money',
formatterParams: { precision: 3 },
sorter: 'number',
},
{
title: 'Alt freq.',
field: 'alt_allele_freq',
formatter: 'money',
formatterParams: { precision: 3 },
sorter: 'number',
},
];
if (this.has_credible_sets) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/GwasToolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default {
@fail="showMessage" class="float-right"
:build="build"
:max_range="1000000"
search_url="https://portaldev.sph.umich.edu/api_internal_dev/v1/annotation/omnisearch/" />
search_url="https://portaldev.sph.umich.edu/api/v1/annotation/omnisearch/" />
<b-dropdown v-else text="Plot options" variant="info"
class="float-right">
<div class="px-3">
Expand Down
11 changes: 8 additions & 3 deletions src/components/LzPlot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,13 @@ export default {
*/
createLZ(base_layout, base_sources) {
// Create and populate the plot
// The layout comes from properties assigned to a vue instance, which are automatically
// wrapped (deeply) with Vue observable getters/setters. This can confuse LocusZoom,
// so we will deep-copy to ensure this is just pure JS primitives
const layout = JSON.parse(JSON.stringify(base_layout));
const data_sources = new LocusZoom.DataSources();
base_sources.forEach(([name, config]) => data_sources.add(name, config));
const plot = LocusZoom.populate(`#${this.dom_id}`, data_sources, base_layout);
const plot = LocusZoom.populate(`#${this.dom_id}`, data_sources, layout);
if (this.show_loading) {
// Add loading indicator to every panel if appropriate
Expand Down Expand Up @@ -115,8 +119,9 @@ export default {
// FIXME: this component receives notifications of a value it changes, a design
// quirk that risks infinite update loops
// Only apply new region information if it has changed
const diffs = Object.keys(this.region).reduce((acc, key) => {
const new_val = this.region[key];
const region = Object.assign({}, this.region);
const diffs = Object.keys(region).reduce((acc, key) => {
const new_val = region[key];
if (new_val !== this.plot.state[key]) {
acc[key] = new_val;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/RegionPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default {
},
search_url: {
type: String,
default: 'https://portaldev.sph.umich.edu/api_internal_dev/v1/annotation/omnisearch/',
default: 'https://portaldev.sph.umich.edu/api/v1/annotation/omnisearch/',
},
build: {
type: String,
Expand Down
2 changes: 1 addition & 1 deletion src/gwas/parser_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function parseAlleleFrequency({ freq, allele_count, n_samples, is_alt_effect = t
return null;
}
if (freq === undefined && allele_count !== undefined) {
result = +allele_count / +n_samples;
result = +allele_count / +n_samples / 2;
} else if (MISSING_VALUES.has(freq)) { // Frequency-based parsing
return null;
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/util/lz-helpers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import LocusZoom from 'locuszoom';
import 'locuszoom/dist/ext/lz-credible-sets.min'; // Import for side effects (globally register helpers)

import { PORTAL_API_BASE_URL, LD_SERVER_BASE_URL, PORTAL_DEV_API_BASE_URL } from './constants';
import { PORTAL_API_BASE_URL, LD_SERVER_BASE_URL } from './constants';
import { makeParser } from '../gwas/parsers';

const stateUrlMapping = Object.freeze({ chr: 'chrom', start: 'start', end: 'end' });
Expand Down Expand Up @@ -169,7 +169,7 @@ function getBasicSources(study_sources = []) {
['catalog', ['GwasCatalogLZ', { url: `${PORTAL_API_BASE_URL}annotation/gwascatalog/results/` }]],
['ld', ['LDLZ2', { url: LD_SERVER_BASE_URL, params: { source: '1000G', population: 'ALL' } }]],
['gene', ['GeneLZ', { url: `${PORTAL_API_BASE_URL}annotation/genes/` }]],
['recomb', ['RecombLZ', { url: `${PORTAL_DEV_API_BASE_URL}annotation/recomb/results/` }]],
['recomb', ['RecombLZ', { url: `${PORTAL_API_BASE_URL}annotation/recomb/results/` }]],
// TODO: This source is broken on https; I wish we had an alternative
['constraint', ['GeneConstraintLZ', { url: 'http://exac.broadinstitute.org/api/constraint' }]],
];
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/parser_utils.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ describe('parseAlleleFrequency', () => {

it('calculates freq from counts', () => {
const res = parseAlleleFrequency({ allele_count: '25', n_samples: '100' });
assert.equal(res, 0.25);
assert.equal(res, 0.125);
});

it('calculates freq from counts, and orients to alt', () => {
const res = parseAlleleFrequency({ allele_count: '75', n_samples: '100', is_alt_effect: false });
assert.equal(res, 0.25);
assert.equal(res, 0.625);
});

it('handles missing data when working with counts', () => {
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5412,9 +5412,9 @@ locate-path@^3.0.0:
p-locate "^3.0.0"
path-exists "^3.0.0"

locuszoom@statgen/locuszoom#develop:
version "0.9.1"
resolved "https://codeload.github.com/statgen/locuszoom/tar.gz/29328f21eea7e5a7744c51a33416e26098a653ba"
"locuszoom@https://github.com/statgen/locuszoom#8b06580":
version "0.10.0-beta.1"
resolved "https://github.com/statgen/locuszoom#8b065804188279ff33cb30619aa555566c834d36"
dependencies:
d3 "3.5.17"
promise-polyfill "^8.1.3"
Expand Down Expand Up @@ -8446,9 +8446,9 @@ symbol-tree@^3.2.2:
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"
integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==

tabix-reader@abought/tabix-reader:
"tabix-reader@https://github.com/abought/tabix-reader":
version "1.0.0"
resolved "https://codeload.github.com/abought/tabix-reader/tar.gz/5c1fff378e2674370e910f63f9ece3af8ea6e049"
resolved "https://github.com/abought/tabix-reader#5c1fff378e2674370e910f63f9ece3af8ea6e049"
dependencies:
eslint "^5.16.0"
jszlib dasmoth/jszlib
Expand Down

0 comments on commit 3037700

Please sign in to comment.