aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2020-01-29 10:45:09 -0600
committerzsloan2020-01-29 10:45:09 -0600
commit0fea87aafe20504437e8d92b19e319459ea3e351 (patch)
tree026cce2247408b7592f26820ddf0533f612a2484
parent7e194198234e0110a0f86e101261f7e2507f9f78 (diff)
downloadgenenetwork2-0fea87aafe20504437e8d92b19e319459ea3e351.tar.gz
Fixed issue that caused correlation matrix to not run when shared samples were less than number of traits
-rw-r--r--wqflask/wqflask/correlation_matrix/show_corr_matrix.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
index 09213d1f..9c31bcfe 100644
--- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
+++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
@@ -76,6 +76,7 @@ class CorrelationMatrix(object):
self.all_sample_list = []
self.traits = []
self.insufficient_shared_samples = False
+ 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:
@@ -108,7 +109,7 @@ class CorrelationMatrix(object):
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
- return False
+ 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)
@@ -187,10 +188,13 @@ class CorrelationMatrix(object):
groups.append(1)
try:
- self.pca_works = "True"
- self.pca_trait_ids = []
- pca = self.calculate_pca(range(len(self.traits)), corr_eigen_value, corr_eigen_vectors)
- self.loadings_array = self.process_loadings()
+ if self.do_PCA == True:
+ self.pca_works = "True"
+ self.pca_trait_ids = []
+ pca = self.calculate_pca(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"