Example #1
0
    def get_connect_topology(self):
        """Dialog window for selecting new glycan. Can be either pdb or topology file
        Intialize new_connect_top 
        """
        filename = tkFileDialog.askopenfilename(initialdir = self.cwd, title = "Select glycan library", filetypes = (("pdb files","*.pdb"), ("topology file", "*.top"), ("all files","*.*")))
        if not filename:
            return -1
        path, file_extension = os.path.splitext(filename)

        if file_extension == '.pdb':
            glycan = glc.Molecule('glycan')
            glycan.read_molecule_from_PDB(filename, update_bonds = False)
            self.myGlycosylator.assign_patches(glycan)
            connect_tree = self.myGlycosylator.build_connect_topology(glycan)
            self.new_connect_top = self.connect_tree_to_topology(connect_tree)
        elif file_extension == '.top':
            name,self.new_connect_top = self.read_connect_topology(filename)
            self.glycan_name_entry.insert(0, name)

        root,tree,names = self.build_glycan_tree(self.new_connect_top['UNIT'])
        self.new_glycan_image = self.draw_glycan_in_canvas(self.glycan_canvas, tree, root, names, h = 70., w = 70.)
        self.structure_entry.configure(state='normal')
        self.structure_entry.delete(0, tk.END)
        self.structure_entry.insert(0, self.myDrawer.tree_to_text(tree, root, names, visited = []))
        self.structure_entry.configure(state='disabled')
    def glycosylate(self):
        """ Glycosylate sequon with chosen glycan
        
        """
        chid = self.chain.get()
        sequon = self.sequon.get()
        self.sequon_colors[sequon] = [.7, .1, 0]
        key = self.sequon.get()
        residue = self.myGlycosylator.get_residue(key)
        #Build new glycan
        if self.selected_glycan:
            self.myGlycosylator.connect_topology[
                'SELECTED'] = self.selected_glycan[1]
            #build from current glycan
            if key in self.original_glycans:
                original_glycan = self.original_glycanMolecules[key].atom_group
                r, t = self.original_glycans[key]
                connect_tree = self.myGlycosylator.build_connectivity_tree(
                    r, t)
            else:
                original_glycan = None
                connect_tree = None
        #Use current glycan
        else:
            original_glycan = self.original_glycanMolecules[key]
            r, t = self.original_glycans[key]
            connect_tree = self.myGlycosylator.build_connectivity_tree(r, t)
            self.myGlycosylator.connect_topology[
                'SELECTED'] = self.myGlycosylator.build_connect_topology(
                    original_glycan)
            original_glycan = original_glycan.atom_group

        segname = 'G' + key.split(',')[2]
        glycan, bonds = self.myGlycosylator.glycosylate(
            'SELECTED',
            template_glycan_tree=connect_tree,
            template_glycan=original_glycan,
            link_residue=residue,
            link_patch='NGLB',
            chain='G',
            segname=segname)
        new_glycan = glc.Molecule(key)
        new_glycan.set_AtomGroup(glycan, bonds=bonds)
        self.myGlycosylator.assign_patches(new_glycan)
        self.linked_glycanMolecules[key] = new_glycan
        self.linked_glycans[key] = [
            new_glycan.rootRes, new_glycan.interresidue_connectivity
        ]
        self.names.update(new_glycan.get_names())
        # Update glycoprotein and sequon panels
        self.draw_glycoprotein(chid)
        self.draw_glycan(sequon)
Example #3
0
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)
man6, bonds6 = myGlycosylator.glycosylate('MAN6_1;3,2', template_glycan_tree=connect_tree,
                                          template_glycan=myMan9.atom_group)
