forked from dwkulp/KonrathWu_CellReports2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
glycan_auto.py
51 lines (39 loc) · 1.59 KB
/
glycan_auto.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#native_gly.py
import optparse
import os
from pyrosetta import *
init()
def main(pose):
pngs_list = ""
pngs_array = []
for i in range(1, pose.total_residue()+1):
if(is_sequeon(i) and is_sequeon(i+1)):
pass
if(is_sequeon(i) and not is_sequeon(i+1)):
pose_to_pdb = pose.pdb_info().pose2pdb(i)
sp = pose_to_pdb.split(" ")
chain_n = str(sp[0])+str(sp[1])
pngs_array.append(chain_n)
pngs_list = str(pngs_array[0])
for i in range(1,len(pngs_array)):
pngs_list += ","+pngs_array[i]
sb = "/home/dwkulp/software/Rosetta/main/source/bin/rosetta_scripts.linuxgccrelease -s "+str(pdb)+" -include_sugars -beta -write_pdb_link_records -maintain_links -parser:protocol /home/ywu/wistar/software/tools/Glycan_Scanner/core/glycans_tree_v2020_jw.xml -parser:script_vars positions="+str(pngs_list)+" glycosylation=man9"
cmd = "/wistar/kulp/software/slurmq --sbatch \""+sb+"\""
#print(cmd)
os.system(cmd)
def is_sequeon(posi):
if(pose.residue(posi).name()=='ASN') and (pose.residue(posi+1).name()!='PRO') and (pose.pdb_info().chain(posi)==pose.pdb_info().chain(posi+2)):
if(pose.residue(posi+2).name()=='SER' or pose.residue(posi+2).name()=='THR'):
return True
return False
#Set Up Option Parser
parser = optparse.OptionParser()
parser.add_option('--pdb', dest = 'pdb',
default = 'gs_relax.pdb', # default example position
help = 'the input struture' )
(options,args) = parser.parse_args()
# PDB file option
pdb = options.pdb
pose = Pose()
pose = pose_from_pdb(pdb)
main(pose)