1
|
|
|
#!/usr/bin/python |
2
|
|
|
#!/usr/bin/env python |
3
|
|
|
# -*- coding: utf-8 -*- |
4
|
|
|
""" |
5
|
|
|
1 - method |
6
|
|
|
2 - cpu |
7
|
|
|
3 - "_X.csv' (without csv |
8
|
|
|
|
9
|
|
|
print "1 - method, 2 - cpu, 3 - '_X.csv' (without csv) 4 - run 5 - method_code, e.g. Fhi" |
10
|
|
|
""" |
11
|
|
|
from __future__ import print_function |
12
|
|
|
|
13
|
|
|
import argparse |
14
|
|
|
import sys |
15
|
|
|
import os |
16
|
|
|
import glob |
17
|
|
|
|
18
|
|
|
|
19
|
|
|
def get_parser(): |
20
|
|
|
parser = argparse.ArgumentParser( |
21
|
|
|
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) |
22
|
|
|
|
23
|
|
|
#parser.add_argument('-', "--", help="", default="") |
24
|
|
|
|
25
|
|
|
parser.add_argument("-v", "--verbose", |
26
|
|
|
action="store_true", help="be verbose") |
27
|
|
|
parser.add_argument("method") |
28
|
|
|
parser.add_argument("cpu", type=int) |
29
|
|
|
parser.add_argument("--run", action="store_true") # nargs='+') |
30
|
|
|
parser.add_argument("path") |
31
|
|
|
parser.add_argument("--subfolder", default="struc", help="struc in this case /home/mqapRNA/mqaprna_datasets/rasp/2nueC/struc/2nueC_M10.pdb") |
32
|
|
|
parser.add_argument("dirs", nargs='+')# help="", default="") # |
33
|
|
|
return parser |
34
|
|
|
|
35
|
|
|
|
36
|
|
|
if __name__ == '__main__': |
37
|
|
|
parser = get_parser() |
38
|
|
|
args = parser.parse_args() |
39
|
|
|
|
40
|
|
|
missing = '' |
41
|
|
|
|
42
|
|
|
files = os.listdir(PATH) |
|
|
|
|
43
|
|
|
method = args.method |
44
|
|
|
cpu = int(args.cpu) |
45
|
|
|
method_code = ''#sys.argv[5] |
46
|
|
|
|
47
|
|
|
for f in args.dirs: |
48
|
|
|
if os.path.isdir(f): |
49
|
|
|
print('#' * 80) |
50
|
|
|
print(f) |
51
|
|
|
if missing: |
52
|
|
|
if f not in missing.split(','): |
53
|
|
|
continue |
54
|
|
|
|
55
|
|
|
#cmd = 'cp -v ' + f + '/' + f + '.pdb ' + f + '/struc/' |
56
|
|
|
#print cmd |
57
|
|
|
#cmd = "mqaprna.py -n 1a9nR/1a9nR.pdb 1a9nR/struc/ 1a9nR" |
58
|
|
|
#cmd = "mqaprna.py -m 6 -t SimRNA_1 " + f + '/struc ' + f + '_simrna_1_' |
59
|
|
|
|
60
|
|
|
#cmd = "mqaprna.py -m " + str(cpu) + " -g /home/magnus/mqaprna_decoys/rasp/" + f + '_' + method + "-v0.3-48-g80cbfc0-dirty.csv -t " + method + " " + PATH + f + '/struc ' + PATH + '_' + f + '_' + method |
61
|
|
|
|
62
|
|
|
pattern = path + '/*' + f + '*' + method + '**csv' |
|
|
|
|
63
|
|
|
print(pattern) |
64
|
|
|
csvfn_to_ignore = glob.glob(pattern) |
65
|
|
|
print(csvfn_to_ignore) |
66
|
|
|
if len(csvfn_to_ignore) > 0: |
67
|
|
|
g = " -g " + csvfn_to_ignore[0] |
68
|
|
|
else: |
69
|
|
|
print('nothing to ignore...') |
70
|
|
|
g = '' |
71
|
|
|
#g = '' # g hack! |
72
|
|
|
|
73
|
|
|
if cpu > 0: |
74
|
|
|
multi_cpu = ' -m ' + str(cpu) |
75
|
|
|
cpu_c = cpu |
76
|
|
|
else: |
77
|
|
|
multi_cpu = '' |
78
|
|
|
cpu_c = '1' |
79
|
|
|
|
80
|
|
|
cmd = "mqaprna.py " + multi_cpu + " " + g + " -t " + method + " " + PATH + f + os.sep + args.subfolder + '/*.pdb -o ' + PATH + '' + f + '_' + method |
81
|
|
|
print(cmd) |
82
|
|
|
|
83
|
|
|
#cmd2 = 'echo "' + cmd + '" | qsub -cwd -V -pe mpi ' + str(cpu_c) + ' -N _' + f + method_code #+ f + '_'+method # -l h_vmem=300M -l mem_free=500M |
84
|
|
|
# print cmd2 |
85
|
|
|
#RASP,SimRNA,AnalyzeGeometry,FARNA,QRNA,NAST_pyro,radiu |
86
|
|
|
# s_of_gyration,SSAgreement,ClashScore,RNAkb |
87
|
|
|
if args.run: |
88
|
|
|
os.system(cmd) |
89
|
|
|
|
90
|
|
|
|