myMan6 = gl.Molecule('mannose6')
myMan6.set_AtomGroup(man6, bonds=bonds6, update_bonds=False)
# Update angles and dihedrals based on bonds
myMan6.update_connectivity(update_bonds=False)
myGlycosylator.assign_patches(myMan6)
print("New glycan: " + myGlycosylator.identify_glycan(myMan6))
Example #4
0
"""

import glycosylator as gl
import prody as pd
import os

################################################################################
# Creates a builder instance
# 1. Initialization requires a topology and parameter in CHARMM format
myBuilder = gl.MoleculeBuilder(
    os.path.join(gl.GLYCOSYLATOR_PATH,
                 'support/toppar_charmm/carbohydrates.rtf'),
    os.path.join(gl.GLYCOSYLATOR_PATH,
                 'support/toppar_charmm/carbohydrates.prm'))
myNAG = gl.Molecule('NAG')
myNAG.read_molecule_from_PDB(
    os.path.join(gl.GLYCOSYLATOR_PATH, 'support/examples/NAG.pdb'))
NAG_complete, missing_atoms, bonds = myBuilder.add_missing_atoms(
    myNAG.atom_group)
################################################################################
# 2. Add missing atoms
myBuilder.build_missing_atom_coord(NAG_complete, missing_atoms,
                                   myBuilder.Topology.topology['NAG']['IC'])
# 3. Build in the  missing atoms for internal coordinates
myNAG.set_AtomGroup(NAG_complete, bonds=bonds, update_bonds=False)
# Update angles and dihedrals based on bonds
myNAG.update_connectivity(update_bonds=False)
pd.writePDB('NAG_complete.pdb', NAG_complete)
################################################################################
# 4. Connect a second NAG using a 14bb connectivity
Example #5
0
    seg,chain,resid,i =  sequon_id.split(',')
    #skip unglycosylated sequons
    if resid not in glycosylation:
        continue
    glycan_name = glycosylation[resid]
    segname = chain + resid
    #extend exiting glycans    
    if sequon_id in myGlycosylator.glycanMolecules: 
        template = myGlycosylator.glycanMolecules[sequon_id]
        template_tree =  myGlycosylator.build_connectivity_tree(template.rootRes, template.interresidue_connectivity)
        glycan, bonds = myGlycosylator.glycosylate(glycan_name, template_glycan_tree = template_tree, template_glycan = template.atom_group, link_residue = sequon, link_patch = 'NGLB', chain =  'G', segname=segname)
    #build glycan ab initio
    else:
        glycan, bonds = myGlycosylator.glycosylate(glycan_name, link_residue = sequon, link_patch = 'NGLB', chain =  'G', segname=segname)

    new_glycan = gl.Molecule(sequon_id)
    new_glycan.set_AtomGroup(glycan, bonds = bonds)
    new_glycan.update_connectivity(update_bonds = False)
    myGlycosylator.assign_patches(new_glycan)
    at = myGlycosylator.assign_atom_type(new_glycan) 
    new_glycan.set_atom_type(at)
    new_glycan.define_torsionals(hydrogens=False)
    linked_glycanMolecules[sequon_id] = new_glycan
    linked_glycans[sequon_id] = [new_glycan.rootRes, new_glycan.interresidue_connectivity]

################################################################################
# 5. Create a dictionary for storing new glycans
#Update glycan and save pdb
myGlycosylator.glycanMolecules.update(linked_glycanMolecules)
myGlycosylator.glycans.update(linked_glycans)
"""

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'))
myGlycosylator.builder.Topology.read_topology(os.path.join(gl.GLYCOSYLATOR_PATH, 'support/topology/DUMMY.top'))
#Load topology information about glycans
myGlycosylator.read_connectivity_topology(os.path.join(gl.GLYCOSYLATOR_PATH, 'support/topology/mannose.top'))

################################################################################
# 2. Build a mannose 9 ab initio
man9, bonds = myGlycosylator.glycosylate('MAN9_3;4,2')
myMan9 = gl.Molecule('mannose9')
myMan9.set_AtomGroup(man9, bonds = bonds, update_bonds = False)
myMan9.update_connectivity(update_bonds = False)
myGlycosylator.assign_patches(myMan9)

################################################################################
# 3. Atom type and initialize from AtomGroup
atom_type = myGlycosylator.assign_atom_type(myMan9)
myMan9.set_atom_type(atom_type)
# 4. Do not consider torsional angles invovling terminal hydrogen
myMan9.define_torsionals(hydrogens =  False)

################################################################################
# 5. Remove clashes with genetic algorithm
dihe_parameters = myGlycosylator.builder.Parameters.parameters['DIHEDRALS']
vwd_parameters = myGlycosylator.builder.Parameters.parameters['NONBONDED']
Example #7
0
    3. explicitly defining it (list of four the serial number of atoms)
The rotation angle is given in degrees and can be used to set 
    4. a new diherdal angle 
    5. to add an increment to the current angle.

6. A Molecule can also be initilized with an AtomGroup (from Prody)

"""

import glycosylator as gl
import prody as pd
import os

############################################################################
# Create a Molecule
myMan9 = gl.Molecule('mannose9')
# 1. Initialization with PDB file
# Load PDB file and guess all bonds, angles and dihedral angles
myMan9.read_molecule_from_PDB(os.path.join(gl.GLYCOSYLATOR_PATH,
                                           'support/examples/man9.pdb'),
                              update_bonds=True)
# Define all torsionals angles
# Torsionals are defined by serial number of atoms
myMan9.define_torsionals()
print('#' * 50)
print('Number of torsional angles: %d', len(myMan9.torsionals))
print('#' * 50)

############################################################################
# Changing torsional angle