From ff90bff662b5b3ebc98278cf64d4919fbe4699c5 Mon Sep 17 00:00:00 2001 From: Michael Lamkin Date: Thu, 10 Nov 2022 11:54:04 -0800 Subject: [PATCH] fix: issue where breakpoints weren't outputting (#144) --- haptools/sim_genotype.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/haptools/sim_genotype.py b/haptools/sim_genotype.py index e579b73e..8a345c71 100644 --- a/haptools/sim_genotype.py +++ b/haptools/sim_genotype.py @@ -472,7 +472,8 @@ def write_breakpoints(samples, breakpoints, out): # randomly sample breakpoints to get the correct amount of samples to output breakpoints = np.array(breakpoints, dtype=object) - breakpoints = np.random.choice(breakpoints, size=2*samples, replace=False) + breakpoints_ind = np.random.choice(range(breakpoints.shape[0]), size=2*samples, replace=False) + breakpoints = breakpoints[breakpoints_ind, :] with open(breakpt_file, 'w') as output: for ind, sample in enumerate(breakpoints): @@ -852,7 +853,7 @@ def validate_params(model, mapdir, chroms, popsize, invcf, sample_info, region=N # Complete check if we're only outputting a breakpoint if only_bp: - return + return popsize # Collect samples from vcf try: