Skip to content

Commit

Permalink
Merge pull request #4 from eQTL-Catalogue/dev
Browse files Browse the repository at this point in the history
sqlite client patch to accomodate schema change
  • Loading branch information
jdhayhurst authored Apr 30, 2020
2 parents 091348d + 4489f4f commit 32c3f64
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions sumstats/utils/sqlite_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,24 @@ def get_study_context_meta(self, identifier):
# """, (identifier,))

data = self.cur.fetchone()
if data:
if len(data) == 10:
data_dict["study"], data_dict["identifier"], data_dict["qtl_group"], data_dict["tissue_label"], data_dict["phen"], data_dict["tissue_ont"], data_dict["condition"], _ , data_dict["quant_method"], data_dict["condition_label"] = data
return data_dict
return data_dict
# avoid break during schema change
else:
self.cur.execute("""
SELECT s.study, s.identifier, q.qtl_group, q.cell_type, s.trait_file, q.ontology_term, q.condition, q.condition_label
FROM qtl_context_mapping AS q
JOIN study_info AS s
ON q.study = s.study AND q.qtl_group = s.qtl_group
WHERE s.identifier =?
""", (identifier,))

data = self.cur.fetchone()
if data:
data_dict["study"], data_dict["identifier"], data_dict["qtl_group"], data_dict["tissue_label"], data_dict["phen"], data_dict["tissue_ont"], data_dict["condition"], data_dict["condition_label"] = data
return data_dict


def get_traits(self):
data = []
Expand Down

0 comments on commit 32c3f64

Please sign in to comment.