Skip to content

Commit 3318131

Browse files
committed
FastStructure wrapper can now use PLINK input files. Closes #20, #24.
1 parent 07c651b commit 3318131

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

structure_threader.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ def runprogram(iterations):
4343
and -1 in case of errors). The second element contains the output file
4444
that identifies the worker.
4545
"""
46-
4746
worker_status = (None, None)
4847

4948
K, rep_num = iterations
@@ -52,24 +51,23 @@ def runprogram(iterations):
5251
# Keeps correct directory separator across OS's
5352
output_file = os.path.join(outpath, "K" + str(K) + "_rep" +
5453
str(rep_num))
55-
cli = [arg.structure_bin, "-K", str(K), "-i", infile, "-o", output_file]
54+
cli = [arg.structure_bin, "-K", str(K), "-i", arg.infile, "-o", output_file]
5655
else: # Run fastStructure
5756
# Keeps correct directory separator across OS's
5857
output_file = os.path.join(outpath, "fS_run_K")
59-
if infile.endswith((".bed", ".fam", ".bim")):
58+
if arg.infile.endswith((".bed", ".fam", ".bim")):
6059
file_format = "bed"
61-
infile = infile[:-4]
60+
infile = arg.infile[:-4]
6261
else:
6362
file_format = "str" # Assume str format if plink is not specified
64-
if infile.endswith(".str") is False: # Do we need a symlink?
63+
if arg.infile.endswith(".str") is False: # Do we need a symlink?
6564
from os import symlink
6665
try:
67-
symlink(infile, infile+".str")
66+
symlink(arg.infile, arg.infile+".str")
6867
except OSError as err:
6968
if err.errno != 17:
7069
raise
71-
else:
72-
infile = infile[:-4]
70+
infile = arg.infile[:-4]
7371

7472
cli = ["python2", arg.faststructure_bin, "-K", str(K), "--input",
7573
infile, "--output", output_file, "--format", file_format]

0 commit comments

Comments
 (0)