def remove_clashes(self): """ Remove clashes from modeled glycans """ dihe_parameters = self.myGlycosylator.builder.Parameters.parameters[ 'DIHEDRALS'] vwd_parameters = self.myGlycosylator.builder.Parameters.parameters[ 'NONBONDED'] static_glycans = None for k in self.original_glycanMolecules: if k not in self.linked_glycanMolecules: if static_glycans is not None: static_glycans += self.original_glycanMolecules[ k].atom_group else: static_glycans = self.original_glycanMolecules[ k].atom_group.copy() environment = self.myGlycosylator.protein.copy() environment += static_glycans #Build topology self.myGlycosylator.build_glycan_topology( glycanMolecules=self.linked_glycanMolecules, build_all=False) sampler = glc.Sampler(self.linked_glycanMolecules.values(), environment, dihe_parameters, vwd_parameters) sampler.remove_clashes_GA()
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. Load HIV-1 Env trimer myGlycosylator.load_glycoprotein( os.path.join(gl.GLYCOSYLATOR_PATH, 'support/examples/env_4tvp.pdb')) myGlycosylator.build_glycan_topology(patch='NGLB') ################################################################################ # 3. Remove clashes with genetic algorithm dihe_parameters = myGlycosylator.builder.Parameters.parameters['DIHEDRALS'] vwd_parameters = myGlycosylator.builder.Parameters.parameters['NONBONDED'] # 4. Consider all glycans in HIV-1 Env trimer mySampler = gl.Sampler(myGlycosylator.glycanMolecules.values(), myGlycosylator.protein, dihe_parameters, vwd_parameters) #mySampler.remove_clashes_GA(n_generation = 20, pop_size=30, mutation_rate=0.01) mySampler.remove_clashes_GA_iterative(n_iter=5, n_individues=3, n_generation=30, pop_size=30, mutation_rate=0.01) myGlycosylator.write_glycoprotein('HIV_optimized.pdb')
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'] mySampler = gl.Sampler([myMan9], None, dihe_parameters, vwd_parameters) mySampler.remove_clashes_GA_iterative(n_iter = 1, n_generation = 30, pop_size=30, mutation_rate=0.01) myMan9.writePDB('Man9_optimized.pdb')