-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsingle_cov.py
executable file
·30 lines (26 loc) · 1.04 KB
/
single_cov.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
#!/usr/bin/env python
import argparse
from qsub import *
# arguments
parser = argparse.ArgumentParser()
parser.add_argument('-dir', help='Directory containing maf files to ensure single coverage for', required=True)
parser.add_argument('-ref_name', help='Name of reference species', required=True)
parser.add_argument('-evolgen', help='If specified will submit to lab queue', default=False, action='store_true')
args = parser.parse_args()
# variables
directory = args.dir
maf_list = [maf for maf in os.listdir(directory) if maf.endswith('.maf')]
out_dir = directory + 'single_coverage/'
if not os.path.isdir(out_dir):
os.mkdir(out_dir)
ref = args.ref_name
evolgen = args.evolgen
# run single_cov2
for maf in maf_list:
in_maf = directory + maf
output = out_dir + maf.rstrip('.maf') + '.sing.maf'
cmd_line = ('single_cov2 ' +
in_maf + ' [R=' + ref + '] > ' +
output)
q_sub([cmd_line], out=out_dir + 'single_cov2_' + maf.rstrip('.maf'),
jid='single_cov2_' + maf.rstrip('.maf') + '.sh', evolgen=evolgen)