1
|
|
|
#!/usr/bin/env python |
2
|
|
|
# -*- coding: utf-8 -*- |
3
|
|
|
""" |
4
|
|
|
/home/magnus/rna-evo-malibu/ade # run here not up |
5
|
|
|
""" |
6
|
|
|
from __future__ import print_function |
7
|
|
|
|
8
|
|
|
import argparse |
9
|
|
|
import os |
10
|
|
|
import glob |
11
|
|
|
|
12
|
|
|
|
13
|
|
|
def get_parser(): |
14
|
|
|
parser = argparse.ArgumentParser( |
15
|
|
|
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) |
16
|
|
|
|
17
|
|
|
parser.add_argument('-d', "--dryrun", |
18
|
|
|
action="store_true", help="dry run", default=False) |
19
|
|
|
|
20
|
|
|
parser.add_argument('-p', '--path', help="", default='') |
21
|
|
|
parser.add_argument('-c', '--case', help="only one case, for test") |
22
|
|
|
parser.add_argument("-v", "--verbose", |
23
|
|
|
action="store_true", help="be verbose") |
24
|
|
|
|
25
|
|
|
return parser |
26
|
|
|
|
27
|
|
|
def exe(cmd, dryrun): |
28
|
|
|
print(cmd) |
29
|
|
|
if not dryrun: os.system(cmd) |
30
|
|
|
|
31
|
|
|
def main(dryrun, path, case): |
32
|
|
|
if path: |
33
|
|
|
os.chdir(path) |
34
|
|
|
root = os.getcwd() |
35
|
|
|
cases = glob.glob('*') |
36
|
|
|
for c in cases: |
37
|
|
|
print('Case: ', c) |
38
|
|
|
# mode only for a specific case |
39
|
|
|
if case: # only if this is used |
40
|
|
|
if c != case: |
41
|
|
|
print('!!! skip ' + c + '!!!') |
42
|
|
|
continue |
43
|
|
|
|
44
|
|
|
# if not break ed, use this |
45
|
|
|
if os.path.isdir(c): |
46
|
|
|
print ('Inside %s' % c) |
47
|
|
|
os.chdir(c) # go inside a folder |
48
|
|
|
# cmd |
49
|
|
|
#subcases = glob.glob('*.fa') |
50
|
|
|
#for sc in subcases: |
51
|
|
|
for i in [1000]: # |
52
|
|
|
exe('rm *min.out.*.pdb', dryrun) |
53
|
|
|
exe('mkdir %s_top%i' % (c, i), dryrun) |
54
|
|
|
exe('extract_lowscore_decoys.py *min.out %i' % (i), dryrun) |
55
|
|
|
exe('mv -v *min.out.*.pdb %s_top%i' % (c, i), dryrun) |
56
|
|
|
os.chdir(root) |
57
|
|
|
|
58
|
|
|
if __name__ == '__main__': |
59
|
|
|
parser = get_parser() |
60
|
|
|
args = parser.parse_args() |
61
|
|
|
|
62
|
|
|
main(args.dryrun, args.path, args.case) |
63
|
|
|
|