Skip to content

Commit

Permalink
Merge pull request #6 from bacpop/write_error
Browse files Browse the repository at this point in the history
Corrects issue with reading symlinks
  • Loading branch information
samhorsfield96 authored Apr 23, 2024
2 parents 9afcdfc + d5bf512 commit f9eab72
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion scripts/create_symlink.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import glob
from Bio import SeqIO
import os
import shutil
# inputdir and outputdir need to be without trailing "/"


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

symlink(snakemake.input.indir, snakemake.params.file_ext, snakemake.output.outputdir)
def copy(list_of_dirs, file_ext, outputdir):
try:
os.mkdir(outputdir)
except OSError:
pass
for ann_dirs in list_of_dirs:
file = glob.glob(ann_dirs + "/*." + file_ext)[0]
filename = file.split("/")[-1]
shutil.copyfile(file, outputdir + "/" + filename)

copy(snakemake.input.indir, snakemake.params.file_ext, snakemake.output.outputdir)

0 comments on commit f9eab72

Please sign in to comment.