Skip to content

Commit 29a4623

Browse files
committed
Fixed randrange crash when using only 1 replicate. Fixes #26.
1 parent 710ed78 commit 29a4623

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

structure_threader/structure_threader.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,13 @@ def create_plts(resultsdir, wrapped_prog):
183183

184184
if wrapped_prog == "structure":
185185
# Get only relevant output files, choosen randomly from the replictes.
186+
# Failsafe in case we only have 1 replicate:
187+
if arg.replicates == 1:
188+
file_to_plot = "1"
189+
else:
190+
file_to_plot = str(randrange(arg.minK, arg.replicates))
186191
plt_files = [os.path.join(resultsdir, "K") + str(i) + "_rep" +
187-
str(randrange(arg.minK, arg.replicates)) + "_f"
192+
file_to_plot + "_f"
188193
for i in range(arg.minK, arg.Ks + 1)]
189194
else:
190195
plt_files = [os.path.join(resultsdir, "fS_run_K.") + str(i) + ".meanQ"

0 commit comments

Comments
 (0)