-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex_split_aa.py
More file actions
31 lines (29 loc) · 851 Bytes
/
index_split_aa.py
File metadata and controls
31 lines (29 loc) · 851 Bytes
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
# Requires Python3
from string import digits
import sys
# Residue of interest
aainterest = ["ALA"]
aalistnumbers = []
aalistnumbersnew = []
writeindextofile = str(sys.argv[1])
readgrofile = str(sys.argv[2])
file = open(writeindextofile,'w')
# Where im writing the output
for aminoacid in aainterest:
allindex = ""
with open(readgrofile) as f:
# Read file something *first.gro
for line in f:
splitline = line.split()
stringsplitline = splitline[0]
stringsplitlinesection = stringsplitline.translate(None, digits)
if stringsplitlinesection == aminoacid:
allindex = allindex + splitline[2] + " "
aalistnumbers = aalistnumbers + [splitline[0]]
splitallindex = allindex.split()
for chars in splitallindex:
file.write(chars + "\n")
file.close()
for i in aalistnumbers:
if i not in aalistnumbersnew:
aalistnumbersnew.append(i)