aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2016-11-11 16:36:20 +0000
committerzsloan2016-11-11 16:36:20 +0000
commit21f8d536207c851545b7b3eb31df685bc636b20a (patch)
tree49a579984ff8b9da19c5dbdea79b78d2ed8f598c
parent7b83c8c46977942acb271e7f1cf187d00bc7ff5a (diff)
downloadgenenetwork2-21f8d536207c851545b7b3eb31df685bc636b20a.tar.gz
Fixed error causing correlation matrix page to not work with 2 traits (related to factor loadings table)
Also improved factor loads table to show only two factors when there are two traits Fixed error related to get_traits_from_collections.js being called in collections/list before jquery is defined
-rw-r--r--wqflask/wqflask/correlation_matrix/show_corr_matrix.py6
-rw-r--r--wqflask/wqflask/static/new/javascript/get_traits_from_collection.js12
-rw-r--r--wqflask/wqflask/templates/collections/list.html7
-rw-r--r--wqflask/wqflask/templates/correlation_matrix.html2
4 files changed, 14 insertions, 13 deletions
diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
index 70e21917..630980c7 100644
--- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
+++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
@@ -207,7 +207,11 @@ class CorrelationMatrix(object):
print("before loop:", self.loadings[0])
for i in range(len(self.trait_list)):
loadings_row = []
- for j in range(3):
+ if len(self.trait_list) > 2:
+ the_range = 3
+ else:
+ the_range = 2
+ for j in range(the_range):
position = i + len(self.trait_list)*j
loadings_row.append(self.loadings[0][position])
loadings_array.append(loadings_row)
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 a73eafe4..bcd83889 100644
--- a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js
+++ b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js
@@ -226,10 +226,8 @@ back_to_collections = function() {
return $('#collections_holder').colorbox.resize();
};
-$(function() {
- console.log("inside get_traits_from_collection");
- $(document).on("click", ".collection_line", collection_click);
- $(document).on("click", "#submit", submit_click);
- $(document).on("click", ".trait", trait_click);
- return $(document).on("click", "#back_to_collections", back_to_collections);
-});
+console.log("inside get_traits_from_collection");
+$(".collection_line").on("click", collection_click);
+$("#submit").on("click", submit_click);
+$(".trait").on("click", trait_click);
+$("#back_to_collections").on("click", back_to_collections); \ No newline at end of file
diff --git a/wqflask/wqflask/templates/collections/list.html b/wqflask/wqflask/templates/collections/list.html
index 23e976e9..e38b32a0 100644
--- a/wqflask/wqflask/templates/collections/list.html
+++ b/wqflask/wqflask/templates/collections/list.html
@@ -54,10 +54,6 @@
{% endfor %}
</tbody>
</table>
-
- {# if "color_by_trait" in params #}
- <script type="text/javascript" src="/static/new/javascript/get_traits_from_collection.js"></script>
- {# endif #}
</div>
</div>
@@ -78,6 +74,9 @@
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colReorder.js"></script>
<script language="javascript" type="text/javascript" src="/static/packages/DT_bootstrap/DT_bootstrap.js"></script>
<script language="javascript" type="text/javascript" src="/static/packages/TableTools/media/js/TableTools.min.js"></script>
+ {% if "color_by_trait" in params %}
+ <script type="text/javascript" src="/static/new/javascript/get_traits_from_collection.js"></script>
+ {% endif %}
<script>
$('#trait_table').dataTable( {
"buttons": [
diff --git a/wqflask/wqflask/templates/correlation_matrix.html b/wqflask/wqflask/templates/correlation_matrix.html
index cd2aa35e..65dd01e7 100644
--- a/wqflask/wqflask/templates/correlation_matrix.html
+++ b/wqflask/wqflask/templates/correlation_matrix.html
@@ -71,7 +71,7 @@
<th></th>
<th align="right" >Factor 1</th>
<th align="right" >Factor 2</th>
- <th align="right" >Factor 2</th>
+ {% if trait_list|length > 2 %}<th align="right" >Factor 3</th>{% endif %}
<!--
{% for row in loadings_array %}
<th>Factor {{ loop.index }}</th>