-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathrun_delivery.py
More file actions
32 lines (28 loc) · 987 Bytes
/
run_delivery.py
File metadata and controls
32 lines (28 loc) · 987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import argparse
import os
import glob
import re
import subprocess
def main(arg):
project = os.path.split(os.path.realpath(arg.source))[1]
move_from_path = "{}/*/".format(arg.source)
samples_path = glob.glob(move_from_path)
#create in inbox folder for project
dest = "/proj/{}/INBOX/{}/".format(arg.uppnexid,project)
try:
os.makedirs(dest)
except OSError:
pass
for sample in samples_path:
sampel_name = os.path.basename(os.path.normpath(sample))
sample_dest = os.path.join(dest, sampel_name)
cmd = ["rsync", "-auhvr", sample, sample_dest]
subprocess.call(cmd)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--source", required=True, type = str,
help= "Path to QC analysis folder")
parser.add_argument("--uppnexid", required=True, type = str,
help =("Destination Uppnex id"))
projectID = parser.parse_args()
main(projectID)