Skip to content

Commit

Permalink
was iterating over "test" project to fetch data instead of "main" pro…
Browse files Browse the repository at this point in the history
…ject
  • Loading branch information
michael-harper committed Jan 17, 2024
1 parent 5239ebd commit 6c07839
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions scripts/add_nagim_gvcfs_to_tob_wgs_test_metamist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 6c07839

Please sign in to comment.