From 6c07839e3a99b788f3af7cad3b6582d9246b7d33 Mon Sep 17 00:00:00 2001 From: Michael Harper Date: Wed, 17 Jan 2024 15:33:42 +1100 Subject: [PATCH] was iterating over "test" project to fetch data instead of "main" project --- ...add_nagim_gvcfs_to_tob_wgs_test_metamist.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/add_nagim_gvcfs_to_tob_wgs_test_metamist.py b/scripts/add_nagim_gvcfs_to_tob_wgs_test_metamist.py index 0e167697c..a7ce5ef60 100644 --- a/scripts/add_nagim_gvcfs_to_tob_wgs_test_metamist.py +++ b/scripts/add_nagim_gvcfs_to_tob_wgs_test_metamist.py @@ -73,6 +73,16 @@ class RowData: sg2,ext2,gvcf2,gvcf_idx2 ''', ) +@click.option( + '--project-id-to-add-to', + required=True, + type=int, + help='''The ID of the project to add samples to. + For example: iterate over `main` project (identified by the --project flag) to get data for each sample, then create a new participant + with the same data, but with a new external ID that has the suffix (--suffix) specified by the user. + Then upsert these into the `test` project. + ''', +) @click.option( '--suffix', required=True, @@ -81,7 +91,12 @@ class RowData: will be `ext_id1-test`, `ext_id2-test`, etc. ''', ) -def main(project: str, sample_path_mappings: str, suffix: str): +def main(project: str, project_id: int, sample_path_mappings: str, suffix: str): + ''' + Iterate over `main` project to get data for each sample, then create a new participant + with the same data, but with a new external ID that has the suffix specified by the user. + Then upsert these into the `test` project. + ''' # Read the CSV file into a dictionary ext_id_to_row = {} with to_path(sample_path_mappings).open() as f: @@ -92,7 +107,6 @@ def main(project: str, sample_path_mappings: str, suffix: str): ext_id_to_row[data.ext_id] = data query_response = query(PARTICIPANT_QUERY, {"project": project}) - project_id = query_response['project']['id'] p_upserts = [] for participant in query_response['project']['participants']: if participant['externalId'] not in ext_id_to_row: