aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/ISSUE_TEMPLATE/bug_report.md16
-rw-r--r--.github/ISSUE_TEMPLATE/feature_request.md23
-rw-r--r--.github/ISSUE_TEMPLATE/user_story.md8
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md9
-rw-r--r--jquery.qtip.css623
-rw-r--r--wqflask/tests/wqflask/show_trait/test_export_trait_data.py118
-rw-r--r--wqflask/utility/redis_tools.py10
-rw-r--r--wqflask/wqflask/correlation/show_corr_results.py19
-rw-r--r--wqflask/wqflask/marker_regression/display_mapping_results.py3
-rw-r--r--wqflask/wqflask/show_trait/show_trait.py4
10 files changed, 174 insertions, 659 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 7d7e34a5..48bad39b 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -9,26 +9,26 @@ assignees: ''
**Describe the bug**
-A clear and concise description of what the bug is.
+<!-- A clear and concise description of what the bug is. -->
**To Reproduce**
-Steps to reproduce the behavior
+<!-- Steps to reproduce the behavior -->
**Expected behavior**
-A clear and concise description of what you expected to happen.
+<!-- A clear and concise description of what you expected to happen. -->
**Screenshots**
-If applicable, add screenshots to help explain your problem.
+<!-- If applicable, add screenshots to help explain your problem. -->
**Environment setup (please complete the following information):**
-- OS: [e.g. Linux]
-- Guix Version (optional)
-- [Anything else you think is relevant]
+<!-- - OS: [e.g. Linux] -->
+<!-- - Guix Version (optional) -->
+<!-- - [Anything else you think is relevant] -->
**Additional context**
-Add any other context about the problem here.
+<!-- Add any other context about the problem here. -->
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
index 254754c6..eb6c3e4b 100644
--- a/.github/ISSUE_TEMPLATE/feature_request.md
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -9,26 +9,33 @@ assignees: ''
## Is your feature request related to a problem? Please describe.
-A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+<!-- A clear and concise description of what the problem is. -->
+
+<!-- Example: I'm always frustrated when [...] -->
## Describe the solution you'd like
-A clear and concise description of what you want to happen.
+<!-- A clear and concise description of what you want to happen. -->
## Describe alternatives you've considered
-A clear and concise description of any alternative solutions or features you've considered.
+<!-- A clear and concise description of any alternative solutions or features you've considered. -->
## User Stories (optional)
-As a _[role or persona]_, I want _[goal/ need]_ so that _[why]_
+<!-- Example: -->
+
+<!-- As a _[role or persona]_, I want _[goal/ need]_ so that _[why]_ -->
+
+<!-- **Feature:** _[Brief description of feature]_ -->
-**Feature:** _[Brief description of feature]_
+<!-- _[Any additional descriptions on feature]_ -->
-_[Any additional descriptions on feature]_
+<!-- **Scenario:**
-**Scenario:** Please use _[Gherkin](https://cucumber.io/docs/gherkin/reference/)_ here
+Please use _[Gherkin](https://cucumber.io/docs/gherkin/reference/)_
+here -->
## Additional context
-Add any other context or screenshots about the feature request here.
+<!-- Add any other context or screenshots about the feature request here. -->
diff --git a/.github/ISSUE_TEMPLATE/user_story.md b/.github/ISSUE_TEMPLATE/user_story.md
index 2682fc98..52ae775d 100644
--- a/.github/ISSUE_TEMPLATE/user_story.md
+++ b/.github/ISSUE_TEMPLATE/user_story.md
@@ -7,10 +7,10 @@ assignees: ''
---
-As a _[role or persona]_, I want _[goal/ need]_ so that _[why]_
+<!-- As a _[role or persona]_, I want _[goal/ need]_ so that _[why]_ -->
-**Feature:** _[Brief description of feature]_
+<!-- **Feature:** _[Brief description of feature]_ -->
-_[Any additional descriptions on feature]_
+<!-- _[Any additional descriptions on feature]_ -->
-**Scenario:** Please use _[Gherkin](https://cucumber.io/docs/gherkin/reference/)_ here
+<!-- **Scenario:** Please use _[Gherkin](https://cucumber.io/docs/gherkin/reference/)_ here -->
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 223e24ef..f3371183 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,11 +1,20 @@
#### Description
+<!--Brief description of the PR. What does this PR do? -->
#### How should this be tested?
+<!-- What should you do to test this PR? Is there any manual quality
+assurance checks that should be done. What are the expectations -->
#### Any background context you want to provide?
+<!-- Anything the reviewer should be aware of ahead of testing -->
+
#### What are the relevant pivotal tracker stories?
+<!-- Does this PR track anything anywhere? -->
+
#### Screenshots (if appropriate)
#### Questions
+
+<!-- Are there any questions for the reviewer -->
diff --git a/jquery.qtip.css b/jquery.qtip.css
deleted file mode 100644
index c2dcb306..00000000
--- a/jquery.qtip.css
+++ /dev/null
@@ -1,623 +0,0 @@
-/*
- * qTip2 - Pretty powerful tooltips - v2.2.0
- * http://qtip2.com
- *
- * Copyright (c) 2013 Craig Michael Thompson
- * Released under the MIT, GPL licenses
- * http://jquery.org/license
- *
- * Date: Thu Nov 21 2013 08:34 GMT+0000
- * Plugins: tips modal viewport svg imagemap ie6
- * Styles: basic css3
- */
-.qtip{
- position: absolute;
- left: -28000px;
- top: -28000px;
- display: none;
-
- max-width: 280px;
- min-width: 50px;
-
- font-size: 10.5px;
- line-height: 12px;
-
- direction: ltr;
-
- box-shadow: none;
- padding: 0;
-}
-
- .qtip-content{
- position: relative;
- padding: 5px 9px;
- overflow: hidden;
-
- text-align: left;
- word-wrap: break-word;
- }
-
- .qtip-titlebar{
- position: relative;
- padding: 5px 35px 5px 10px;
- overflow: hidden;
-
- border-width: 0 0 1px;
- font-weight: bold;
- }
-
- .qtip-titlebar + .qtip-content{ border-top-width: 0 !important; }
-
- /* Default close button class */
- .qtip-close{
- position: absolute;
- right: -9px; top: -9px;
-
- cursor: pointer;
- outline: medium none;
-
- border-width: 1px;
- border-style: solid;
- border-color: transparent;
- }
-
- .qtip-titlebar .qtip-close{
- right: 4px; top: 50%;
- margin-top: -9px;
- }
-
- * html .qtip-titlebar .qtip-close{ top: 16px; } /* IE fix */
-
- .qtip-titlebar .ui-icon,
- .qtip-icon .ui-icon{
- display: block;
- text-indent: -1000em;
- direction: ltr;
- }
-
- .qtip-icon, .qtip-icon .ui-icon{
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
- border-radius: 3px;
- text-decoration: none;
- }
-
- .qtip-icon .ui-icon{
- width: 18px;
- height: 14px;
-
- line-height: 14px;
- text-align: center;
- text-indent: 0;
- font: normal bold 10px/13px Tahoma,sans-serif;
-
- color: inherit;
- background: transparent none no-repeat -100em -100em;
- }
-
-/* Applied to 'focused' tooltips e.g. most recently displayed/interacted with */
-.qtip-focus{}
-
-/* Applied on hover of tooltips i.e. added/removed on mouseenter/mouseleave respectively */
-.qtip-hover{}
-
-/* Default tooltip style */
-.qtip-default{
- border-width: 1px;
- border-style: solid;
- border-color: #F1D031;
-
- background-color: #FFFFA3;
- color: #555;
-}
-
- .qtip-default .qtip-titlebar{
- background-color: #FFEF93;
- }
-
- .qtip-default .qtip-icon{
- border-color: #CCC;
- background: #F1F1F1;
- color: #777;
- }
-
- .qtip-default .qtip-titlebar .qtip-close{
- border-color: #AAA;
- color: #111;
- }
-
-
-
-/*! Light tooltip style */
-.qtip-light{
- background-color: white;
- border-color: #E2E2E2;
- color: #454545;
-}
-
- .qtip-light .qtip-titlebar{
- background-color: #f1f1f1;
- }
-
-
-/*! Dark tooltip style */
-.qtip-dark{
- background-color: #505050;
- border-color: #303030;
- color: #f3f3f3;
-}
-
- .qtip-dark .qtip-titlebar{
- background-color: #404040;
- }
-
- .qtip-dark .qtip-icon{
- border-color: #444;
- }
-
- .qtip-dark .qtip-titlebar .ui-state-hover{
- border-color: #303030;
- }
-
-
-/*! Cream tooltip style */
-.qtip-cream{
- background-color: #FBF7AA;
- border-color: #F9E98E;
- color: #A27D35;
-}
-
- .qtip-cream .qtip-titlebar{
- background-color: #F0DE7D;
- }
-
- .qtip-cream .qtip-close .qtip-icon{
- background-position: -82px 0;
- }
-
-
-/*! Red tooltip style */
-.qtip-red{
- background-color: #F78B83;
- border-color: #D95252;
- color: #912323;
-}
-
- .qtip-red .qtip-titlebar{
- background-color: #F06D65;
- }
-
- .qtip-red .qtip-close .qtip-icon{
- background-position: -102px 0;
- }
-
- .qtip-red .qtip-icon{
- border-color: #D95252;
- }
-
- .qtip-red .qtip-titlebar .ui-state-hover{
- border-color: #D95252;
- }
-
-
-/*! Green tooltip style */
-.qtip-green{
- background-color: #CAED9E;
- border-color: #90D93F;
- color: #3F6219;
-}
-
- .qtip-green .qtip-titlebar{
- background-color: #B0DE78;
- }
-
- .qtip-green .qtip-close .qtip-icon{
- background-position: -42px 0;
- }
-
-
-/*! Blue tooltip style */
-.qtip-blue{
- background-color: #E5F6FE;
- border-color: #ADD9ED;
- color: #5E99BD;
-}
-
- .qtip-blue .qtip-titlebar{
- background-color: #D0E9F5;
- }
-
- .qtip-blue .qtip-close .qtip-icon{
- background-position: -2px 0;
- }
-
-
-
-.qtip-shadow{
- -webkit-box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15);
- -moz-box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15);
- box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15);
-}
-
-/* Add rounded corners to your tooltips in: FF3+, Chrome 2+, Opera 10.6+, IE9+, Safari 2+ */
-.qtip-rounded,
-.qtip-tipsy,
-.qtip-bootstrap{
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border-radius: 5px;
-}
-
-.qtip-rounded .qtip-titlebar{
- -moz-border-radius: 4px 4px 0 0;
- -webkit-border-radius: 4px 4px 0 0;
- border-radius: 4px 4px 0 0;
-}
-
-/* Youtube tooltip style */
-.qtip-youtube{
- -moz-border-radius: 2px;
- -webkit-border-radius: 2px;
- border-radius: 2px;
-
- -webkit-box-shadow: 0 0 3px #333;
- -moz-box-shadow: 0 0 3px #333;
- box-shadow: 0 0 3px #333;
-
- color: white;
- border-width: 0;
-
- background: #4A4A4A;
- background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0,#4A4A4A),color-stop(100%,black));
- background-image: -webkit-linear-gradient(top,#4A4A4A 0,black 100%);
- background-image: -moz-linear-gradient(top,#4A4A4A 0,black 100%);
- background-image: -ms-linear-gradient(top,#4A4A4A 0,black 100%);
- background-image: -o-linear-gradient(top,#4A4A4A 0,black 100%);
-}
-
- .qtip-youtube .qtip-titlebar{
- background-color: #4A4A4A;
- background-color: rgba(0,0,0,0);
- }
-
- .qtip-youtube .qtip-content{
- padding: .75em;
- font: 12px arial,sans-serif;
-
- filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#4a4a4a,EndColorStr=#000000);
- -ms-filter: "progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#4a4a4a,EndColorStr=#000000);";
- }
-
- .qtip-youtube .qtip-icon{
- border-color: #222;
- }
-
- .qtip-youtube .qtip-titlebar .ui-state-hover{
- border-color: #303030;
- }
-
-
-/* jQuery TOOLS Tooltip style */
-.qtip-jtools{
- background: #232323;
- background: rgba(0, 0, 0, 0.7);
- background-image: -webkit-gradient(linear, left top, left bottom, from(#717171), to(#232323));
- background-image: -moz-linear-gradient(top, #717171, #232323);
- background-image: -webkit-linear-gradient(top, #717171, #232323);
- background-image: -ms-linear-gradient(top, #717171, #232323);
- background-image: -o-linear-gradient(top, #717171, #232323);
-
- border: 2px solid #ddd;
- border: 2px solid rgba(241,241,241,1);
-
- -moz-border-radius: 2px;
- -webkit-border-radius: 2px;
- border-radius: 2px;
-
- -webkit-box-shadow: 0 0 12px #333;
- -moz-box-shadow: 0 0 12px #333;
- box-shadow: 0 0 12px #333;
-}
-
- /* IE Specific */
- .qtip-jtools .qtip-titlebar{
- background-color: transparent;
- filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A);
- -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A)";
- }
- .qtip-jtools .qtip-content{
- filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323);
- -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323)";
- }
-
- .qtip-jtools .qtip-titlebar,
- .qtip-jtools .qtip-content{
- background: transparent;
- color: white;
- border: 0 dashed transparent;
- }
-
- .qtip-jtools .qtip-icon{
- border-color: #555;
- }
-
- .qtip-jtools .qtip-titlebar .ui-state-hover{
- border-color: #333;
- }
-
-
-/* Cluetip style */
-.qtip-cluetip{
- -webkit-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4);
- -moz-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4);
- box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4);
-
- background-color: #D9D9C2;
- color: #111;
- border: 0 dashed transparent;
-}
-
- .qtip-cluetip .qtip-titlebar{
- background-color: #87876A;
- color: white;
- border: 0 dashed transparent;
- }
-
- .qtip-cluetip .qtip-icon{
- border-color: #808064;
- }
-
- .qtip-cluetip .qtip-titlebar .ui-state-hover{
- border-color: #696952;
- color: #696952;
- }
-
-
-/* Tipsy style */
-.qtip-tipsy{
- background: black;
- background: rgba(0, 0, 0, .87);
-
- color: white;
- border: 0 solid transparent;
-
- font-size: 11px;
- font-family: 'Lucida Grande', sans-serif;
- font-weight: bold;
- line-height: 16px;
- text-shadow: 0 1px black;
-}
-
- .qtip-tipsy .qtip-titlebar{
- padding: 6px 35px 0 10px;
- background-color: transparent;
- }
-
- .qtip-tipsy .qtip-content{
- padding: 6px 10px;
- }
-
- .qtip-tipsy .qtip-icon{
- border-color: #222;
- text-shadow: none;
- }
-
- .qtip-tipsy .qtip-titlebar .ui-state-hover{
- border-color: #303030;
- }
-
-
-/* Tipped style */
-.qtip-tipped{
- border: 3px solid #959FA9;
-
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
- border-radius: 3px;
-
- background-color: #F9F9F9;
- color: #454545;
-
- font-weight: normal;
- font-family: serif;
-}
-
- .qtip-tipped .qtip-titlebar{
- border-bottom-width: 0;
-
- color: white;
- background: #3A79B8;
- background-image: -webkit-gradient(linear, left top, left bottom, from(#3A79B8), to(#2E629D));
- background-image: -webkit-linear-gradient(top, #3A79B8, #2E629D);
- background-image: -moz-linear-gradient(top, #3A79B8, #2E629D);
- background-image: -ms-linear-gradient(top, #3A79B8, #2E629D);
- background-image: -o-linear-gradient(top, #3A79B8, #2E629D);
- filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D);
- -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D)";
- }
-
- .qtip-tipped .qtip-icon{
- border: 2px solid #285589;
- background: #285589;
- }
-
- .qtip-tipped .qtip-icon .ui-icon{
- background-color: #FBFBFB;
- color: #555;
- }
-
-
-/**
- * Twitter Bootstrap style.
- *
- * Tested with IE 8, IE 9, Chrome 18, Firefox 9, Opera 11.
- * Does not work with IE 7.
- */
-.qtip-bootstrap{
- /** Taken from Bootstrap body */
- font-size: 14px;
- line-height: 20px;
- color: #333333;
-
- /** Taken from Bootstrap .popover */
- padding: 1px;
- background-color: #ffffff;
- border: 1px solid #ccc;
- border: 1px solid rgba(0, 0, 0, 0.2);
- -webkit-border-radius: 6px;
- -moz-border-radius: 6px;
- border-radius: 6px;
- -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
- -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
- box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
- -webkit-background-clip: padding-box;
- -moz-background-clip: padding;
- background-clip: padding-box;
-}
-
- .qtip-bootstrap .qtip-titlebar{
- /** Taken from Bootstrap .popover-title */
- padding: 8px 14px;
- margin: 0;
- font-size: 14px;
- font-weight: normal;
- line-height: 18px;
- background-color: #f7f7f7;
- border-bottom: 1px solid #ebebeb;
- -webkit-border-radius: 5px 5px 0 0;
- -moz-border-radius: 5px 5px 0 0;
- border-radius: 5px 5px 0 0;
- }
-
- .qtip-bootstrap .qtip-titlebar .qtip-close{
- /**
- * Overrides qTip2:
- * .qtip-titlebar .qtip-close{
- * [...]
- * right: 4px;
- * top: 50%;
- * [...]
- * border-style: solid;
- * }
- */
- right: 11px;
- top: 45%;
- border-style: none;
- }
-
- .qtip-bootstrap .qtip-content{
- /** Taken from Bootstrap .popover-content */
- padding: 9px 14px;
- }
-
- .qtip-bootstrap .qtip-icon{
- /**
- * Overrides qTip2:
- * .qtip-default .qtip-icon {
- * border-color: #CCC;
- * background: #F1F1F1;
- * color: #777;
- * }
- */
- background: transparent;
- }
-
- .qtip-bootstrap .qtip-icon .ui-icon{
- /**
- * Overrides qTip2:
- * .qtip-icon .ui-icon{
- * width: 18px;
- * height: 14px;
- * }
- */
- width: auto;
- height: auto;
-
- /* Taken from Bootstrap .close */
- float: right;
- font-size: 20px;
- font-weight: bold;
- line-height: 18px;
- color: #000000;
- text-shadow: 0 1px 0 #ffffff;
- opacity: 0.2;
- filter: alpha(opacity=20);
- }
-
- .qtip-bootstrap .qtip-icon .ui-icon:hover{
- /* Taken from Bootstrap .close:hover */
- color: #000000;
- text-decoration: none;
- cursor: pointer;
- opacity: 0.4;
- filter: alpha(opacity=40);
- }
-
-
-/* IE9 fix - removes all filters */
-.qtip:not(.ie9haxors) div.qtip-content,
-.qtip:not(.ie9haxors) div.qtip-titlebar{
- filter: none;
- -ms-filter: none;
-}
-
-
-
-.qtip .qtip-tip{
- margin: 0 auto;
- overflow: hidden;
- z-index: 10;
-
-}
-
- /* Opera bug #357 - Incorrect tip position
- https://github.com/Craga89/qTip2/issues/367 */
- x:-o-prefocus, .qtip .qtip-tip{
- visibility: hidden;
- }
-
- .qtip .qtip-tip,
- .qtip .qtip-tip .qtip-vml,
- .qtip .qtip-tip canvas{
- position: absolute;
-
- color: #123456;
- background: transparent;
- border: 0 dashed transparent;
- }
-
- .qtip .qtip-tip canvas{ top: 0; left: 0; }
-
- .qtip .qtip-tip .qtip-vml{
- behavior: url(#default#VML);
- display: inline-block;
- visibility: visible;
- }
-
-#qtip-overlay{
- position: fixed;
- left: 0; top: 0;
- width: 100%; height: 100%;
-}
-
- /* Applied to modals with show.modal.blur set to true */
- #qtip-overlay.blurs{ cursor: pointer; }
-
- /* Change opacity of overlay here */
- #qtip-overlay div{
- position: absolute;
- left: 0; top: 0;
- width: 100%; height: 100%;
-
- background-color: black;
-
- opacity: 0.7;
- filter:alpha(opacity=70);
- -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
- }
-
-
-
-.qtipmodal-ie6fix{
- position: absolute !important;
-} \ No newline at end of file
diff --git a/wqflask/tests/wqflask/show_trait/test_export_trait_data.py b/wqflask/tests/wqflask/show_trait/test_export_trait_data.py
index 98d599b1..41761944 100644
--- a/wqflask/tests/wqflask/show_trait/test_export_trait_data.py
+++ b/wqflask/tests/wqflask/show_trait/test_export_trait_data.py
@@ -1,10 +1,128 @@
import unittest
+from unittest import mock
from wqflask.show_trait.export_trait_data import dict_to_sorted_list
from wqflask.show_trait.export_trait_data import cmp_samples
+from wqflask.show_trait.export_trait_data import export_sample_table
+from wqflask.show_trait.export_trait_data import get_export_metadata
+
+
+class AttributesSetter:
+ def __init__(self, obj):
+ for key, value in obj.items():
+ setattr(self, key, value)
class TestExportTraits(unittest.TestCase):
"""Test methods related to converting dict to sortedlist"""
+ @mock.patch("wqflask.show_trait.export_trait_data.create_trait")
+ @mock.patch("wqflask.show_trait.export_trait_data.data_set")
+ def test_get_export_metadata_no_publish(self, mock_dataset, mock_trait):
+ """test for exporting metadata with no publish"""
+ mock_dataset_attributes = AttributesSetter(
+ {"type": "no_publish", "dataset_name": "Temp", "name": "Temp"})
+
+ mock_nested_attributes = AttributesSetter({"name": "name"})
+ mock_dataset_attributes.group = mock_nested_attributes
+ mock_dataset.create_dataset.return_value = mock_dataset_attributes
+ mock_trait.return_value = AttributesSetter({"symbol": "", "description_display": "Description",
+ "title": "research1", "journal": "", "authors": ""})
+
+ results = get_export_metadata("random_id", "Temp")
+ expected = [["Record ID: random_id"],
+ ["Trait URL: http://genenetwork.org/show_trait?trait_id=random_id&dataset=Temp"],
+ ["Dataset: Temp"],
+ ["Group: name"], []]
+
+ mock_dataset.create_dataset.assert_called_with("Temp")
+ mock_trait.assert_called_with(
+ dataset=mock_dataset_attributes, name="random_id", cellid=None, get_qtl_info=False)
+ self.assertEqual(results, expected)
+
+ @mock.patch("wqflask.show_trait.export_trait_data.create_trait")
+ @mock.patch("wqflask.show_trait.export_trait_data.data_set")
+ def test_get_export_metadata_with_publish(self, data_mock, trait_mock):
+ """test for exporting metadata with dataset.type=Publish"""
+ mock_dataset_attributes = AttributesSetter({"type": "Publish", "dataset_name": "Temp",
+ "name": "Temp", "description_display": "Description goes here"})
+
+ mock_nested_attributes = AttributesSetter({"name": "name"})
+ mock_dataset_attributes.group = mock_nested_attributes
+ data_mock.create_dataset.return_value = mock_dataset_attributes
+ trait_instance = AttributesSetter({"symbol": "", "description_display": "Description",
+ "title": "research1", "journal": "", "authors": ""})
+ trait_mock.return_value = trait_instance
+
+ results = get_export_metadata(
+ "29ae0615-0d77-4814-97c7-c9e91f6bfd7b", "Temp")
+
+ expected = [['Phenotype ID: 29ae0615-0d77-4814-97c7-c9e91f6bfd7b'],
+ ['Phenotype URL: http://genenetwork.org/show_trait?trait_id=29ae0615-0d77-4814-97c7-c9e91f6bfd7b&dataset=Temp'], [
+ 'Group: name'], ['Phenotype: Description'],
+ ['Authors: N/A'], ['Title: research1'],
+ ['Journal: N/A'], ['Dataset Link: http://gn1.genenetwork.org/webqtl/main.py?FormID=sharinginfo&InfoPageName=Temp'], []]
+
+ self.assertEqual(results, expected)
+
+ @mock.patch("wqflask.show_trait.export_trait_data.dict_to_sorted_list")
+ @mock.patch("wqflask.show_trait.export_trait_data.get_export_metadata")
+ def test_export_sample_table(self, exp_metadata, dict_list):
+ """test for exporting sample table"""
+ targs_obj = {
+ "export_data": """{
+ "primary_samples": [
+ {
+ "other": "germanotta",
+ "name": "Sauroniops",
+ "se":{
+ "name":"S2"
+ },
+ "num_cases":{
+ "k1":"value"
+
+ }
+ }
+ ],
+ "other_samples": [
+ {
+ "se": 1,
+ "num_cases": 4,
+ "value": 6,
+ "name": 3
+ }
+ ]
+ }""",
+ "trait_display_name": "Hair_color",
+ "trait_id": "23177fdc-312e-4084-ad0c-f3eae785fff5",
+ "dataset": {
+ }
+ }
+ exp_metadata.return_value = [
+ ["Phenotype ID:0a2be192-57f5-400b-bbbd-0cf50135995f"], ['Group:gp1'],
+ ["Phenotype:p1"], [
+ "Authors:N/A"],
+ ["Title:research1"],
+ ["Journal:N/A"],
+ ["Dataset Link: http://gn1.genenetwork.org/webqtl/main.py?FormID=sharinginfo&InfoPageName=name1"], []]
+ expected = ('Hair_color',
+ [['Phenotype ID:0a2be192-57f5-400b-bbbd-0cf50135995f'],
+ ['Group:gp1'],
+ ['Phenotype:p1'],
+ ['Authors:N/A'],
+ ['Title:research1'],
+ ['Journal:N/A'],
+ ['Dataset Link: '
+ 'http://gn1.genenetwork.org/webqtl/main.py?FormID=sharinginfo&InfoPageName=name1'],
+ [],
+ ['Name', 'Value', 'SE', 'N'],
+ ['Sauroniops', 'germanotta'],
+ [3, 6, 1, 4]])
+
+ dict_list.side_effect = [['Sauroniops', 'germanotta'], [3, 6, 1, 4]]
+
+ self.assertEqual(export_sample_table(targs_obj), expected)
+ exp_metadata.assert_called_with(
+ "23177fdc-312e-4084-ad0c-f3eae785fff5", {})
+ self.assertEqual(dict_list.call_count, 2)
def test_dict_to_sortedlist(self):
"""test for conversion of dict to sorted list"""
diff --git a/wqflask/utility/redis_tools.py b/wqflask/utility/redis_tools.py
index d855a7fa..236cc755 100644
--- a/wqflask/utility/redis_tools.py
+++ b/wqflask/utility/redis_tools.py
@@ -25,6 +25,10 @@ def is_redis_available():
return True
+def load_json_from_redis(item_list, column_value):
+ return json.loads(item_list[str.encode(column_value)])
+
+
def get_user_id(column_name, column_value):
user_list = Redis.hgetall("users")
key_list = []
@@ -46,7 +50,7 @@ def get_user_by_unique_column(column_name, column_value):
if column_name in user_ob and user_ob[column_name] == column_value:
item_details = user_ob
else:
- item_details = json.loads(user_list[column_value])
+ item_details = load_json_from_redis(user_list, column_value)
return item_details
@@ -70,7 +74,7 @@ def get_users_like_unique_column(column_name, column_value):
if column_value in user_ob[column_name]:
matched_users.append(user_ob)
else:
- matched_users.append(json.loads(user_list[column_value]))
+ matched_users.append(load_json_from_redis(user_list, column_value))
return matched_users
@@ -199,7 +203,7 @@ def get_groups_like_unique_column(column_name, column_value):
if column_value in group_info[column_name]:
matched_groups.append(group_info)
else:
- matched_groups.append(json.loads(group_list[column_value]))
+ matched_groups.append(load_json_from_redis(group_list, column_value))
return matched_groups
diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py
index e710bacd..4c2b64ba 100644
--- a/wqflask/wqflask/correlation/show_corr_results.py
+++ b/wqflask/wqflask/correlation/show_corr_results.py
@@ -184,6 +184,8 @@ class CorrelationResults(object):
for _trait_counter, trait in enumerate(list(self.correlation_data.keys())[:self.return_number]):
trait_object = create_trait(dataset=self.target_dataset, name=trait, get_qtl_info=True, get_sample_info=False)
+ if not trait_object:
+ continue
if self.target_dataset.type == "ProbeSet" or self.target_dataset.type == "Geno":
#ZS: Convert trait chromosome to an int for the location range option
@@ -434,15 +436,15 @@ class CorrelationResults(object):
self.this_trait_vals, target_vals, num_overlap = corr_result_helpers.normalize_values(self.this_trait_vals, target_vals)
- #ZS: 2015 could add biweight correlation, see http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3465711/
- if self.corr_method == 'bicor':
- sample_r, sample_p = do_bicor(self.this_trait_vals, target_vals)
- elif self.corr_method == 'pearson':
- sample_r, sample_p = scipy.stats.pearsonr(self.this_trait_vals, target_vals)
- else:
- sample_r, sample_p = scipy.stats.spearmanr(self.this_trait_vals, target_vals)
-
if num_overlap > 5:
+ #ZS: 2015 could add biweight correlation, see http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3465711/
+ if self.corr_method == 'bicor':
+ sample_r, sample_p = do_bicor(self.this_trait_vals, target_vals)
+ elif self.corr_method == 'pearson':
+ sample_r, sample_p = scipy.stats.pearsonr(self.this_trait_vals, target_vals)
+ else:
+ sample_r, sample_p = scipy.stats.spearmanr(self.this_trait_vals, target_vals)
+
if numpy.isnan(sample_r):
pass
else:
@@ -635,3 +637,4 @@ def get_header_fields(data_type, corr_method):
'Sample p(r)']
return header_fields
+
diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py
index b5686b70..6d6572ff 100644
--- a/wqflask/wqflask/marker_regression/display_mapping_results.py
+++ b/wqflask/wqflask/marker_regression/display_mapping_results.py
@@ -2146,9 +2146,6 @@ class DisplayMappingResults(object):
LRSScale = 1.0
LRSAxisList = Plot.frange(LRSScale, LRS_LOD_Max, LRSScale)
- #make sure the user's value appears on the y-axis
- #update by NL 6-21-2011: round the LOD value to 100 when LRS_LOD_Max is equal to 460
- LRSAxisList.append(ceil(LRS_LOD_Max))
#ZS: Convert to int if all axis values are whole numbers
all_int = True
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index edf9638c..25ba1a1d 100644
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -228,8 +228,8 @@ class ShowTrait(object):
hddn = OrderedDict()
if self.dataset.group.allsamples:
- hddn['allsamples'] = ''.join(self.dataset.group.allsamples)
- hddn['primary_samples'] = ''.join(self.primary_sample_names)
+ hddn['allsamples'] = ','.join(self.dataset.group.allsamples)
+ hddn['primary_samples'] = ','.join(self.primary_sample_names)
hddn['trait_id'] = self.trait_id
hddn['trait_display_name'] = self.this_trait.display_name
hddn['dataset'] = self.dataset.name