Skip to content

Commit

Permalink
Move random subset within condition to fix bug attempting to sample e…
Browse files Browse the repository at this point in the history
…mpty list
  • Loading branch information
vivbak committed Jun 10, 2024
1 parent daca8cc commit eb9b7e6
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions scripts/create_test_subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,9 +675,9 @@ def get_sids_for_cohorts(
for seq_group in seq_groups:
sample = seq_group.get('sample')
sids_for_cohort.append(sample['id'])
all_cohorts_sample_ids_subset.update(
random.sample(sids_for_cohort, cohort_samples_n)
)
all_cohorts_sample_ids_subset.update(
random.sample(sids_for_cohort, cohort_samples_n)
)

return all_cohorts_sample_ids_subset

Expand Down Expand Up @@ -907,12 +907,10 @@ def file_exists(path: str) -> bool:
parser.add_argument(
'--project', required=True, help='The sample-metadata project ($DATASET)'
)
parser.add_argument(
'-n', type=int, help='# Random Samples to copy', default=DEFAULT_SAMPLES_N
)
parser.add_argument('-n', type=int, help='# Random Samples to copy', default=0)
parser.add_argument('-f', type=int, help='# Random families to copy', default=0)
parser.add_argument(
'-nsamples-cohort',
'--nsamples-cohort',
type=int,
help='# Random samples to copy from each cohort',
default=0,
Expand Down

0 comments on commit eb9b7e6

Please sign in to comment.