aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorBonfaceKilz2022-03-02 15:54:19 +0300
committerBonfaceKilz2022-03-12 15:33:01 +0300
commitd1adfc7f679c0ab09b41d6de67918aba82035253 (patch)
tree0a72fa3d36a505fb45358c3e2aceae04e6abaa93 /wqflask
parenta94cf0a3e20aab26df7a2c4049bd9b7fe9bb38a7 (diff)
downloadgenenetwork2-d1adfc7f679c0ab09b41d6de67918aba82035253.tar.gz
Use updated `insert_sample_data` from gn3
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/metadata_edits.py21
1 files changed, 8 insertions, 13 deletions
diff --git a/wqflask/wqflask/metadata_edits.py b/wqflask/wqflask/metadata_edits.py
index d6ba2fff..24cbd3d1 100644
--- a/wqflask/wqflask/metadata_edits.py
+++ b/wqflask/wqflask/metadata_edits.py
@@ -558,19 +558,14 @@ def approve_data(resource_id:str, file_name: str):
sample_data.get("Deletions").remove(deletion)
n_insertions = 0
- for insertion in (
- insertions := [d for d in sample_data.get("Additions")]):
- (strain_name,
- value, se, count) = insertion.split(",")
- __insertions, _, _ = insert_sample_data(
- conn=conn,
- trait_name=sample_data.get("trait_name"),
- strain_name=strain_name,
- phenotype_id=int(sample_data.get("phenotype_id")),
- value=value,
- error=se,
- count=count)
- if __insertions:
+ for data in [d for d in sample_data.get("Additions")]:
+ if insert_sample_data(
+ conn=conn,
+ trait_name=sample_data.get("trait_name"),
+ data=data,
+ csv_header=sample_data.get("Columns",
+ "Strain Name,Value,SE,Count"),
+ phenotype_id=int(sample_data.get("phenotype_id"))):
n_insertions += 1
# Remove any data that already exists from sample_data inserts
else: