Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fix_pbmc_sample_participant.py script for multiple external ids #831

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading