-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfastqc_multiqc.py
40 lines (29 loc) · 1.23 KB
/
fastqc_multiqc.py
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
31
32
33
34
35
36
37
38
39
40
import sys
import glob
import os
import subprocess
import argparse
import re
def main():
local_path = os.path.dirname(os.path.realpath(__file__))
cli = argparse.ArgumentParser()
cli.add_argument('-i', '--InputFolder', help="Input folder file", required=True)
cli.add_argument('-o', '--OutputFolder', help="Output folder", required=False, default=".")
args = cli.parse_args()
#subprocess.run(["wc", args.Input])
files = sorted([f for f in glob.glob(args.InputFolder+"/**", recursive = True) if re.search(r'(.*)\.((fastq|fq)(|\.gz))$', f)])
#InputFolder = os.path.expanduser(args.InputFolder)
#files = sorted(glob.glob(InputFolder+"/*.fastq"))
print(files)
OutputFolder = os.path.expanduser(args.OutputFolder)
os.makedirs(OutputFolder, exist_ok=True)
for i in range(0, len(files)):
filec = files[i]
base = os.path.splitext(os.path.basename(filec))[0]
base = os.path.splitext(base)[0]
#print(base)
#subprocess.call(["seqtk", "seq", "-L", str(args.Size), args.Input], stdout=f)
subprocess.call(["fastqc", filec, "-o", OutputFolder])
subprocess.call(["multiqc", OutputFolder, "-o", OutputFolder])
if __name__ == "__main__":
sys.exit(main())