Skip to content

Commit

Permalink
scripts/create_symlink.py
Browse files Browse the repository at this point in the history
  • Loading branch information
samhorsfield96 committed Apr 23, 2024
1 parent 9afcdfc commit d5bf512
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 d5bf512

Please sign in to comment.