-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcat_rna_structure.py
executable file
·36 lines (28 loc) · 1 KB
/
cat_rna_structure.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
#!/usr/bin/python
from sys import argv,exit
from os import popen, system
from os.path import basename,dirname
from glob import glob
indir = argv[ 1 ]
globfiles = glob( '%s/*/bpp.txt' % indir )
globfiles.sort()
for bpp_file in globfiles:
new_file = basename( dirname( bpp_file) ).replace( '_PARTITION', '_partition_bpp.txt' )
command = 'cp %s %s' % (bpp_file, new_file )
print command
system( command )
globfiles = glob( '%s/*.seq.ct' % indir )
globfiles.sort()
#exit( 0 )
for ct_file in globfiles:
cat_file = basename( ct_file ).replace('.seq.ct','_structures.txt' )
fid = open( cat_file, 'w' )
lines = popen( 'ct_to_structure.py %s' % ct_file ).readlines()
fid.write( lines[0] )
bootfiles = glob( '%s.boot*' % ct_file )
bootfiles.sort()
for bootfile in bootfiles:
lines = popen( 'ct_to_structure.py %s' % bootfile ).readlines()
fid.write( lines[0] )
print 'Outputting data (including %d bootstraps) to: %s' % (len( bootfiles), cat_file )
fid.close()