Skip to content

Commit f9eab72

Browse files
Merge pull request #6 from bacpop/write_error
Corrects issue with reading symlinks
2 parents 9afcdfc + d5bf512 commit f9eab72

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

scripts/create_symlink.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import glob
22
from Bio import SeqIO
33
import os
4+
import shutil
45
# inputdir and outputdir need to be without trailing "/"
56

67

@@ -14,4 +15,14 @@ def symlink(list_of_dirs, file_ext, outputdir):
1415
filename = file.split("/")[-1]
1516
os.symlink(file, outputdir + "/" + filename)
1617

17-
symlink(snakemake.input.indir, snakemake.params.file_ext, snakemake.output.outputdir)
18+
def copy(list_of_dirs, file_ext, outputdir):
19+
try:
20+
os.mkdir(outputdir)
21+
except OSError:
22+
pass
23+
for ann_dirs in list_of_dirs:
24+
file = glob.glob(ann_dirs + "/*." + file_ext)[0]
25+
filename = file.split("/")[-1]
26+
shutil.copyfile(file, outputdir + "/" + filename)
27+
28+
copy(snakemake.input.indir, snakemake.params.file_ext, snakemake.output.outputdir)

0 commit comments

Comments
 (0)