-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path02_structure_rip.py
executable file
·36 lines (32 loc) · 1.14 KB
/
02_structure_rip.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
#imports of all kinds go here
import sys, math, os
inputpath = './input/structure/'
outputpath = './input/structure_anm/'
rmsdpath = './input/structure_rmsd/'
sequencefile = open('./output/aa_number.csv', 'r')
files = []
for line in sequencefile:
if line[0] == '>':
name = line.split(',')
name[0] = name[0][1:]
count = len(name)
i = 1
while i < count:
name[i] = int(name[i])
i += 1
files.append(name)
for filename in files:
structurefile = open(inputpath + filename[0] + '.pdb', 'r')
outfile = open(outputpath + filename[0] + '.pdb', 'w')
rmsdfile = open(rmsdpath + filename[0] + '.pdb', 'w')
outfile.write('REMARK ' + filename[0] + '\n')
rmsdfile.write('REMARK ' + filename[0] + '\n')
for line in structurefile:
if line[0:4]== "ATOM" and line[13:15]=="CA" and line[21]=="A" and int(line[23:26]) in filename:
outfile.write(line)
rmsdfile.write(line)
elif line[0:4]== "ATOM" and line[13:15]=="CA":
outfile.write(line[0:5] + ' 10000 ' + line[12:])
outfile.close()
rmsdfile.close()
structurefile.close()