-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfastqc.py
executable file
·42 lines (37 loc) · 1.24 KB
/
fastqc.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
41
42
#!/usr/bin/env python3
import argparse
import os
from funpipe.bam import fastqc, picard
def bam_fast_qc(bam, ref_fa, out_dir, prefix):
''' use FastQc for a BAM '''
picard_cmd = picard()
(fq1, fq2) = picard_cmd.bam2fqs(bam, os.path.join(out_dir, prefix))
temp_fastq = fastq(fq1, fq2, is_paired= True )
temp_fastq.fastqc(out_dir)
print(' - bam_fast_qc done.')
return 1
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='Exam quality of BAMs'
)
# required arguments
required = parser.add_argument_group('Required arguments')
required.add_argument(
'-i', '--bam', required=True, help='Input BAM file'
)
required.add_argument(
'-f', '--ref_fa', required=True, help='Reference genome fasta file'
)
# optional arguments
parser.add_argument(
'-d', '--out_dir', help='output directory', default='.'
)
parser.add_argument(
'-p', '--prefix', help='Output prefix', default='outfile'
)
parser.add_argument(
'-j', '--picard_jar', help='path to picard_jar',
default='/seq/software/picard/1.853/bin/picard.jar'
)
args = parser.parse_args()
bam_fast_qc(args.bam, args.ref_fa, args.out_dir, args.prefix)