Skip to content

Commit

Permalink
Update external_ids in fix_pbmc_sample_participant.py script
Browse files Browse the repository at this point in the history
Expand sample_map_by_external_id to hold all the external_ids for all
the samples. For samples with an external_id containing '-PBMC', use
next(...) to pick the first such external_id -- generally there'll
surely only be one anyway.
  • Loading branch information
jmarshall committed Jun 19, 2024
1 parent 6a0c58a commit cd04654
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/fix_pbmc_sample_participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ def main():
)
)

sample_map_by_external_id = {s['external_id']: s for s in all_samples}
sample_map_by_external_id = {eid: s for s in all_samples for eid in s['external_ids'].values()}

pbmc_samples = [s for s in all_samples if '-PBMC' in s['external_id']]
pbmc_samples = [s for s in all_samples if any('-PBMC' in eid for eid in s['external_ids'].values())]

for sample in pbmc_samples:
external_id = sample['external_id']
external_id = next(eid for eid in sample['external_ids'].values() if '-PBMC' in eid)
non_pbmc_id = external_id.strip('-PBMC')
non_pbmc_sample = sample_map_by_external_id.get(non_pbmc_id)
pbmc_sample = sample_map_by_external_id.get(external_id)
Expand Down

0 comments on commit cd04654

Please sign in to comment.