aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/base/trait.py5
-rw-r--r--wqflask/tests/integration/__init__.py (renamed from wqflask/tests/base/__init__.py)0
-rw-r--r--wqflask/tests/integration/test_markdown_routes.py21
-rw-r--r--wqflask/tests/unit/__init__.py (renamed from wqflask/tests/utility/__init__.py)0
-rw-r--r--wqflask/tests/unit/base/__init__.py (renamed from wqflask/tests/wqflask/__init__.py)0
-rw-r--r--wqflask/tests/unit/base/data.py (renamed from wqflask/tests/base/data.py)0
-rw-r--r--wqflask/tests/unit/base/test_data_set.py (renamed from wqflask/tests/base/test_data_set.py)0
-rw-r--r--wqflask/tests/unit/base/test_general_object.py (renamed from wqflask/tests/base/test_general_object.py)0
-rw-r--r--wqflask/tests/unit/base/test_trait.py (renamed from wqflask/tests/base/test_trait.py)0
-rw-r--r--wqflask/tests/unit/base/test_webqtl_case_data.py (renamed from wqflask/tests/base/test_webqtl_case_data.py)0
-rw-r--r--wqflask/tests/unit/utility/__init__.py (renamed from wqflask/tests/wqflask/api/__init__.py)0
-rw-r--r--wqflask/tests/unit/utility/test_authentication_tools.py (renamed from wqflask/tests/utility/test_authentication_tools.py)0
-rw-r--r--wqflask/tests/unit/utility/test_chunks.py (renamed from wqflask/tests/utility/test_chunks.py)0
-rw-r--r--wqflask/tests/unit/utility/test_corestats.py (renamed from wqflask/tests/utility/test_corestats.py)0
-rw-r--r--wqflask/tests/unit/utility/test_corr_result_helpers.py (renamed from wqflask/tests/utility/test_corr_result_helpers.py)0
-rw-r--r--wqflask/tests/unit/utility/test_formatting.py (renamed from wqflask/tests/utility/test_formatting.py)0
-rw-r--r--wqflask/tests/unit/utility/test_hmac.py (renamed from wqflask/tests/utility/test_hmac.py)1
-rw-r--r--wqflask/tests/unit/wqflask/__init__.py (renamed from wqflask/tests/wqflask/marker_regression/__init__.py)0
-rw-r--r--wqflask/tests/unit/wqflask/api/__init__.py (renamed from wqflask/tests/wqflask/show_trait/__init__.py)0
-rw-r--r--wqflask/tests/unit/wqflask/api/test_gen_menu.py (renamed from wqflask/tests/wqflask/api/test_gen_menu.py)0
-rw-r--r--wqflask/tests/unit/wqflask/marker_regression/__init__.py0
-rw-r--r--wqflask/tests/unit/wqflask/marker_regression/test_display_mapping_results.py (renamed from wqflask/tests/wqflask/marker_regression/test_display_mapping_results.py)0
-rw-r--r--wqflask/tests/unit/wqflask/show_trait/__init__.py0
-rw-r--r--wqflask/tests/unit/wqflask/show_trait/test_export_trait_data.py (renamed from wqflask/tests/wqflask/show_trait/test_export_trait_data.py)0
-rw-r--r--wqflask/tests/unit/wqflask/test_collect.py (renamed from wqflask/tests/wqflask/test_collect.py)0
-rw-r--r--wqflask/tests/unit/wqflask/test_markdown_routes.py54
-rw-r--r--wqflask/tests/unit/wqflask/test_pbkdf2.py (renamed from wqflask/tests/wqflask/test_pbkdf2.py)0
-rw-r--r--wqflask/tests/unit/wqflask/test_user_login.py (renamed from wqflask/tests/wqflask/test_user_login.py)0
-rw-r--r--wqflask/tests/unit/wqflask/test_user_session.py (renamed from wqflask/tests/wqflask/test_user_session.py)0
-rw-r--r--wqflask/tests/wqflask/show_trait/testSampleList.py16
-rw-r--r--wqflask/tests/wqflask/show_trait/test_show_trait.py36
-rw-r--r--wqflask/wqflask/__init__.py14
-rw-r--r--wqflask/wqflask/correlation_matrix/show_corr_matrix.py210
-rw-r--r--wqflask/wqflask/docs.py4
-rw-r--r--wqflask/wqflask/markdown_routes.py39
-rw-r--r--wqflask/wqflask/marker_regression/display_mapping_results.py32
-rw-r--r--wqflask/wqflask/marker_regression/run_mapping.py17
-rw-r--r--wqflask/wqflask/show_trait/SampleList.py31
-rw-r--r--wqflask/wqflask/show_trait/show_trait.py2
-rw-r--r--wqflask/wqflask/static/Congenic.pngbin0 -> 56578 bytes
-rw-r--r--wqflask/wqflask/static/images/Belknap_Fig1_1998.pngbin0 -> 117246 bytes
-rw-r--r--wqflask/wqflask/static/images/Chrna1vsMyf6.gifbin0 -> 59529 bytes
-rw-r--r--wqflask/wqflask/static/images/Congenic.pngbin0 -> 56578 bytes
-rw-r--r--wqflask/wqflask/static/images/Normal_Plot.gifbin0 -> 47289 bytes
-rw-r--r--wqflask/wqflask/static/images/SilverFig3_2.pngbin0 -> 61570 bytes
-rw-r--r--wqflask/wqflask/static/images/SilverFig3_6.pngbin0 -> 22017 bytes
-rw-r--r--wqflask/wqflask/static/images/Winsorize1.pngbin0 -> 15117 bytes
-rw-r--r--wqflask/wqflask/static/images/Winsorize3.pngbin0 -> 17317 bytes
-rw-r--r--wqflask/wqflask/static/new/css/markdown.css13
-rw-r--r--wqflask/wqflask/static/new/javascript/get_traits_from_collection.js44
-rw-r--r--wqflask/wqflask/templates/base.html7
-rw-r--r--wqflask/wqflask/templates/collections/add.html3
-rw-r--r--wqflask/wqflask/templates/collections/view.html4
-rw-r--r--wqflask/wqflask/templates/corr_scatterplot.html4
-rw-r--r--wqflask/wqflask/templates/correlation_matrix.html4
-rw-r--r--wqflask/wqflask/templates/glossary.html16
-rw-r--r--wqflask/wqflask/templates/gsearch_gene.html8
-rw-r--r--wqflask/wqflask/templates/gsearch_pheno.html4
-rw-r--r--wqflask/wqflask/templates/index_page.html6
-rwxr-xr-xwqflask/wqflask/templates/index_page_orig.html2
-rw-r--r--wqflask/wqflask/templates/mapping_results.html55
-rw-r--r--wqflask/wqflask/templates/search_result_page.html19
-rw-r--r--wqflask/wqflask/templates/show_trait_calculate_correlations.html2
-rw-r--r--wqflask/wqflask/views.py8
64 files changed, 475 insertions, 206 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index cfc02f8b..0f8f937c 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -265,14 +265,17 @@ def get_sample_data():
trait_dict['species'] = trait_ob.dataset.group.species
trait_dict['url'] = url_for(
'show_trait_page', trait_id=trait, dataset=dataset)
- trait_dict['description'] = trait_ob.description_display
if trait_ob.dataset.type == "ProbeSet":
trait_dict['symbol'] = trait_ob.symbol
trait_dict['location'] = trait_ob.location_repr
+ trait_dict['description'] = trait_ob.description_display
elif trait_ob.dataset.type == "Publish":
+ trait_dict['description'] = trait_ob.description_display
if trait_ob.pubmed_id:
trait_dict['pubmed_link'] = trait_ob.pubmed_link
trait_dict['pubmed_text'] = trait_ob.pubmed_text
+ else:
+ trait_dict['location'] = trait_ob.location_repr
return json.dumps([trait_dict, {key: value.value for
key, value in list(
diff --git a/wqflask/tests/base/__init__.py b/wqflask/tests/integration/__init__.py
index e69de29b..e69de29b 100644
--- a/wqflask/tests/base/__init__.py
+++ b/wqflask/tests/integration/__init__.py
diff --git a/wqflask/tests/integration/test_markdown_routes.py b/wqflask/tests/integration/test_markdown_routes.py
new file mode 100644
index 00000000..5e3e5045
--- /dev/null
+++ b/wqflask/tests/integration/test_markdown_routes.py
@@ -0,0 +1,21 @@
+"Integration tests for markdown routes"
+import unittest
+
+from bs4 import BeautifulSoup
+
+from wqflask import app
+
+
+class TestGenMenu(unittest.TestCase):
+ """Tests for glossary"""
+
+ def setUp(self):
+ self.app = app.test_client()
+
+ def tearDown(self):
+ pass
+
+ def test_glossary_page(self):
+ """Test that the glossary page is rendered properly"""
+ response = self.app.get('/glossary', follow_redirects=True)
+ pass
diff --git a/wqflask/tests/utility/__init__.py b/wqflask/tests/unit/__init__.py
index e69de29b..e69de29b 100644
--- a/wqflask/tests/utility/__init__.py
+++ b/wqflask/tests/unit/__init__.py
diff --git a/wqflask/tests/wqflask/__init__.py b/wqflask/tests/unit/base/__init__.py
index e69de29b..e69de29b 100644
--- a/wqflask/tests/wqflask/__init__.py
+++ b/wqflask/tests/unit/base/__init__.py
diff --git a/wqflask/tests/base/data.py b/wqflask/tests/unit/base/data.py
index 06a5a989..06a5a989 100644
--- a/wqflask/tests/base/data.py
+++ b/wqflask/tests/unit/base/data.py
diff --git a/wqflask/tests/base/test_data_set.py b/wqflask/tests/unit/base/test_data_set.py
index 96563a16..96563a16 100644
--- a/wqflask/tests/base/test_data_set.py
+++ b/wqflask/tests/unit/base/test_data_set.py
diff --git a/wqflask/tests/base/test_general_object.py b/wqflask/tests/unit/base/test_general_object.py
index 00fd3c72..00fd3c72 100644
--- a/wqflask/tests/base/test_general_object.py
+++ b/wqflask/tests/unit/base/test_general_object.py
diff --git a/wqflask/tests/base/test_trait.py b/wqflask/tests/unit/base/test_trait.py
index 826ccefd..826ccefd 100644
--- a/wqflask/tests/base/test_trait.py
+++ b/wqflask/tests/unit/base/test_trait.py
diff --git a/wqflask/tests/base/test_webqtl_case_data.py b/wqflask/tests/unit/base/test_webqtl_case_data.py
index 8e8ba482..8e8ba482 100644
--- a/wqflask/tests/base/test_webqtl_case_data.py
+++ b/wqflask/tests/unit/base/test_webqtl_case_data.py
diff --git a/wqflask/tests/wqflask/api/__init__.py b/wqflask/tests/unit/utility/__init__.py
index e69de29b..e69de29b 100644
--- a/wqflask/tests/wqflask/api/__init__.py
+++ b/wqflask/tests/unit/utility/__init__.py
diff --git a/wqflask/tests/utility/test_authentication_tools.py b/wqflask/tests/unit/utility/test_authentication_tools.py
index 5c391be5..5c391be5 100644
--- a/wqflask/tests/utility/test_authentication_tools.py
+++ b/wqflask/tests/unit/utility/test_authentication_tools.py
diff --git a/wqflask/tests/utility/test_chunks.py b/wqflask/tests/unit/utility/test_chunks.py
index 8d90a1ec..8d90a1ec 100644
--- a/wqflask/tests/utility/test_chunks.py
+++ b/wqflask/tests/unit/utility/test_chunks.py
diff --git a/wqflask/tests/utility/test_corestats.py b/wqflask/tests/unit/utility/test_corestats.py
index cf91a248..cf91a248 100644
--- a/wqflask/tests/utility/test_corestats.py
+++ b/wqflask/tests/unit/utility/test_corestats.py
diff --git a/wqflask/tests/utility/test_corr_result_helpers.py b/wqflask/tests/unit/utility/test_corr_result_helpers.py
index e196fbdf..e196fbdf 100644
--- a/wqflask/tests/utility/test_corr_result_helpers.py
+++ b/wqflask/tests/unit/utility/test_corr_result_helpers.py
diff --git a/wqflask/tests/utility/test_formatting.py b/wqflask/tests/unit/utility/test_formatting.py
index 9d3033d1..9d3033d1 100644
--- a/wqflask/tests/utility/test_formatting.py
+++ b/wqflask/tests/unit/utility/test_formatting.py
diff --git a/wqflask/tests/utility/test_hmac.py b/wqflask/tests/unit/utility/test_hmac.py
index 4e3652f8..13d6261d 100644
--- a/wqflask/tests/utility/test_hmac.py
+++ b/wqflask/tests/unit/utility/test_hmac.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""Test hmac utility functions"""
import unittest
diff --git a/wqflask/tests/wqflask/marker_regression/__init__.py b/wqflask/tests/unit/wqflask/__init__.py
index e69de29b..e69de29b 100644
--- a/wqflask/tests/wqflask/marker_regression/__init__.py
+++ b/wqflask/tests/unit/wqflask/__init__.py
diff --git a/wqflask/tests/wqflask/show_trait/__init__.py b/wqflask/tests/unit/wqflask/api/__init__.py
index e69de29b..e69de29b 100644
--- a/wqflask/tests/wqflask/show_trait/__init__.py
+++ b/wqflask/tests/unit/wqflask/api/__init__.py
diff --git a/wqflask/tests/wqflask/api/test_gen_menu.py b/wqflask/tests/unit/wqflask/api/test_gen_menu.py
index 84898bd1..84898bd1 100644
--- a/wqflask/tests/wqflask/api/test_gen_menu.py
+++ b/wqflask/tests/unit/wqflask/api/test_gen_menu.py
diff --git a/wqflask/tests/unit/wqflask/marker_regression/__init__.py b/wqflask/tests/unit/wqflask/marker_regression/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/wqflask/tests/unit/wqflask/marker_regression/__init__.py
diff --git a/wqflask/tests/wqflask/marker_regression/test_display_mapping_results.py b/wqflask/tests/unit/wqflask/marker_regression/test_display_mapping_results.py
index 8ae0f09f..8ae0f09f 100644
--- a/wqflask/tests/wqflask/marker_regression/test_display_mapping_results.py
+++ b/wqflask/tests/unit/wqflask/marker_regression/test_display_mapping_results.py
diff --git a/wqflask/tests/unit/wqflask/show_trait/__init__.py b/wqflask/tests/unit/wqflask/show_trait/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/wqflask/tests/unit/wqflask/show_trait/__init__.py
diff --git a/wqflask/tests/wqflask/show_trait/test_export_trait_data.py b/wqflask/tests/unit/wqflask/show_trait/test_export_trait_data.py
index 41761944..41761944 100644
--- a/wqflask/tests/wqflask/show_trait/test_export_trait_data.py
+++ b/wqflask/tests/unit/wqflask/show_trait/test_export_trait_data.py
diff --git a/wqflask/tests/wqflask/test_collect.py b/wqflask/tests/unit/wqflask/test_collect.py
index 9a36132d..9a36132d 100644
--- a/wqflask/tests/wqflask/test_collect.py
+++ b/wqflask/tests/unit/wqflask/test_collect.py
diff --git a/wqflask/tests/unit/wqflask/test_markdown_routes.py b/wqflask/tests/unit/wqflask/test_markdown_routes.py
new file mode 100644
index 00000000..90e0f17c
--- /dev/null
+++ b/wqflask/tests/unit/wqflask/test_markdown_routes.py
@@ -0,0 +1,54 @@
+"""Test functions in markdown utils"""
+
+import unittest
+from unittest import mock
+
+from dataclasses import dataclass
+from wqflask.markdown_routes import render_markdown
+
+
+@dataclass
+class MockRequests404:
+ status_code: int = 404
+
+
+@dataclass
+class MockRequests200:
+ status_code: int = 200
+ content: str = b"""
+# Glossary
+This is some content
+
+## Sub-heading
+This is another sub-heading"""
+
+
+class TestMarkdownRoutesFunctions(unittest.TestCase):
+ """Test cases for functions in markdown_routes"""
+
+ @mock.patch('wqflask.markdown_routes.requests.get')
+ def test_render_markdown_when_fetching_locally(self, requests_mock):
+ requests_mock.return_value = MockRequests404()
+ markdown_content = render_markdown("general/glossary/glossary.md")
+ requests_mock.assert_called_with(
+ "https://raw.githubusercontent.com"
+ "/genenetwork/gn-docs/"
+ "master/general/"
+ "glossary/glossary.md")
+ self.assertRegexpMatches(markdown_content,
+ "Content for general/glossary/glossary.md not available.")
+
+ @mock.patch('wqflask.markdown_routes.requests.get')
+ def test_render_markdown_when_fetching_remotely(self, requests_mock):
+ requests_mock.return_value = MockRequests200()
+ markdown_content = render_markdown("general/glossary/glossary.md")
+ requests_mock.assert_called_with(
+ "https://raw.githubusercontent.com"
+ "/genenetwork/gn-docs/"
+ "master/general/"
+ "glossary/glossary.md")
+ self.assertEqual("""<h1>Glossary</h1>
+<p>This is some content</p>
+<h2>Sub-heading</h2>
+<p>This is another sub-heading</p>""",
+ markdown_content)
diff --git a/wqflask/tests/wqflask/test_pbkdf2.py b/wqflask/tests/unit/wqflask/test_pbkdf2.py
index a33fbd4f..a33fbd4f 100644
--- a/wqflask/tests/wqflask/test_pbkdf2.py
+++ b/wqflask/tests/unit/wqflask/test_pbkdf2.py
diff --git a/wqflask/tests/wqflask/test_user_login.py b/wqflask/tests/unit/wqflask/test_user_login.py
index 61cd9ab9..61cd9ab9 100644
--- a/wqflask/tests/wqflask/test_user_login.py
+++ b/wqflask/tests/unit/wqflask/test_user_login.py
diff --git a/wqflask/tests/wqflask/test_user_session.py b/wqflask/tests/unit/wqflask/test_user_session.py
index ebb0334a..ebb0334a 100644
--- a/wqflask/tests/wqflask/test_user_session.py
+++ b/wqflask/tests/unit/wqflask/test_user_session.py
diff --git a/wqflask/tests/wqflask/show_trait/testSampleList.py b/wqflask/tests/wqflask/show_trait/testSampleList.py
new file mode 100644
index 00000000..34c51e3e
--- /dev/null
+++ b/wqflask/tests/wqflask/show_trait/testSampleList.py
@@ -0,0 +1,16 @@
+import unittest
+import re
+from unittest import mock
+from wqflask.show_trait.SampleList import natural_sort
+
+
+class TestSampleList(unittest.TestCase):
+ def test_natural_sort(self):
+ "Sort the list into natural alphanumeric order."
+
+ characters_list = ["z", "f", "q", "s", "t", "a", "g"]
+ names_list = ["temp1", "publish", "Sample", "Dataset"]
+ sorted_list_a=natural_sort(characters_list)
+ sorted_list_b=natural_sort(names_list)
+ self.assertEqual(sorted_list_a, ["a", "f", "g", "q", "s", "t", "z"])
+ self.assertEqual(sorted_list_b,["Dataset", "Sample", "publish", "temp1"])
diff --git a/wqflask/tests/wqflask/show_trait/test_show_trait.py b/wqflask/tests/wqflask/show_trait/test_show_trait.py
index 24150738..8c866874 100644
--- a/wqflask/tests/wqflask/show_trait/test_show_trait.py
+++ b/wqflask/tests/wqflask/show_trait/test_show_trait.py
@@ -11,6 +11,7 @@ from wqflask.show_trait.show_trait import get_trait_units
from wqflask.show_trait.show_trait import get_nearest_marker
from wqflask.show_trait.show_trait import get_genotype_scales
from wqflask.show_trait.show_trait import requests
+from wqflask.show_trait.show_trait import get_scales_from_genofile
class TraitObject:
@@ -240,3 +241,38 @@ class TestTraits(unittest.TestCase):
expected_results = {f"{file_location}": [["physic", "Mb"]]}
self.assertEqual(get_genotype_scales(file_location), expected_results)
mock_get_scales.assert_called_once_with(file_location)
+
+
+ @mock.patch("wqflask.show_trait.show_trait.locate_ignore_error")
+ def test_get_scales_from_genofile_found(self, mock_ignore_location):
+ """"add test for get scales from genofile where file is found"""
+ mock_ignore_location.return_value = True
+ geno_file = """
+ #sample line with no @scales:other\n
+ #sample line @scales and :separated by semicolon\n
+ This attempts to check whether\n
+ """
+
+ geno_file_string = "@line start with @ and has @scale:morgan"
+
+ file_location = "~/data/file.geno"
+
+ mock_open_geno_file = mock.mock_open(read_data=geno_file)
+ with mock.patch("builtins.open", mock_open_geno_file):
+ results = get_scales_from_genofile(file_location)
+ self.assertEqual(results, [["morgan", "cM"]])
+
+ mock_open_string = mock.mock_open(read_data=geno_file_string)
+
+ with mock.patch("builtins.open", mock_open_string):
+ result2 = get_scales_from_genofile(file_location)
+ self.assertEqual([['morgan', 'cM']], result2)
+
+ @mock.patch("wqflask.show_trait.show_trait.locate_ignore_error")
+ def test_get_scales_from_genofile_not_found(self, mock_location_ignore):
+ mock_location_ignore.return_value = False
+
+ expected_results = [["physic", "Mb"]]
+ results = get_scales_from_genofile("~/data/file")
+ mock_location_ignore.assert_called_once_with("~/data/file", "genotype")
+ self.assertEqual(results, expected_results)
diff --git a/wqflask/wqflask/__init__.py b/wqflask/wqflask/__init__.py
index 274c3d82..874cde17 100644
--- a/wqflask/wqflask/__init__.py
+++ b/wqflask/wqflask/__init__.py
@@ -1,14 +1,12 @@
-import sys
+"""Entry point for flask app"""
+# pylint: disable=C0413,E0611
import time
import jinja2
from flask import g
from flask import Flask
from utility import formatting
-
-import logging
-logger = logging.getLogger(__name__ )
-logging.basicConfig(level=logging.INFO)
+from wqflask.markdown_routes import glossary_blueprint
app = Flask(__name__)
@@ -19,11 +17,13 @@ app.jinja_env.globals.update(
undefined=jinja2.StrictUndefined,
numify=formatting.numify)
+# Registering blueprints
+app.register_blueprint(glossary_blueprint, url_prefix="/glossary")
@app.before_request
def before_request():
- g.request_start_time = time.time()
- g.request_time = lambda: "%.5fs" % (time.time() - g.request_start_time)
+ g.request_start_time = time.time()
+ g.request_time = lambda: "%.5fs" % (time.time() - g.request_start_time)
from wqflask.api import router
diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
index a394f548..0269ce68 100644
--- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
+++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
@@ -55,11 +55,7 @@ class CorrelationMatrix(object):
self.do_PCA = True
this_group = self.trait_list[0][1].group.name #ZS: Getting initial group name before verifying all traits are in the same group in the following loop
for trait_db in self.trait_list:
- if trait_db[1].group.name != this_group:
- self.insufficient_shared_samples = True
- break
- else:
- this_group = trait_db[1].group.name
+ this_group = trait_db[1].group.name
this_trait = trait_db[0]
self.traits.append(this_trait)
this_sample_data = this_trait.data
@@ -68,119 +64,115 @@ class CorrelationMatrix(object):
if sample not in self.all_sample_list:
self.all_sample_list.append(sample)
- if self.insufficient_shared_samples:
- pass
- else:
- self.sample_data = []
- for trait_db in self.trait_list:
- this_trait = trait_db[0]
- this_sample_data = this_trait.data
+ self.sample_data = []
+ for trait_db in self.trait_list:
+ this_trait = trait_db[0]
+ this_sample_data = this_trait.data
- this_trait_vals = []
- for sample in self.all_sample_list:
- if sample in this_sample_data:
- this_trait_vals.append(this_sample_data[sample].value)
- else:
- this_trait_vals.append('')
- self.sample_data.append(this_trait_vals)
-
- if len(this_trait_vals) < len(self.trait_list): #Shouldn't do PCA if there are more traits than observations/samples
- self.do_PCA = False
-
- self.lowest_overlap = 8 #ZS: Variable set to the lowest overlapping samples in order to notify user, or 8, whichever is lower (since 8 is when we want to display warning)
-
- self.corr_results = []
- self.pca_corr_results = []
- self.shared_samples_list = self.all_sample_list
- for trait_db in self.trait_list:
- this_trait = trait_db[0]
- this_db = trait_db[1]
-
- this_db_samples = this_db.group.all_samples_ordered()
- this_sample_data = this_trait.data
-
- corr_result_row = []
- pca_corr_result_row = []
- is_spearman = False #ZS: To determine if it's above or below the diagonal
- for target in self.trait_list:
- target_trait = target[0]
- target_db = target[1]
- target_samples = target_db.group.all_samples_ordered()
- target_sample_data = target_trait.data
-
- this_trait_vals = []
- target_vals = []
- for index, sample in enumerate(target_samples):
- if (sample in this_sample_data) and (sample in target_sample_data):
- sample_value = this_sample_data[sample].value
- target_sample_value = target_sample_data[sample].value
- this_trait_vals.append(sample_value)
- target_vals.append(target_sample_value)
- else:
- if sample in self.shared_samples_list:
- self.shared_samples_list.remove(sample)
-
- this_trait_vals, target_vals, num_overlap = corr_result_helpers.normalize_values(this_trait_vals, target_vals)
-
- if num_overlap < self.lowest_overlap:
- self.lowest_overlap = num_overlap
- if num_overlap < 2:
- corr_result_row.append([target_trait, 0, num_overlap])
- pca_corr_result_row.append(0)
- else:
- pearson_r, pearson_p = scipy.stats.pearsonr(this_trait_vals, target_vals)
- if is_spearman == False:
- sample_r, sample_p = pearson_r, pearson_p
- if sample_r == 1:
- is_spearman = True
- else:
- sample_r, sample_p = scipy.stats.spearmanr(this_trait_vals, target_vals)
-
- corr_result_row.append([target_trait, sample_r, num_overlap])
- pca_corr_result_row.append(pearson_r)
-
- self.corr_results.append(corr_result_row)
- self.pca_corr_results.append(pca_corr_result_row)
-
- self.trait_data_array = []
- for trait_db in self.trait_list:
- this_trait = trait_db[0]
- this_db = trait_db[1]
- this_db_samples = this_db.group.all_samples_ordered()
- this_sample_data = this_trait.data
+ this_trait_vals = []
+ for sample in self.all_sample_list:
+ if sample in this_sample_data:
+ this_trait_vals.append(this_sample_data[sample].value)
+ else:
+ this_trait_vals.append('')
+ self.sample_data.append(this_trait_vals)
+
+ if len(this_trait_vals) < len(self.trait_list): #Shouldn't do PCA if there are more traits than observations/samples
+ self.do_PCA = False
+
+ self.lowest_overlap = 8 #ZS: Variable set to the lowest overlapping samples in order to notify user, or 8, whichever is lower (since 8 is when we want to display warning)
+
+ self.corr_results = []
+ self.pca_corr_results = []
+ self.shared_samples_list = self.all_sample_list
+ for trait_db in self.trait_list:
+ this_trait = trait_db[0]
+ this_db = trait_db[1]
+
+ this_db_samples = this_db.group.all_samples_ordered()
+ this_sample_data = this_trait.data
+
+ corr_result_row = []
+ pca_corr_result_row = []
+ is_spearman = False #ZS: To determine if it's above or below the diagonal
+ for target in self.trait_list:
+ target_trait = target[0]
+ target_db = target[1]
+ target_samples = target_db.group.all_samples_ordered()
+ target_sample_data = target_trait.data
this_trait_vals = []
- for index, sample in enumerate(this_db_samples):
- if (sample in this_sample_data) and (sample in self.shared_samples_list):
+ target_vals = []
+ for index, sample in enumerate(target_samples):
+ if (sample in this_sample_data) and (sample in target_sample_data):
sample_value = this_sample_data[sample].value
+ target_sample_value = target_sample_data[sample].value
this_trait_vals.append(sample_value)
- self.trait_data_array.append(this_trait_vals)
+ target_vals.append(target_sample_value)
+ else:
+ if sample in self.shared_samples_list:
+ self.shared_samples_list.remove(sample)
- corr_result_eigen = np.linalg.eig(np.array(self.pca_corr_results))
- corr_eigen_value, corr_eigen_vectors = sortEigenVectors(corr_result_eigen)
+ this_trait_vals, target_vals, num_overlap = corr_result_helpers.normalize_values(this_trait_vals, target_vals)
- groups = []
- for sample in self.all_sample_list:
- groups.append(1)
-
- try:
- if self.do_PCA == True:
- self.pca_works = "True"
- self.pca_trait_ids = []
- pca = self.calculate_pca(list(range(len(self.traits))), corr_eigen_value, corr_eigen_vectors)
- self.loadings_array = self.process_loadings()
+ if num_overlap < self.lowest_overlap:
+ self.lowest_overlap = num_overlap
+ if num_overlap < 2:
+ corr_result_row.append([target_trait, 0, num_overlap])
+ pca_corr_result_row.append(0)
else:
- self.pca_works = "False"
- except:
- self.pca_works = "False"
+ pearson_r, pearson_p = scipy.stats.pearsonr(this_trait_vals, target_vals)
+ if is_spearman == False:
+ sample_r, sample_p = pearson_r, pearson_p
+ if sample_r == 1:
+ is_spearman = True
+ else:
+ sample_r, sample_p = scipy.stats.spearmanr(this_trait_vals, target_vals)
+
+ corr_result_row.append([target_trait, sample_r, num_overlap])
+ pca_corr_result_row.append(pearson_r)
- self.js_data = dict(traits = [trait.name for trait in self.traits],
- groups = groups,
- cols = list(range(len(self.traits))),
- rows = list(range(len(self.traits))),
- samples = self.all_sample_list,
- sample_data = self.sample_data,)
- # corr_results = [result[1] for result in result_row for result_row in self.corr_results])
+ self.corr_results.append(corr_result_row)
+ self.pca_corr_results.append(pca_corr_result_row)
+
+ self.trait_data_array = []
+ for trait_db in self.trait_list:
+ this_trait = trait_db[0]
+ this_db = trait_db[1]
+ this_db_samples = this_db.group.all_samples_ordered()
+ this_sample_data = this_trait.data
+
+ this_trait_vals = []
+ for index, sample in enumerate(this_db_samples):
+ if (sample in this_sample_data) and (sample in self.shared_samples_list):
+ sample_value = this_sample_data[sample].value
+ this_trait_vals.append(sample_value)
+ self.trait_data_array.append(this_trait_vals)
+
+ corr_result_eigen = np.linalg.eig(np.array(self.pca_corr_results))
+ corr_eigen_value, corr_eigen_vectors = sortEigenVectors(corr_result_eigen)
+
+ groups = []
+ for sample in self.all_sample_list:
+ groups.append(1)
+
+ try:
+ if self.do_PCA == True:
+ self.pca_works = "True"
+ self.pca_trait_ids = []
+ pca = self.calculate_pca(list(range(len(self.traits))), corr_eigen_value, corr_eigen_vectors)
+ self.loadings_array = self.process_loadings()
+ else:
+ self.pca_works = "False"
+ except:
+ self.pca_works = "False"
+
+ self.js_data = dict(traits = [trait.name for trait in self.traits],
+ groups = groups,
+ cols = list(range(len(self.traits))),
+ rows = list(range(len(self.traits))),
+ samples = self.all_sample_list,
+ sample_data = self.sample_data,)
def calculate_pca(self, cols, corr_eigen_value, corr_eigen_vectors):
base = importr('base')
diff --git a/wqflask/wqflask/docs.py b/wqflask/wqflask/docs.py
index d653c269..23fc3cad 100644
--- a/wqflask/wqflask/docs.py
+++ b/wqflask/wqflask/docs.py
@@ -19,8 +19,10 @@ class Docs(object):
self.title = self.entry.capitalize()
self.content = ""
else:
+
self.title = result[0]
- self.content = result[1]
+ self.content = result[1].decode("utf-8")
+
self.editable = "false"
# ZS: Removing option to edit to see if text still gets vandalized
diff --git a/wqflask/wqflask/markdown_routes.py b/wqflask/wqflask/markdown_routes.py
new file mode 100644
index 00000000..7a9fac41
--- /dev/null
+++ b/wqflask/wqflask/markdown_routes.py
@@ -0,0 +1,39 @@
+"""Markdown routes
+
+Render pages from github, or if they are unavailable, look for it else where
+"""
+import requests
+import markdown
+
+from flask import Blueprint
+from flask import render_template
+
+glossary_blueprint = Blueprint('glossary_blueprint', __name__)
+
+
+def render_markdown(file_name):
+ """Try to fetch the file name from Github and if that fails, try to
+look for it inside the file system
+
+ """
+ github_url = ("https://raw.githubusercontent.com/"
+ "genenetwork/gn-docs/master/")
+ md_content = requests.get(f"{github_url}{file_name}")
+ if md_content.status_code == 200:
+ return markdown.Markdown().convert(md_content.content.decode("utf-8"))
+
+ # TODO: Add fallback on our git server by checking the mirror.
+
+ # Content not available
+ return (f"\nContent for {file_name} not available. "
+ "Please check "
+ "(here to see where content exists)"
+ "[https://github.com/genenetwork/gn-docs]. "
+ "Please reach out to the gn2 team to have a look at this")
+
+
+@glossary_blueprint.route('/')
+def glossary():
+ return render_template(
+ "glossary.html",
+ rendered_markdown=render_markdown("general/glossary/glossary.md")), 200
diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py
index 6d6572ff..08c2d750 100644
--- a/wqflask/wqflask/marker_regression/display_mapping_results.py
+++ b/wqflask/wqflask/marker_regression/display_mapping_results.py
@@ -74,6 +74,14 @@ DARKVIOLET = ImageColor.getrgb("darkviolet")
MEDIUMPURPLE = ImageColor.getrgb("mediumpurple")
# ---- END: Define common colours ---- #
+# ZS: List of distinct colors for manhattan plot if user selects "varied"
+COLOR_CODES = ["#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#FF00FF", "#00FFFF",
+ "#000000", "#800000", "#008000", "#000080", "#808000", "#800080",
+ "#008080", "#808080", "#C00000", "#00C000", "#0000C0", "#C0C000",
+ "#C000C0", "#00C0C0", "#C0C0C0", "#400000", "#004000", "#000040"]
+
+DISTINCT_COLOR_LIST = [ImageColor.getrgb(color) for color in COLOR_CODES]
+
# ---- FONT FILES ---- #
VERDANA_FILE = "./wqflask/static/fonts/verdana.ttf"
VERDANA_BOLD_FILE = "./wqflask/static/fonts/verdanab.ttf"
@@ -293,6 +301,12 @@ class DisplayMappingResults(object):
self.plotScale = "physic"
self.manhattan_plot = start_vars['manhattan_plot']
+ if self.manhattan_plot:
+ self.color_scheme = "alternating"
+ if 'color_scheme' in start_vars:
+ self.color_scheme = start_vars['color_scheme']
+ if self.color_scheme == "single":
+ self.manhattan_single_color = ImageColor.getrgb("#" + start_vars['manhattan_single_color'])
if 'permCheck' in list(start_vars.keys()):
self.permChecked = start_vars['permCheck']
@@ -2076,7 +2090,7 @@ class DisplayMappingResults(object):
if self.lrsMax <= 0: #sliding scale
if "lrs_value" in self.qtlresults[0]:
LRS_LOD_Max = max([result['lrs_value'] for result in self.qtlresults])
- if self.LRS_LOD == "LOD" or self.LRS_LOD == "-log(p)":
+ if self.LRS_LOD == "LOD" or self.LRS_LOD == "-logP":
LRS_LOD_Max = LRS_LOD_Max / self.LODFACTOR
if self.permChecked and self.nperm > 0 and not self.multipleInterval:
self.significant = min(self.significant / self.LODFACTOR, webqtlConfig.MAXLRS)
@@ -2172,7 +2186,7 @@ class DisplayMappingResults(object):
TEXT_X_DISPLACEMENT = -12
else:
TEXT_X_DISPLACEMENT = -30
- if self.LRS_LOD == "-log(p)":
+ if self.LRS_LOD == "-logP":
TEXT_Y_DISPLACEMENT = -242
else:
TEXT_Y_DISPLACEMENT = -210
@@ -2397,7 +2411,7 @@ class DisplayMappingResults(object):
if 'lrs_value' in qtlresult:
- if self.LRS_LOD == "LOD" or self.LRS_LOD == "-log(p)":
+ if self.LRS_LOD == "LOD" or self.LRS_LOD == "-logP":
if qtlresult['lrs_value'] > 460 or qtlresult['lrs_value']=='inf':
#Yc = yZero - webqtlConfig.MAXLRS*LRSHeightThresh/(LRSAxisList[-1]*self.LODFACTOR)
Yc = yZero - webqtlConfig.MAXLRS*LRSHeightThresh/(LRS_LOD_Max*self.LODFACTOR)
@@ -2424,10 +2438,16 @@ class DisplayMappingResults(object):
Yc = yZero - qtlresult['lod_score']*LRSHeightThresh/LRS_LOD_Max
if self.manhattan_plot == True:
- if self.selectedChr == -1 and (previous_chr_as_int % 2 == 1):
- point_color = RED
+ if self.color_scheme == "single":
+ point_color = self.manhattan_single_color
+ elif self.color_scheme == "varied":
+ point_color = DISTINCT_COLOR_LIST[previous_chr_as_int]
else:
- point_color = BLUE
+ if self.selectedChr == -1 and (previous_chr_as_int % 2 == 1):
+ point_color = RED
+ else:
+ point_color = BLUE
+
im_drawer.text(
text="5",
xy=(
diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py
index fa61272f..c474e0e0 100644
--- a/wqflask/wqflask/marker_regression/run_mapping.py
+++ b/wqflask/wqflask/marker_regression/run_mapping.py
@@ -138,7 +138,12 @@ class RunMapping(object):
mapping_results_filename = self.dataset.group.name + "_" + ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(6))
self.mapping_results_path = "{}{}.csv".format(webqtlConfig.GENERATED_IMAGE_DIR, mapping_results_filename)
- if start_vars['manhattan_plot'] == "true":
+ if start_vars['manhattan_plot']:
+ self.color_scheme = "alternating"
+ if "color_scheme" in start_vars:
+ self.color_scheme = start_vars['color_scheme']
+ if self.color_scheme == "single":
+ self.manhattan_single_color = start_vars['manhattan_single_color']
self.manhattan_plot = True
else:
self.manhattan_plot = False
@@ -228,7 +233,7 @@ class RunMapping(object):
self.output_files = start_vars['output_files']
if 'first_run' in start_vars: #ZS: check if first run so existing result files can be used if it isn't (for example zooming on a chromosome, etc)
self.first_run = False
- self.score_type = "-log(p)"
+ self.score_type = "-logP"
self.manhattan_plot = True
with Bench("Running GEMMA"):
if self.use_loco == "True":
@@ -327,7 +332,7 @@ class RunMapping(object):
self.control_marker,
self.manhattan_plot)
elif self.mapping_method == "plink":
- self.score_type = "-log(p)"
+ self.score_type = "-logP"
self.manhattan_plot = True
results = plink_mapping.run_plink(self.this_trait, self.dataset, self.species, self.vals, self.maf)
#results = self.run_plink()
@@ -414,7 +419,7 @@ class RunMapping(object):
highest_chr = marker['chr']
if ('lod_score' in marker.keys()) or ('lrs_value' in marker.keys()):
if 'Mb' in marker.keys():
- marker['display_pos'] = "Chr" + str(marker['chr']) + ": " + "{:.3f}".format(marker['Mb'])
+ marker['display_pos'] = "Chr" + str(marker['chr']) + ": " + "{:.6f}".format(marker['Mb'])
elif 'cM' in marker.keys():
marker['display_pos'] = "Chr" + str(marker['chr']) + ": " + "{:.3f}".format(marker['cM'])
else:
@@ -539,8 +544,8 @@ def export_mapping_results(dataset, trait, markers, results_path, mapping_scale,
output_file.write("Location: " + str(trait.chr) + " @ " + str(trait.mb) + " Mb\n")
output_file.write("\n")
output_file.write("Name,Chr,")
- if score_type.lower() == "-log(p)":
- score_type = "-log(p)"
+ if score_type.lower() == "-logP":
+ score_type = "-logP"
if 'Mb' in markers[0]:
output_file.write("Mb," + score_type)
if 'cM' in markers[0]:
diff --git a/wqflask/wqflask/show_trait/SampleList.py b/wqflask/wqflask/show_trait/SampleList.py
index 37c1d6d5..00495377 100644
--- a/wqflask/wqflask/show_trait/SampleList.py
+++ b/wqflask/wqflask/show_trait/SampleList.py
@@ -8,6 +8,7 @@ from pprint import pformat as pf
from utility import Plot
from utility import Bunch
+
class SampleList(object):
def __init__(self,
dataset,
@@ -34,13 +35,18 @@ class SampleList(object):
# ZS: self.this_trait will be a list if it is a Temp trait
if isinstance(self.this_trait, list):
- if (counter <= len(self.this_trait) and
- str(self.this_trait[counter-1]).upper() != 'X'):
- sample = webqtlCaseData.webqtlCaseData(
- name=sample_name,
- value=float(self.this_trait[counter-1]))
- else:
- sample = webqtlCaseData.webqtlCaseData(name=sample_name)
+ sample = webqtlCaseData.webqtlCaseData(name=sample_name)
+ if counter <= len(self.this_trait):
+ if isinstance(self.this_trait[counter-1], (bytes, bytearray)):
+ if (self.this_trait[counter-1].decode("utf-8").lower() != 'x'):
+ sample = webqtlCaseData.webqtlCaseData(
+ name=sample_name,
+ value=float(self.this_trait[counter-1]))
+ else:
+ if (self.this_trait[counter-1].lower() != 'x'):
+ sample = webqtlCaseData.webqtlCaseData(
+ name=sample_name,
+ value=float(self.this_trait[counter-1]))
else:
# ZS - If there's no value for the sample/strain,
# create the sample object (so samples with no value
@@ -67,7 +73,8 @@ class SampleList(object):
self.sample_list.append(sample)
self.se_exists = any(sample.variance for sample in self.sample_list)
- self.num_cases_exists = any(sample.num_cases for sample in self.sample_list)
+ self.num_cases_exists = any(
+ sample.num_cases for sample in self.sample_list)
first_attr_col = self.get_first_attr_col()
for sample in self.sample_list:
@@ -110,7 +117,7 @@ class SampleList(object):
self.attributes[key].name = name
self.attributes[key].distinct_values = [
item.Value for item in values]
- natural_sort(self.attributes[key].distinct_values)
+ self.attributes[key].distinct_values=natural_sort(self.attributes[key].distinct_values)
all_numbers = True
for value in self.attributes[key].distinct_values:
try:
@@ -162,7 +169,8 @@ class SampleList(object):
return first_attr_col
-def natural_sort(list, key=lambda s: s):
+
+def natural_sort(a_list, key=lambda s: s):
"""
Sort the list into natural alphanumeric order.
"""
@@ -170,4 +178,5 @@ def natural_sort(list, key=lambda s: s):
def convert(text): return int(text) if text.isdigit() else text
return lambda s: [convert(c) for c in re.split('([0-9]+)', key(s))]
sort_key = get_alphanum_key_func(key)
- list.sort(key=sort_key) \ No newline at end of file
+ sorted_list = sorted(a_list, key=sort_key)
+ return sorted_list
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index 25ba1a1d..0c6ae198 100644
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -372,7 +372,7 @@ class ShowTrait(object):
# We're checking a string here!
assert isinstance(this_group, str), "We need a string type thing here"
- if this_group[:3] == 'BXD' and this_group != "BXD-Harvested":
+ if this_group[:3] == 'BXD' and this_group != "BXD-Longevity":
this_group = 'BXD'
if this_group:
diff --git a/wqflask/wqflask/static/Congenic.png b/wqflask/wqflask/static/Congenic.png
new file mode 100644
index 00000000..8cd489a4
--- /dev/null
+++ b/wqflask/wqflask/static/Congenic.png
Binary files differ
diff --git a/wqflask/wqflask/static/images/Belknap_Fig1_1998.png b/wqflask/wqflask/static/images/Belknap_Fig1_1998.png
new file mode 100644
index 00000000..46305fa1
--- /dev/null
+++ b/wqflask/wqflask/static/images/Belknap_Fig1_1998.png
Binary files differ
diff --git a/wqflask/wqflask/static/images/Chrna1vsMyf6.gif b/wqflask/wqflask/static/images/Chrna1vsMyf6.gif
new file mode 100644
index 00000000..881a08e8
--- /dev/null
+++ b/wqflask/wqflask/static/images/Chrna1vsMyf6.gif
Binary files differ
diff --git a/wqflask/wqflask/static/images/Congenic.png b/wqflask/wqflask/static/images/Congenic.png
new file mode 100644
index 00000000..8cd489a4
--- /dev/null
+++ b/wqflask/wqflask/static/images/Congenic.png
Binary files differ
diff --git a/wqflask/wqflask/static/images/Normal_Plot.gif b/wqflask/wqflask/static/images/Normal_Plot.gif
new file mode 100644
index 00000000..dc239f8e
--- /dev/null
+++ b/wqflask/wqflask/static/images/Normal_Plot.gif
Binary files differ
diff --git a/wqflask/wqflask/static/images/SilverFig3_2.png b/wqflask/wqflask/static/images/SilverFig3_2.png
new file mode 100644
index 00000000..5b4b2c70
--- /dev/null
+++ b/wqflask/wqflask/static/images/SilverFig3_2.png
Binary files differ
diff --git a/wqflask/wqflask/static/images/SilverFig3_6.png b/wqflask/wqflask/static/images/SilverFig3_6.png
new file mode 100644
index 00000000..5b91d991
--- /dev/null
+++ b/wqflask/wqflask/static/images/SilverFig3_6.png
Binary files differ
diff --git a/wqflask/wqflask/static/images/Winsorize1.png b/wqflask/wqflask/static/images/Winsorize1.png
new file mode 100644
index 00000000..f3a65f29
--- /dev/null
+++ b/wqflask/wqflask/static/images/Winsorize1.png
Binary files differ
diff --git a/wqflask/wqflask/static/images/Winsorize3.png b/wqflask/wqflask/static/images/Winsorize3.png
new file mode 100644
index 00000000..a9ed95d6
--- /dev/null
+++ b/wqflask/wqflask/static/images/Winsorize3.png
Binary files differ
diff --git a/wqflask/wqflask/static/new/css/markdown.css b/wqflask/wqflask/static/new/css/markdown.css
new file mode 100644
index 00000000..91167908
--- /dev/null
+++ b/wqflask/wqflask/static/new/css/markdown.css
@@ -0,0 +1,13 @@
+#markdown {
+ padding: 20px;
+}
+
+#markdown h2, #markdown h3, #markdown h4, #markdown h5 {
+ font-weight: bold;
+}
+
+#markdown img {
+ display: block;
+ margin-right: auto;
+ margin-left: auto;
+}
diff --git a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js
index 4ec62157..626357d4 100644
--- a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js
+++ b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js
@@ -2,10 +2,6 @@
var add_trait_data, assemble_into_json, back_to_collections, collection_click, collection_list, color_by_trait, create_trait_data_csv, get_this_trait_vals, get_trait_data, process_traits, selected_traits, submit_click, this_trait_data, trait_click,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
-console.log("before get_traits_from_collection");
-
-//collection_list = null;
-
this_trait_data = null;
selected_traits = {};
@@ -69,7 +65,7 @@ if ( ! $.fn.DataTable.isDataTable( '#collection_table' ) ) {
collection_click = function() {
var this_collection_url;
- //console.log("Clicking on:", $(this));
+
this_collection_url = $(this).find('.collection_name').prop("href");
this_collection_url += "&json";
collection_list = $("#collections_holder").html();
@@ -87,9 +83,7 @@ submit_click = function() {
$('#collections_holder').find('input[type=checkbox]:checked').each(function() {
var this_dataset, this_trait, this_trait_url;
this_trait = $(this).parents('tr').find('.trait').text();
- console.log("this_trait is:", this_trait);
this_dataset = $(this).parents('tr').find('.dataset').text();
- console.log("this_dataset is:", this_dataset);
this_trait_url = "/trait/get_sample_data?trait=" + this_trait + "&dataset=" + this_dataset;
return $.ajax({
dataType: "json",
@@ -147,7 +141,7 @@ create_trait_data_csv = function(selected_traits) {
}
all_vals.push(this_trait_vals);
}
- console.log("all_vals:", all_vals);
+
trait_vals_csv = trait_names.join(",");
trait_vals_csv += "\n";
for (index = _k = 0, _len2 = samples.length; _k < _len2; index = ++_k) {
@@ -168,7 +162,7 @@ create_trait_data_csv = function(selected_traits) {
trait_click = function() {
var dataset, this_trait_url, trait;
- console.log("Clicking on:", $(this));
+
trait = $(this).parent().find('.trait').text();
dataset = $(this).parent().find('.dataset').text();
this_trait_url = "/trait/get_sample_data?trait=" + trait + "&dataset=" + dataset;
@@ -182,7 +176,6 @@ trait_click = function() {
trait_row_click = function() {
var dataset, this_trait_url, trait;
- console.log("Clicking on:", $(this));
trait = $(this).find('.trait').text();
dataset = $(this).find('.dataset').data("dataset");
this_trait_url = "/trait/get_sample_data?trait=" + trait + "&dataset=" + dataset;
@@ -208,13 +201,17 @@ populate_cofactor_info = function(trait_info) {
if (trait_info['type'] == "ProbeSet"){
$('#cofactor1_trait_link').text(trait_info['species'] + " " + trait_info['group'] + " " + trait_info['tissue'] + " " + trait_info['db'] + ": " + trait_info['name'])
$('#cofactor1_description').text("[" + trait_info['symbol'] + " on " + trait_info['location'] + " Mb]\n" + trait_info['description'])
- } else {
+ } else if (trait_info['type'] == "Publish") {
$('#cofactor1_trait_link').text(trait_info['species'] + " " + trait_info['group'] + " " + trait_info['db'] + ": " + trait_info['name'])
if ('pubmed_link' in trait_info) {
$('#cofactor1_description').html('<a href=\"' + trait_info['pubmed_link'] + '\">PubMed: ' + trait_info['pubmed_text'] + '</a><br>' + trait_info['description'])
} else {
- $('#cofactor1_description').html('PubMed: ' + trait_info['pubmed_text'] + '<br>' + trait_info['description'])
+ $('#cofactor1_trait_link').text(trait_info['species'] + " " + trait_info['group'] + " " + trait_info['db'] + ": " + trait_info['name'])
+ $('#cofactor1_description').text("[" + trait_info['name'] + " on " + trait_info['location'] + " Mb]\n" + trait_info['description'])
}
+ } else {
+ $('#cofactor1_trait_link').text(trait_info['species'] + " " + trait_info['group'] + " " + trait_info['db'] + ": " + trait_info['name'])
+ $('#cofactor1_description').text("[" + trait_info['name'] + " on " + trait_info['location'] + " Mb]\n")
}
$('#select_cofactor1').text("Change Cofactor 1");
$('#cofactor1_info_container').css("display", "inline");
@@ -224,13 +221,17 @@ populate_cofactor_info = function(trait_info) {
if (trait_info['type'] == "ProbeSet"){
$('#cofactor2_trait_link').text(trait_info['species'] + " " + trait_info['group'] + " " + trait_info['tissue'] + " " + trait_info['db'] + ": " + trait_info['name'])
$('#cofactor2_description').text("[" + trait_info['symbol'] + " on " + trait_info['location'] + " Mb]\n" + trait_info['description'])
- } else {
+ } else if (trait_info['type'] == "Publish") {
$('#cofactor2_trait_link').text(trait_info['species'] + " " + trait_info['group'] + " " + trait_info['db'] + ": " + trait_info['name'])
if ('pubmed_link' in trait_info) {
$('#cofactor2_description').html('<a href=\"' + trait_info['pubmed_link'] + '\">PubMed: ' + trait_info['pubmed_text'] + '</a><br>' + trait_info['description'])
} else {
- $('#cofactor2_description').html('PubMed: ' + trait_info['pubmed_text'] + '<br>' + trait_info['description'])
+ $('#cofactor2_trait_link').text(trait_info['species'] + " " + trait_info['group'] + " " + trait_info['db'] + ": " + trait_info['name'])
+ $('#cofactor2_description').text("[" + trait_info['name'] + " on " + trait_info['location'] + " Mb]\n" + trait_info['description'])
}
+ } else {
+ $('#cofactor2_trait_link').text(trait_info['species'] + " " + trait_info['group'] + " " + trait_info['db'] + ": " + trait_info['name'])
+ $('#cofactor2_description').text("[" + trait_info['name'] + " on " + trait_info['location'] + " Mb]\n")
}
$('#select_cofactor2').text("Change Cofactor 2");
$('#cofactor2_info_container').css("display", "inline");
@@ -240,13 +241,17 @@ populate_cofactor_info = function(trait_info) {
if (trait_info['type'] == "ProbeSet"){
$('#cofactor3_trait_link').text(trait_info['species'] + " " + trait_info['group'] + " " + trait_info['tissue'] + " " + trait_info['db'] + ": " + trait_info['name'])
$('#cofactor3_description').text("[" + trait_info['symbol'] + " on " + trait_info['location'] + " Mb]\n" + trait_info['description'])
- } else {
+ } else if (trait_info['type'] == "Publish") {
$('#cofactor3_trait_link').text(trait_info['species'] + " " + trait_info['group'] + " " + trait_info['db'] + ": " + trait_info['name'])
if ('pubmed_link' in trait_info) {
$('#cofactor3_description').html('<a href=\"' + trait_info['pubmed_link'] + '\">PubMed: ' + trait_info['pubmed_text'] + '</a><br>' + trait_info['description'])
} else {
- $('#cofactor3_description').html('PubMed: ' + trait_info['pubmed_text'] + '<br>' + trait_info['description'])
+ $('#cofactor3_trait_link').text(trait_info['species'] + " " + trait_info['group'] + " " + trait_info['db'] + ": " + trait_info['name'])
+ $('#cofactor3_description').text("[" + trait_info['name'] + " on " + trait_info['location'] + " Mb]\n" + trait_info['description'])
}
+ } else {
+ $('#cofactor3_trait_link').text(trait_info['species'] + " " + trait_info['group'] + " " + trait_info['db'] + ": " + trait_info['name'])
+ $('#cofactor3_description').text("[" + trait_info['name'] + " on " + trait_info['location'] + " Mb]\n")
}
$('#select_cofactor3').text("Change Cofactor 3");
$('#cofactor3_info_container').css("display", "inline");
@@ -256,7 +261,6 @@ populate_cofactor_info = function(trait_info) {
get_trait_data = function(trait_data, textStatus, jqXHR) {
var sample, samples, this_trait_vals, trait_sample_data, vals, _i, _len;
trait_sample_data = trait_data[1];
- console.log("IN GET TRAIT DATA")
if ( $('input[name=allsamples]').length ) {
samples = $('input[name=allsamples]').val().split(" ");
} else {
@@ -362,13 +366,11 @@ assemble_into_json = function(this_trait_vals) {
};
color_by_trait = function(trait_sample_data, textStatus, jqXHR) {
- console.log('in color_by_trait:', trait_sample_data);
return root.bar_chart.color_by_trait(trait_sample_data);
};
process_traits = function(trait_data, textStatus, jqXHR) {
var the_html, trait, _i, _len;
- console.log('in process_traits with trait_data:', trait_data);
the_html = "<button id='back_to_collections' class='btn btn-inverse btn-small'>";
the_html += "<i class='icon-white icon-arrow-left'></i> Back </button>";
the_html += " <button id='submit' class='btn btn-primary btn-small'> Submit </button>";
@@ -397,13 +399,11 @@ process_traits = function(trait_data, textStatus, jqXHR) {
};
back_to_collections = function() {
- collection_list_html = $('#collection_list_html').html()
- $("#collections_holder").html(collection_list_html);
+ $("#collections_holder").html(collection_list);
$(document).on("click", ".collection_line", collection_click);
return $('#collections_holder').colorbox.resize();
};
-console.log("inside get_traits_from_collection");
$(".collection_line").on("click", collection_click);
$("#submit").on("click", submit_click);
if ($('#scatterplot2').length){
diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html
index 0f4e5ef5..0e572fcf 100644
--- a/wqflask/wqflask/templates/base.html
+++ b/wqflask/wqflask/templates/base.html
@@ -66,7 +66,7 @@
<ul class="dropdown-menu">
<li><a href="/references">References</a></li>
<li><a href="/tutorials">Tutorials/Primers</a></li>
- <li><a href="http://gn1.genenetwork.org/glossary.html">Glossary of Term</a></li>
+ <li><a href="{{ url_for('glossary_blueprint.glossary') }}">Glossary of Term</a></li>
<li><a href="http://gn1.genenetwork.org/faq.html">FAQ</a></li>
<li><a href="/policies">Policies</a></li>
<li><a href="/links">Links</a></li>
@@ -159,9 +159,10 @@
<a href="http://www.senresearch.org">Saunak Sen</a>,
<a href="mailto:zachary.a.sloan@gmail.com">Zachary Sloan</a>,
<a href="mailto:acenteno@uthsc.edu">Arthur Centeno</a>,
- and <a href="mailto:cfische7@uthsc.edu">Christian Fischer</a>.
+ <a href="mailto:cfische7@uthsc.edu">Christian Fischer</a>
+ and <a href="mailto:bonfacemunyoki@gmail.com">Bonface Munyoki</a>.
</p>
- <p>Design and code by Pjotr Prins, Zach Sloan, Arthur Centeno, Christan Fischer, Danny Arends, Sam Ockman, Lei Yan, Xiaodong Zhou, Christian Fernandez,
+ <p>Design and code by Pjotr Prins, Zach Sloan, Arthur Centeno, Christan Fischer, Bonface Munyoki, Danny Arends, Sam Ockman, Lei Yan, Xiaodong Zhou, Christian Fernandez,
Ning Liu, Rudi Alberts, Elissa Chesler, Sujoy Roy, Evan G. Williams, Alexander G. Williams, Kenneth Manly, Jintao Wang, Robert W. Williams, and
<!--<a href="http://genenetwork.org/credit.html">colleagues</a>.</p>-->
<a href="/credits">colleagues</a>.</p>
diff --git a/wqflask/wqflask/templates/collections/add.html b/wqflask/wqflask/templates/collections/add.html
index 62b6abb5..b4e5385b 100644
--- a/wqflask/wqflask/templates/collections/add.html
+++ b/wqflask/wqflask/templates/collections/add.html
@@ -50,4 +50,7 @@
<script>
$('#add_form').parsley();
+ $('#add_form').on('submit', function(){
+ parent.jQuery.colorbox.close();
+ });
</script>
diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html
index 13497823..e37f8104 100644
--- a/wqflask/wqflask/templates/collections/view.html
+++ b/wqflask/wqflask/templates/collections/view.html
@@ -100,9 +100,9 @@
<th data-export="Description">Description</th>
<th data-export="Location">Location</th>
<th data-export="Mean">Mean</th>
- <th data-export="Max LRS">High P <a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="font-size: small; color: #FF0000;"> ?</sup></a></th>
+ <th data-export="Max LRS">High P <a href="{{ url_for('glossary_blueprint.glossary') }}#L" target="_blank"><sup style="font-size: small; color: #FF0000;"> ?</sup></a></th>
<th data-export="Peak Location">Peak Location</th>
- <th data-export="Add. Eff.">Effect Size <a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="font-size: small; color: #FF0000;"> ?</sup></a></th>
+ <th data-export="Add. Eff.">Effect Size <a href="{{ url_for('glossary_blueprint.glossary') }}#A" target="_blank"><sup style="font-size: small; color: #FF0000;"> ?</sup></a></th>
</tr>
</thead>
diff --git a/wqflask/wqflask/templates/corr_scatterplot.html b/wqflask/wqflask/templates/corr_scatterplot.html
index 1fd5cd15..1133fcd2 100644
--- a/wqflask/wqflask/templates/corr_scatterplot.html
+++ b/wqflask/wqflask/templates/corr_scatterplot.html
@@ -81,9 +81,9 @@
<div id="cofactor_color_selector" style="margin-bottom: 10px; display:none;">
<hr>
<b>Cofactor Color Range:</b>
- <input class="chartupdatedata" name="color2" type="hidden" id="cocolorfrom" value="#D9D9D9">
+ <input class="chartupdatedata" name="color2" type="hidden" id="cocolorfrom" value="#0000FF">
<button class="chartupdatedata jscolor {valueElement: 'cocolorfrom'}">Low</button>
- <input class="chartupdatedata" name="color1" type="hidden" id="cocolorto" value="#000000">
+ <input class="chartupdatedata" name="color1" type="hidden" id="cocolorto" value="#FF0000">
<button class="chartupdatedata jscolor {valueElement: 'cocolorto'}">High</button>
<hr>
</div>
diff --git a/wqflask/wqflask/templates/correlation_matrix.html b/wqflask/wqflask/templates/correlation_matrix.html
index d556f31a..4e150618 100644
--- a/wqflask/wqflask/templates/correlation_matrix.html
+++ b/wqflask/wqflask/templates/correlation_matrix.html
@@ -51,8 +51,12 @@
{% if result[0].name == trait.name and result[0].dataset == trait.dataset %}
<td nowrap="ON" align="center" bgcolor="#cccccc" style="padding: 3px; line-height: 1.1;"><a href="/show_trait?trait_id={{ trait.name }}&dataset={{ trait.dataset.name }}"><font style="font-size: 12px; color: #3071a9; font-weight: bold;" ><em>n</em><br>{{ result[2] }}</font></a></td>
{% else %}
+ {% if result[1] == 0 %}
+ <td nowrap="ON" align="middle" bgcolor="#eeeeee" style="padding: 3px; line-height: 1.1;">N/A</td>
+ {% else %}
<td nowrap="ON" align="middle" class="corr_cell" style="padding: 3px; line-height: 1.1;"><a href="/corr_scatter_plot?dataset_1={% if trait.dataset.name == 'Temp' %}Temp_{{ trait.dataset.group.name }}{% else %}{{ trait.dataset.name }}{% endif %}&dataset_2={% if result[0].dataset.name == 'Temp' %}Temp_{{ result[0].dataset.group.name }}{% else %}{{ result[0].dataset.name }}{% endif %}&trait_1={{ trait.name }}&trait_2={{ result[0].name }}"><font style="font-size: 12px; color: #3071a9; font-weight: bold;" ><span class="corr_value">{{ '%0.2f' % result[1] }}</span><br>{{ result[2] }}</font></a></td>
{% endif %}
+ {% endif %}
{% endfor %}
</tr>
{% endfor %}
diff --git a/wqflask/wqflask/templates/glossary.html b/wqflask/wqflask/templates/glossary.html
new file mode 100644
index 00000000..146c7e86
--- /dev/null
+++ b/wqflask/wqflask/templates/glossary.html
@@ -0,0 +1,16 @@
+{% extends "base.html" %}
+
+{% block title %}Glossary{% endblock %}
+
+{% block css %}
+<link rel="stylesheet" type="text/css" href="/static/new/css/markdown.css" />
+{% endblock %}
+
+{% block content %}
+
+<div id="markdown" class="container">
+ <small>
+ <a href="https://raw.githubusercontent.com/genenetwork/genenetwork2/wqflask/wqflask/static/glossary.md" target="_">[Edit on Github]</a></small>
+ {{ rendered_markdown|safe }}
+</div>
+{% endblock %}
diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html
index d2c78d65..d5bc4141 100644
--- a/wqflask/wqflask/templates/gsearch_gene.html
+++ b/wqflask/wqflask/templates/gsearch_gene.html
@@ -215,7 +215,7 @@
'orderSequence': [ "desc", "asc"]
},
{
- 'title': "Max<br>LRS<a href=\"http://genenetwork.org//glossary.html#LRS\" target=\"_blank\" style=\"color: white;\"><sup>?</sup></a>",
+ 'title': "Max<br>LRS<a href=\"{{ url_for('glossary_blueprint.glossary') }}#LRS\" target=\"_blank\" style=\"color: white;\"><sup>?</sup></a>",
'type': "natural-minus-na",
'data': "LRS_score_repr",
'orderSequence': [ "desc", "asc"]
@@ -227,7 +227,7 @@
'data': "max_lrs_text"
},
{
- 'title': "Additive<br>Effect<a href=\"http://genenetwork.org//glossary.html#A\" target=\"_blank\" style=\"color: white;\"><sup>?</sup></a>",
+ 'title': "Additive<br>Effect<a href=\"{{ url_for('glossary_blueprint.glossary') }}#A\" target=\"_blank\" style=\"color: white;\"><sup>?</sup></a>",
'type': "natural-minus-na",
'width': "50px",
'data': "additive",
@@ -262,9 +262,9 @@
'<th>Description</th>' +
'<th>Location</th>' +
'<th>Mean</th>' +
- '<th>Max LRS <a href="http://genenetwork.org//glossary.html#LRS" target="_blank" style="color: white;"><sup>?</sup></a></th>' +
+ '<th>Max LRS <a href="{{ url_for('glossary_blueprint.glossary') }}#LRS" target="_blank" style="color: white;"><sup>?</sup></a></th>' +
'<th>Max LRS Location</th>' +
- '<th>Additive Effect <a href="http://genenetwork.org//glossary.html#A" target="_blank" style="color: white;"><sup>?</sup></a></th>' +
+ '<th>Additive Effect <a href="{{ url_for('glossary_blueprint.glossary') }}#A" target="_blank" style="color: white;"><sup>?</sup></a></th>' +
'</tr>' +
'</tfoot>'
);
diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html
index c44231f3..ccd4a9d9 100644
--- a/wqflask/wqflask/templates/gsearch_pheno.html
+++ b/wqflask/wqflask/templates/gsearch_pheno.html
@@ -218,7 +218,7 @@
'orderSequence': [ "desc", "asc"]
},
{
- 'title': "Max LRS<a href=\"http://genenetwork.org//glossary.html#LRS\" target=\"_blank\" style=\"color: white;\"><sup>?</sup></a>",
+ 'title': "Max LRS<a href=\"{{ url_for('glossary_blueprint.glossary') }}#LRS\" target=\"_blank\" style=\"color: white;\"><sup>?</sup></a>",
'type': "natural-minus-na",
'data': "LRS_score_repr",
'orderSequence': [ "desc", "asc"]
@@ -230,7 +230,7 @@
'data': "max_lrs_text"
},
{
- 'title': "Additive Effect<a href=\"http://genenetwork.org//glossary.html#A\" target=\"_blank\" style=\"color: white;\"><sup>?</sup></a>",
+ 'title': "Additive Effect<a href=\"{{ url_for('glossary_blueprint.glossary') }}#A\" target=\"_blank\" style=\"color: white;\"><sup>?</sup></a>",
'type': "natural-minus-na",
'data': "additive",
'orderSequence': [ "desc", "asc"]
diff --git a/wqflask/wqflask/templates/index_page.html b/wqflask/wqflask/templates/index_page.html
index f8720d39..12c28e72 100644
--- a/wqflask/wqflask/templates/index_page.html
+++ b/wqflask/wqflask/templates/index_page.html
@@ -140,7 +140,7 @@
chromosome 1 between 25 and 30 Mb.</li>
<li><b>MEAN=(15 16) LRS=(23 46)</b> in the <b>Combined</b> field finds
- highly expressed genes (15 to 16 log2 units) AND with peak <a href="http://www.genenetwork.org/glossary.html#L">LRS</a>
+ highly expressed genes (15 to 16 log2 units) AND with peak <a href="{{ url_for('glossary_blueprint.glossary') }}#L">LRS</a>
linkage between 23 and 46.</li>
<li><b>RANGE=(1.5 2.5)</b> in the <b>Any</b> field finds traits with values with a specified fold-range (minimum = 1).
@@ -157,12 +157,12 @@
<a href="http://amigo.geneontology.org/amigo/medial_search?q=GO%3A0045202">Gene Ontology</a>.</li>
<li><b>GO:0045202 LRS=(9 99 Chr4 122 155) cisLRS=(9 999 10)</b>
- finds synapse-associated genes with <a href="http://www.genenetwork.org/glossary.html#E">
+ finds synapse-associated genes with <a href="{{ url_for('glossary_blueprint.glossary') }}#E">
cis eQTL</a> on Chr 4 from 122 and 155 Mb with LRS scores
between 9 and 999.</li>
<li><b>RIF=diabetes LRS=(9 999 Chr2 100 105) transLRS=(9 999 10)</b>
- finds diabetes-associated transcripts with peak <a href="http://www.genenetwork.org/glossary.html#E">
+ finds diabetes-associated transcripts with peak <a href="{{ url_for('glossary_blueprint.glossary') }}#E">
trans eQTLs</a> on Chr 2 between 100 and 105 Mb with LRS
scores between 9 and 999.</li>
</ul>
diff --git a/wqflask/wqflask/templates/index_page_orig.html b/wqflask/wqflask/templates/index_page_orig.html
index 6b3bec9a..13ca52df 100755
--- a/wqflask/wqflask/templates/index_page_orig.html
+++ b/wqflask/wqflask/templates/index_page_orig.html
@@ -177,7 +177,7 @@
Gene Ontology</a>.</li>
<li><b>RIF=diabetes LRS=(9 999 Chr2 100 105) transLRS=(9 999 10)</b>
- finds diabetes-associated transcripts with peak <a href="http://gn1.genenetwork.org/glossary.html#E">
+ finds diabetes-associated transcripts with peak <a href="{{ url_for('glossary_blueprint.glossary') }}#E">
trans eQTLs</a> on Chr 2 between 100 and 105 Mb with LRS
scores between 9 and 999.</li>
</ul>
diff --git a/wqflask/wqflask/templates/mapping_results.html b/wqflask/wqflask/templates/mapping_results.html
index e68a792a..9542c29d 100644
--- a/wqflask/wqflask/templates/mapping_results.html
+++ b/wqflask/wqflask/templates/mapping_results.html
@@ -40,6 +40,9 @@
<input type="hidden" name="use_loco" value="{{ use_loco }}">
<input type="hidden" name="selected_chr" value="{{ selectedChr }}">
<input type="hidden" name="manhattan_plot" value="{{ manhattan_plot }}">
+ {% if manhattan_plot == True %}
+ <input type="hidden" name="color_scheme" value="alternating">
+ {% endif %}
<input type="hidden" name="num_perm" value="{{ nperm }}">
<input type="hidden" name="perm_info" value="">
<input type="hidden" name="perm_strata" value="{{ perm_strata }}">
@@ -55,7 +58,7 @@
<input type="hidden" name="wanted_inputs" value="">
<input type="hidden" name="form_url" value="/run_mapping">
- <div class="container">
+ <div class="container" style="min-width: 1400px;">
<div class="col-xs-5">
<h2>Map Viewer: Whole Genome</h2><br>
<b>Population:</b> {{ dataset.group.species|capitalize }} {{ dataset.group.name }}<br>
@@ -77,7 +80,7 @@
<table>
<tr>
<td><b>Chr:&nbsp;</b></td>
- <td>
+ <td style="padding: 5px;">
<select name="chromosomes" size="1">
{% for chr in ChrList %}
<option value="{{ chr[1] }}" {% if (chr[1] + 1) == selectedChr %}selected{% endif %}>{{ chr[0] }}</option>
@@ -87,7 +90,7 @@
</td>
</tr>
<tr>
- <td><b>View:&nbsp;</b></td>
+ <td ><b>View:&nbsp;</b></td>
<td style="padding: 5px;">
<input type="text" name="startMb" size="7" value="{% if startMb != -1 %}{{ startMb }}{% endif %}"> to <input type="text" name="endMb" size="7" value="{% if endMb != -1 %}{{ endMb }}{% endif %}">
</td>
@@ -99,7 +102,7 @@
<input type="radio" name="LRSCheck" value="LRS" {% if LRS_LOD == "LRS" %}checked{% endif %}>LRS
</label>
<label class="radio-inline">
- <input type="radio" name="LRSCheck" value="{% if LRS_LOD == "-log(p)" %}-log(p){% else %}LOD{% endif %}" {% if LRS_LOD == "LOD" or LRS_LOD == "-log(p)" %}checked{% endif %}>{% if LRS_LOD == "-log(p)" %}-log(p){% else %}LOD{% endif %}
+ <input type="radio" name="LRSCheck" value="{% if LRS_LOD == "-logP" %}-logP{% else %}LOD{% endif %}" {% if LRS_LOD == "LOD" or LRS_LOD == "-logP" %}checked{% endif %}>{% if LRS_LOD == "-logP" %}-logP{% else %}LOD{% endif %}
</label>
<a href="http://genenetwork.org/glossary.html#LOD" target="_blank">
<sup style="color:#f00"> ?</sup>
@@ -114,11 +117,31 @@
</tr>
<tr>
<td><b>Width:&nbsp;</b></td>
- <td>
+ <td style="padding: 5px;">
<input type="text" name="graphWidth" value="{% if graphWidth is defined %}{{ graphWidth }}{% else %}1600{% endif %}" size="5"><span style="font-size: 12px;"> pixels (minimum=900)</span>
</td>
</tr>
</table>
+ {% if manhattan_plot == True and selectedChr == -1 %}
+ <table style="margin-top: 10px;">
+ <tr>
+ <td>
+ <b>Manhattan Plot Color Scheme:&nbsp;</b>
+ </td>
+ <td>
+ <select id="color_scheme">
+ <option value="alternating" {% if color_scheme == "alternating" %}selected{% endif %}>Alternating</option>
+ <option value="varied" {% if color_scheme == "varied" %}selected{% endif %}>Varied by Chr</option>
+ <option value="single" {% if color_scheme == "single" %}selected{% endif %}>Single Color</option>
+ </select>
+ </td>
+ <td>
+ <input name="manhattan_single_color" type="hidden" id="point_color" value={% if manhattan_single_color %}{{ manhattan_single_color }}{% else %}"#D9D9D9"{% endif %}>
+ <button style="display: none; margin-left: 5px;" id="point_color_picker" class="jscolor {valueElement: 'point_color'}">Choose Color</button>
+ </td>
+ </tr>
+ </table>
+ {% endif %}
</div>
<div class="col-xs-4" style="padding: 0px;">
{% if (mapping_method == "reaper" or mapping_method == "rqtl_geno") and nperm > 0 %}
@@ -235,8 +258,8 @@
<th></th>
<th>Row</th>
<th>Marker</th>
- {% if LRS_LOD == "-log(p)" %}
- <th><div style="text-align: right;">–log(p)</div></th>
+ {% if LRS_LOD == "-logP" %}
+ <th><div style="text-align: right;">–logP</div></th>
{% else %}
<th><div style="text-align: right;">{{ LRS_LOD }}</div></th>
{% endif %}
@@ -259,7 +282,7 @@
</td>
<td align="right">{{ loop.index }}</td>
<td>{% if geno_db_exists == "True" %}<a href="/show_trait?trait_id={{ marker.name }}&dataset={{ dataset.group.name }}Geno">{{ marker.name }}</a>{% else %}{{ marker.name }}{% endif %}</td>
- {% if LRS_LOD == "LOD" or LRS_LOD == "-log(p)" %}
+ {% if LRS_LOD == "LOD" or LRS_LOD == "-logP" %}
{% if 'lod_score' in marker %}
<td align="right">{{ '%0.2f' | format(marker.lod_score|float) }}</td>
{% else %}
@@ -328,6 +351,9 @@
<script type="text/javascript" src="{{ url_for('js', filename='underscore-string/underscore.string.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('js', filename='d3-tip/d3-tip.js') }}"></script>
<script type="text/javascript" src="/static/new/js_external/plotly-latest.min.js"></script>
+ {% if manhattan_plot == True and selectedChr == -1 %}
+ <script type="text/javascript" src="/static/new/js_external/jscolor.js"></script>
+ {% endif %}
<script language="javascript" type="text/javascript" src="{{ url_for('js', filename='DataTables/js/jquery.dataTables.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/dataTables.buttons.min.js"></script>
@@ -423,7 +449,7 @@
var mapping_input_list = ['temp_uuid', 'trait_id', 'dataset', 'tool_used', 'form_url', 'method', 'transform', 'trimmed_markers', 'selected_chr', 'chromosomes', 'mapping_scale',
'score_type', 'suggestive', 'significant', 'num_perm', 'permCheck', 'perm_output', 'perm_strata', 'categorical_vars', 'num_bootstrap', 'bootCheck', 'bootstrap_results',
- 'LRSCheck', 'covariates', 'maf', 'use_loco', 'manhattan_plot', 'control_marker', 'control_marker_db', 'do_control', 'genofile',
+ 'LRSCheck', 'covariates', 'maf', 'use_loco', 'manhattan_plot', 'color_scheme', 'manhattan_single_color', 'control_marker', 'control_marker_db', 'do_control', 'genofile',
'pair_scan', 'startMb', 'endMb', 'graphWidth', 'lrsMax', 'additiveCheck', 'showSNP', 'showGenes', 'viewLegend', 'haplotypeAnalystCheck',
'mapmethod_rqtl_geno', 'mapmodel_rqtl_geno', 'temp_trait', 'group', 'species', 'reaper_version', 'primary_samples', 'n_samples']
@@ -449,10 +475,21 @@
remap = function() {
$('input[name=selected_chr]').val($('select[name=chromosomes]').val());
+ $('input[name=color_scheme]').val($('select#color_scheme').val());
$('#marker_regression_form').attr('action', '/loading');
return $('#marker_regression_form').submit();
};
+ {% if manhattan_plot == True and selectedChr == -1 %}
+ $('#color_scheme').change(function(){
+ if ($(this).val() == "single"){
+ $('#point_color_picker').show();
+ } else {
+ $('#point_color_picker').hide();
+ }
+ });
+ {% endif %}
+
{% if mapping_method != "gemma" and mapping_method != "plink" %}
$('#download_perm').click(function(){
perm_info_dict = {
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html
index b3f56293..9a28a78e 100644
--- a/wqflask/wqflask/templates/search_result_page.html
+++ b/wqflask/wqflask/templates/search_result_page.html
@@ -2,6 +2,7 @@
{% block title %}Search Results{% endblock %}
{% block css %}
<link rel="stylesheet" type="text/css" href="{{ url_for('css', filename='DataTables/css/jquery.dataTables.css') }}" />
+ <link rel="stylesheet" type="text/css" href="{{ url_for('css', filename='fontawesome/css/font-awesome.min.css') }}" />
<link rel="stylesheet" type="text/css" href="{{ url_for('js', filename='DataTablesExtensions/scroller/css/scroller.dataTables.min.css') }}">
<link rel="stylesheet" type="text/css" href="{{ url_for('js', filename='DataTablesExtensions/buttonStyles/css/buttons.dataTables.min.css') }}">
<link rel="stylesheet" type="text/css" href="/static/new/css/show_trait.css" />
@@ -184,6 +185,7 @@
<script language="javascript" type="text/javascript" src="{{ url_for('js', filename='DataTablesExtensions/plugins/sorting/natural.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ url_for('js', filename='DataTablesExtensions/buttons/js/dataTables.buttons.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ url_for('js', filename='DataTablesExtensions/buttons/js/buttons.colVis.min.js') }}"></script>
+ <script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/js/all.min.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/javascript/search_results.js"></script>
@@ -331,10 +333,10 @@
'orderSequence': [ "desc", "asc"]
},
{
- 'title': "High P<a href=\"http://gn1.genenetwork.org//glossary.html#LRS\" target=\"_blank\" style=\"color: white;\"><sup style=\"font-size: small; color: #FF0000;\"> ?</sup></a>",
+ 'title': "High P<a href=\"{{ url_for('glossary_blueprint.glossary') }}#LRS\" target=\"_blank\" style=\"color: white;\">&nbsp;<i class=\"fa fa-info-circle\" aria-hidden=\"true\"></i></a>",
'type': "natural-minus-na",
'data': "lrs_score",
- 'width': "60px",
+ 'width': "65px",
'orderSequence': [ "desc", "asc"]
},
{
@@ -344,10 +346,10 @@
'data': "lrs_location"
},
{
- 'title': "Effect Size<a href=\"http://gn1.genenetwork.org//glossary.html#A\" target=\"_blank\" style=\"color: white;\"><sup style=\"font-size: small; color: #FF0000;\"> ?</sup></a>",
+ 'title': "Effect Size<a href=\"{{ url_for('glossary_blueprint.glossary') }}#A\" target=\"_blank\" style=\"color: white;\">&nbsp;<i class=\"fa fa-info-circle\" aria-hidden=\"true\"></i></a>",
'type': "natural-minus-na",
'data': "additive",
- 'width': "85px",
+ 'width': "90px",
'orderSequence': [ "desc", "asc"]
}{% elif dataset.type == 'Publish' %},
{
@@ -400,7 +402,7 @@
'orderSequence': [ "desc", "asc"]
},
{
- 'title': "High P<a href=\"http://gn1.genenetwork.org//glossary.html#LRS\" target=\"_blank\" style=\"color: white;\"><sup style=\"font-size: small; color: #FF0000;\"> ?</sup></a>",
+ 'title': "High P<a href=\"{{ url_for('glossary_blueprint.glossary') }}#LRS\" target=\"_blank\" style=\"color: white;\">&nbsp;<i class=\"fa fa-info-circle\" aria-hidden=\"true\"></i></a>",
'type': "natural-minus-na",
'data': "lrs_score",
'width': "80px",
@@ -413,7 +415,7 @@
'data': "lrs_location"
},
{
- 'title': "Effect Size<a href=\"http://gn1.genenetwork.org//glossary.html#A\" target=\"_blank\" style=\"color: white;\"><sup style=\"font-size: small; color: #FF0000;\"> ?</sup></a>",
+ 'title': "Effect Size<a href=\"{{ url_for('glossary_blueprint.glossary') }}#A\" target=\"_blank\" style=\"color: white;\">&nbsp;<i class=\"fa fa-info-circle\" aria-hidden=\"true\"></i></a>",
'type': "natural-minus-na",
'width': "120px",
'data': "additive",
@@ -438,8 +440,6 @@
'processing': 'Loading...'
}
} );
-
- console.timeEnd("Creating table");
$('.toggle-vis').on( 'click', function (e) {
e.preventDefault();
@@ -470,5 +470,4 @@
});
</script>
-{% endblock %}
-
+{% endblock %} \ No newline at end of file
diff --git a/wqflask/wqflask/templates/show_trait_calculate_correlations.html b/wqflask/wqflask/templates/show_trait_calculate_correlations.html
index bc1d4091..4f25e90a 100644
--- a/wqflask/wqflask/templates/show_trait_calculate_correlations.html
+++ b/wqflask/wqflask/templates/show_trait_calculate_correlations.html
@@ -120,7 +120,7 @@
is computed
between trait data and any
other traits in the sample database selected above. Use
- <a href="http://www.genenetwork.org/glossary.html#Correlations">Spearman
+ <a href="{{ url_for('glossary_blueprint.glossary') }}#Correlations">Spearman
Rank</a>
when the sample size is small (&lt;20) or when there are influential outliers.
</span>
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 08673f79..5f6a431d 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -1,6 +1,4 @@
-# -*- coding: utf-8 -*-
-#
-# Main routing table for GN2
+"""Main routing table for GN2"""
import traceback # for error page
import os # for error gifs
@@ -306,8 +304,8 @@ def news():
@app.route("/references")
def references():
doc = Docs("references", request.args)
+ # return render_template("reference.html")
return render_template("docs.html", **doc.__dict__)
- #return render_template("reference.html")
@app.route("/intro")
def intro():
@@ -720,6 +718,8 @@ def mapping_results_page():
'maf',
'use_loco',
'manhattan_plot',
+ 'color_scheme',
+ 'manhattan_single_color',
'control_marker',
'control_marker_db',
'do_control',