def __init__(self): self.cwd = os.getcwd() self.myGlycosylator = glc.Glycosylator(SELF_BIN +'/support/toppar_charmm/carbohydrates.rtf', SELF_BIN + '/support/toppar_charmm/carbohydrates.prm') self.myGlycosylator.builder.Topology.read_topology(SELF_BIN +'/support/topology/DUMMY.top') self.myDrawer = glc.Drawer() #database variables self.user_glycans = {} self.db_commong = os.path.join(SELF_BIN, 'support/topology/mannose.db') self.common_glycans = {} #database window self.db_window = None self.selected_canvas = None self.selection = None self.selected_glycan = None self.glycan_balloon = None #bookkeeping self.sequon_colors = {} self.original_glycans = {} self.original_glycanMolecules = {} self.linked_glycans = {} self.linked_glycanMolecules = {} self.names = {} #create root window tk.Tk.__init__(self) self.title('Glycosylator') self.geometry('520x520') self.configure(background='white') #self.option_readfile('optionDB') Pmw.initialise(self) #Pmw.aboutversion('2.0') #Pmw.aboutcopyright('This program is free software: you can redistribute it and/or modifiy \nit under the terms of the GNU General Public License as published by the Free Software Foundation,\n either version 3 of the License, or any later version.') #Pmw.aboutcontact('') #self.about = Pmw.AboutDialog(self, applicationname='Glycosyaltor') #estimate dpi of screen mm2in = 1/25.4 pxw = self.winfo_screenwidth() inw = self.winfo_screenmmwidth() * mm2in #DPI is usually overestimated by about 30% for an unknown reason self.dpi = int(pxw/inw*.65) #self.resizable(False, False) self.protocol('WM_DELETE_WINDOW', self.save_before_close) # Create menubar self.menubar = tk.Menu(master=self, bg="lightgrey", fg="black") # file menu self.file_menu = tk.Menu(self.menubar, tearoff=0, bg="lightgrey", fg="black") self.file_menu.add_command(label="Open glycoprotein", accelerator = "Ctrl+O", command = self.load_glycoprotein) self.file_menu.add_command(label="Save glycoprotein", accelerator = "Ctrl+S", command = self.save_glycoprotein) self.file_menu.add_command(label="Export patches", accelerator = "Ctrl+P", command = self.export_patches) #self.file_menu.add_command(label="Propreties", command = self.set_propreties) self.menubar.add_cascade(label="File", menu=self.file_menu) self.config(menu=self.menubar) # glycan menu self.gl_menu = tk.Menu(self.menubar, tearoff=0, bg="lightgrey", fg="black") self.gl_menu.add_command(label="Import glycan library", accelerator = "Ctrl+I", command = self.import_library) self.gl_menu.add_command(label="Export glycan library", accelerator = "Ctrl+E", command = self.export_library) self.menubar.add_cascade(label="Glycan library", menu=self.gl_menu) self.config(menu=self.menubar) #allow for window to expand self.columnconfigure(0, weight=6) self.rowconfigure(0, weight=6) # Create and layout main frames self.left_frame = tk.Frame(self, width = 250, height = 500, bg = 'white') self.right_frame = tk.Frame(self, width = 250, height = 500, bg = 'white') self.left_frame.grid(column=0, row=0, sticky='NSEW') self.right_frame.grid(column=1, row=0) # Create widget for left frame self.v_scrollbar = tk.Scrollbar(self.left_frame, orient = 'vertical') self.h_scrollbar = tk.Scrollbar(self.left_frame, orient = 'horizontal') self.glycoprotein_2D = tk.Canvas(self.left_frame, width = 250, height = 500, bg = 'white', scrollregion=(0, 0, 400, 2000)) self.glycoprotein_2D.configure(yscrollcommand = self.v_scrollbar.set) self.glycoprotein_2D.configure(xscrollcommand = self.h_scrollbar.set) self.v_scrollbar.config(command = self.glycoprotein_2D.yview) self.h_scrollbar.config(command = self.glycoprotein_2D.xview) self.glycoprotein_2D.bind("<MouseWheel>", self._on_mousewheel) self.glycoprotein_2D.bind("<Button-4>", self._on_mousewheel) self.glycoprotein_2D.bind("<Button-5>", self._on_mousewheel) self.detach_button = tk.Button(self.left_frame, command = self.detach_plot) self.detach_icon = tk.PhotoImage(file = SELF_BIN + "/icons/detach.gif") self.detach_button.config(image = self.detach_icon) #Layout left frame self.glycoprotein_2D.grid(column = 0, row= 0, sticky='NSEW') self.detach_button.grid(column = 0, row= 0, sticky='SE') self.v_scrollbar.grid(column = 1, row = 0, sticky='NS') self.h_scrollbar.grid(column = 0, row = 1, sticky='EW') self.left_frame.columnconfigure(0, weight=6) self.left_frame.rowconfigure(0, weight=6) # Create widget for right frame self.glycosylator_logo = tk.PhotoImage(file = SELF_BIN + "/icons/glycosylator_logo.gif") self.w_logo = tk.Label(self.right_frame, image=self.glycosylator_logo, bg = 'white') self.chain_label = tk.Label(self.right_frame, text="Chain:", bg = 'white') options = ['-'] self.chain = tk.StringVar(self.right_frame) self.chain_menu = tk.OptionMenu(self.right_frame, self.chain, *options, command = self.update_sequons) self.chain_menu.config(width = 10) self.chain_menu.configure(state="disabled") self.sequon_label = tk.Label(self.right_frame, text="Sequon:", bg = 'white') self.sequon = tk.StringVar(self.right_frame) self.sequon_menu = tk.OptionMenu(self.right_frame, self.sequon, *options) self.sequon_menu.config(width = 10) self.sequon_menu.configure(state="disabled") self.glycan_label = tk.Label(self.right_frame, text="Click to modify glycan", bg = 'white') self.glycan_2D = tk.Canvas(self.right_frame, width = 150, height = 150, bg = 'white') self.glycan_2D.bind("<Button-1>", self.database_window) self.glycan_name = Pmw.Balloon(self.right_frame) self.glycan_name.bind(self.glycan_2D, 'No sequon has been selected') self.undo_button = tk.Button(self.right_frame, command = self.undo_glycan) self.undo_icon = tk.PhotoImage(file = SELF_BIN + "/icons/undo.gif") self.undo_button.config(image = self.undo_icon) self.glycan_name.bind(self.undo_button, 'Undo glycosylation') self.glycosylate_button = tk.Button(self.right_frame, text="Glycosylate", command = self.glycosylate, width = 10) # self.glycosylateAll_button = tk.Button(self.right_frame, text="Glycosylate all", width = 10) self.clashes = tk.Button(self.right_frame, text="Remove clashes", width = 10, command = self.remove_clashes) # Layout right frame i = 0 self.w_logo.grid(column = 0, row = i, sticky='N', pady=(1, 65)); i+=1 self.right_frame.rowconfigure(0, weight = 1) self.chain_label.grid(column = 0, row = i, sticky='W'); i+=1 self.chain_menu.grid(column = 0, row = i); i+=1 self.sequon_label.grid(column = 0, row = i, sticky='W'); i+=1 self.sequon_menu.grid(column = 0, row = i); i+=1 self.glycan_label.grid(column = 0, row = i, sticky='W'); i+=1 self.glycan_2D.grid(column = 0, row = i); self.undo_button.grid(column = 0, row = i, sticky = 'SE', padx= (5, 10)); i+=1 self.glycosylate_button.grid(column = 0, row = i, pady = (15, 2)); i+=1 # self.glycosylateAll_button.grid(column = 0, row = i, pady = 2); i+=1 self.clashes.grid(column = 0, row = i, pady = 2); i+=1
UNIT MAN C1 14bb 14bb 16ab 13ab !Z7 Unit connected with 13ab to Z4 [path from root: 14bb 14bb 16ab] UNIT MAN C1 14bb 14bb 13ab !Z9 Unit connected with 13ab to Z3 [path from root: 14bb 14bb] 4. The connectivity tree is atomatically guessed based on bonds and patches. This can be used to identify glycan in connectivity tree library 5. A template glycan can be modified to match the defined connectivity tree (e.g Mannose 6: MAN6_1;3,2) 6. A topology tree can also be directly defined as a dictionary 7. A glycan can be built ab initio """ import glycosylator as gl import prody as pd import os ################################################################################ # 1. Create a glycosylator myGlycosylator = gl.Glycosylator(os.path.join(gl.GLYCOSYLATOR_PATH, 'support/toppar_charmm/carbohydrates.rtf'), os.path.join(gl.GLYCOSYLATOR_PATH, 'support/toppar_charmm/carbohydrates.prm')) # 2. Additional topology files (in this case for building glycans ab initio [DUMMY pathc]) myGlycosylator.builder.Topology.read_topology(os.path.join(gl.GLYCOSYLATOR_PATH, 'support/topology/DUMMY.top')) # 3. Load glycan connectivity tree library myGlycosylator.read_connectivity_topology(os.path.join(gl.GLYCOSYLATOR_PATH, 'support/topology/mannose.top')) ################################################################################ # 4. Identify glycan in mannose.top myMan9 = gl.Molecule('mannose9') myMan9.read_molecule_from_PDB(os.path.join(gl.GLYCOSYLATOR_PATH, 'support/examples/man9.pdb'), update_bonds=True) myGlycosylator.assign_patches(myMan9) print("Identified glycan: " + myGlycosylator.identify_glycan(myMan9)) ################################################################################ # 5. Trim man9 down to man6 connect_tree = myGlycosylator.build_connectivity_tree(myMan9.rootRes, myMan9.interresidue_connectivity)
#!usr/bin/env python """ demo_polymer.py The following code will illustrate how to use glycosylator to build a polymer. In this case, we will build a small peptide. 1. Load glycosylator with topology files for amino acids """ import glycosylator as gl import prody as pd import os ################################################################################ # 1. Create a glycosylator myGlycosylator = gl.Glycosylator('peptide.str', 'peptide.prm') ################################################################################ ################################################################################ # 2. Define sequence of peptide: # GLYCSYLATR peptide_topo = {} peptide_topo['#UNIT'] = 10 peptide_topo['UNIT'] = [ ['GLY', ' ', []], ['LEU', 'C1', ['LINK']], ['TYR', 'C1', ['LINK', 'LINK']], ['CYS', 'C1', ['LINK', 'LINK', 'LINK']], ['SER', 'C1', ['LINK', 'LINK', 'LINK', 'LINK']], ['TYR', 'C1', ['LINK', 'LINK', 'LINK', 'LINK', 'LINK']], ['LEU', 'C1', ['LINK', 'LINK', 'LINK', 'LINK', 'LINK', 'LINK']], ['ALA', 'C1', ['LINK', 'LINK', 'LINK', 'LINK', 'LINK', 'LINK', 'LINK']],