diff options
author | zsloan | 2020-12-18 14:36:53 -0600 |
---|---|---|
committer | zsloan | 2020-12-18 14:36:53 -0600 |
commit | 7544d03a6d819d70779deb79d38b7465a648c1ff (patch) | |
tree | 5311d4d6df85333498a4614e79c51b87e715c462 /wqflask | |
parent | 95d1887bba6b93ea310c226cb82e9cb64f75cc67 (diff) | |
download | genenetwork2-7544d03a6d819d70779deb79d38b7465a648c1ff.tar.gz |
Changed run_mapping.py to get sample names and values from JSON instead of a bunch of separate input parameters
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/marker_regression/run_mapping.py | 64 |
1 files changed, 15 insertions, 49 deletions
diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index 891fcc66..a1f87b61 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -71,56 +71,22 @@ class RunMapping(object): all_samples_ordered = self.dataset.group.all_samples_ordered() self.vals = [] - if 'samples' in start_vars: - self.samples = start_vars['samples'].split(",") - if (len(genofile_samplelist) != 0): - for sample in genofile_samplelist: - if sample in self.samples: - value = start_vars.get('value:' + sample) - if value: - self.vals.append(value) - else: - self.vals.append("x") - else: - for sample in self.samples: - value = start_vars.get('value:' + sample) - if value: - self.vals.append(value) + self.samples = [] + self.sample_vals = start_vars['sample_vals'] + sample_val_dict = json.loads(self.sample_vals) + samples = sample_val_dict.keys() + if (len(genofile_samplelist) != 0): + for sample in genofile_samplelist: + self.samples.append(sample) + if sample in samples: + self.vals.append(sample_val_dict[sample]) + else: + self.vals.append("x") else: - self.samples = [] - if (len(genofile_samplelist) != 0): - for sample in genofile_samplelist: - if sample in self.dataset.group.samplelist: - in_trait_data = False - for item in self.this_trait.data: - if self.this_trait.data[item].name == sample: - value = start_vars['value:' + self.this_trait.data[item].name] - self.samples.append(self.this_trait.data[item].name) - self.vals.append(value) - in_trait_data = True - break - if not in_trait_data: - value = start_vars.get('value:' + sample) - if value: - self.samples.append(sample) - self.vals.append(value) - else: - self.vals.append("x") - else: - for sample in self.dataset.group.samplelist: # sample is actually the name of an individual - in_trait_data = False - for item in self.this_trait.data: - if self.this_trait.data[item].name == sample: - value = start_vars['value:' + self.this_trait.data[item].name] - self.samples.append(self.this_trait.data[item].name) - self.vals.append(value) - in_trait_data = True - break - if not in_trait_data: - value = start_vars.get('value:' + sample) - if value: - self.samples.append(sample) - self.vals.append(value) + for sample in self.dataset.group.samplelist: + if sample in samples: + self.vals.append(sample_val_dict[sample]) + self.samples.append(sample) if 'n_samples' in start_vars: self.n_samples = start_vars['n_samples'] |