diff options
-rwxr-xr-x | wqflask/wqflask/correlation_matrix/show_corr_matrix.py | 21 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/correlation_matrix.html | 1 |
2 files changed, 11 insertions, 11 deletions
diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py index b670f521..2cdd989f 100755 --- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py +++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py @@ -138,17 +138,18 @@ class CorrelationMatrix(object): this_trait_vals.append(sample_value) target_vals.append(target_sample_value) - this_trait_vals, target_vals, num_overlap = corr_result_helpers.normalize_values( - this_trait_vals, target_vals) - - if is_spearman == False: - sample_r, sample_p = scipy.stats.pearsonr(this_trait_vals, target_vals) - if sample_r == 1: - is_spearman = True + this_trait_vals, target_vals, num_overlap = corr_result_helpers.normalize_values(this_trait_vals, target_vals) + if num_overlap == 0: + corr_result_row.append([target_trait, 0, num_overlap]) else: - sample_r, sample_p = scipy.stats.spearmanr(this_trait_vals, target_vals) - - corr_result_row.append([target_trait, sample_r, num_overlap]) + if is_spearman == False: + sample_r, sample_p = scipy.stats.pearsonr(this_trait_vals, target_vals) + 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]) self.corr_results.append(corr_result_row) diff --git a/wqflask/wqflask/templates/correlation_matrix.html b/wqflask/wqflask/templates/correlation_matrix.html index 768367c3..c822b8bc 100755 --- a/wqflask/wqflask/templates/correlation_matrix.html +++ b/wqflask/wqflask/templates/correlation_matrix.html @@ -34,7 +34,6 @@ {% if result[0].name == trait.name %} <td nowrap="ON" align="center" bgcolor="#cccccc"><a href="/show_trait?trait_id={{ trait.name }}&dataset={{ trait.dataset.name }}"><font style="font-size: 11px; color: #000000;" ><em>n</em><br>{{ result[2] }}</font></a></td> {% else %} - <!--<td nowrap="ON" align="middle" class="corr_cell"><a href="/corr_scatter_plot?dataset_1={{ trait.dataset.name }}&dataset_2={{ result[0].dataset.name }}&trait_1={{ trait.name }}&trait_2={{ result[0].name }}"><font style="font-size: 11px;{% if result[1] > 0.7 %} color: red; {% elif result[1] > 0.5 %} color: #FF6600; {% elif result[1] < -0.7 %} color: blue; {% elif result[1] < -0.5 %} color: #009900; {% else %} color: #000000; {% endif %}" ><span class="corr_value">{{ '%0.3f' % result[1] }}</span><br>{{ result[2] }}</font></a></td>--> <td nowrap="ON" align="middle" class="corr_cell"><a href="/corr_scatter_plot?dataset_1={{ trait.dataset.name }}&dataset_2={{ result[0].dataset.name }}&trait_1={{ trait.name }}&trait_2={{ result[0].name }}"><font style="font-size: 11px; color: #000000;" ><span class="corr_value">{{ '%0.3f' % result[1] }}</span><br>{{ result[2] }}</font></a></td> {% endif %} {% endfor %} |