import packages.binana.peel as peel import packages.pymolecule.pymolecule as pymolecule part_1 = pymolecule.Molecule() part_1.fileio.load_pdb_into('helixPt1.pdb') part_2 = pymolecule.Molecule() part_2.fileio.load_pdb_into('helixPt2.pdb') #peel_1.write_vmd_script_file('peel1.vmd'') peel_1 = peel.peel(part_1, peel.defaultParams) fmaps_1 = peel_1.create_feature_maps([25, 55, -25, 5, -15, 15], 1, ['hbondDonor', 'hbondAcceptor']) peel_2 = peel.peel(part_2, peel.defaultParams) fmaps_2 = peel_2.create_feature_maps([25, 55, -25, 5, -15, 15], 1, ['hbondDonor', 'hbondAcceptor']) #peel_1.write_vmd_script_file('peel_1.vmd') #peel_2.write_vmd_script_file('peel_2.vmd') fmaps_1['hbondDonor'].write_dx_file('hbd1.dx') fmaps_1['hbondAcceptor'].write_dx_file('hba1.dx') fmaps_2['hbondDonor'].write_dx_file('hbd2.dx') fmaps_2['hbondAcceptor'].write_dx_file('hba2.dx') my_algebra = peel.algebra() my_algebra.setScoreFuncs( ['hbondAcceptor_A * hbondDonor_B', 'hbondAcceptor_B * hbondDonor_A']) my_score_maps, my_scores = my_algebra.scoreAll(fmaps_1, fmaps_2)
import packages.binana.peel as peel import packages.pymolecule.pymolecule as pymolecule my_params = peel.defaultParams trp = pymolecule.Molecule() trp.fileio.load_pdb_into('trp.pdb', bonds_by_distance=True, serial_reindex=True, resseq_reindex=False) my_peel = peel.peel(trp, my_params) my_peel.write_vmd_script('visualize_trp.vmd', peel.defaultParams) my_feature_maps = my_peel.create_feature_maps([-20, 20, -20, 20, -20, 20], 0.5) my_feature_maps['hbondAcceptor'].write_pdb('HBA.pdb') my_feature_maps['hbondDonor'].write_pdb('HBD.pdb') my_feature_maps['aromatic'].write_pdb('ARO.pdb') print "Done!"
import packages.binana.peel as peel import packages.pymolecule.pymolecule as pymolecule import numpy features = [ 'aromatic', 'hbondDonor', 'hbondAcceptor', 'hydrophobic', 'hydrophilic', 'hydrophobicity', 'occupancy' ] mostly_empty = pymolecule.Molecule() mostly_empty.fileio.load_pdb_into('mostly_empty.pdb') my_peel = peel.peel(mostly_empty, peel.defaultParams) one_point_fmaps_1 = my_peel.create_feature_maps([0, 0, 0, 0, 0, 0], 1, features) one_point_fmaps_2 = my_peel.create_feature_maps([0, 0, 0, 0, 0, 0], 1, features) print print '======Beginning scoring ======' for i in range(len(features)): #So the point of featuremap_1 for aromatic will be set to 0, hBondDonor 2, etc... one_point_fmaps_1[features[i]].setData(numpy.array([[[2 * i]]])) #So the point of featuremap_2 for aromatic will be set to 1, hBondDonor 3, etc... one_point_fmaps_2[features[i]].setData(numpy.array([[[(2 * i) + 1]]])) print 'Setting %s to be %i for featuremap_A and %i for featuremap_B' % ( features[i], i * 2, (i * 2) + 1) my_algebra = peel.algebra() my_score_funcs = [ 'hbondAcceptor_A * hbondDonor_B', 'hbondAcceptor_B * hbondDonor_A'
import numpy import random import os import shutil # This program demonstrates all the features of pymolecule 2.0, a python framework # for loading, saving, and manipulating 3D molecular data. ########## First, set up the example directory ########## if os.path.exists('./example_output'): shutil.rmtree('./example_output') os.mkdir('./example_output') ########## Saving and Loading Molecular Data ########## # First, create a molecule object. molecule = pymolecule.Molecule() #molecule.fileio.load_pym_into('./example_output/pym_example.pym') # remove this later # Now, load a PDB file into that object. Calculate the bonds by distance, and # reindex the serial and resseq fields. Definitions used:: # pymolecule.Molecule.fileio.load_pdb_into # pymolecule.Molecule.fileio.load_pdb_into_using_file_object # pymolecule.Molecule.fileio.serial_reindex # pymolecule.Molecule.fileio.resseq_reindex # pymolecule.Molecule.atoms_and_bonds.create_bonds_by_distance # pymolecule.Molecule.selections.select_all_atoms_bound_to_selection molecule.fileio.load_pdb_into('./example.pdb', True, True, True) # Save the molecule object as a PDB file. The serial and resseq fields have # already been reindexed, so we'll skip that. Definitions used: # pymolecule.Molecule.fileio.save_pdb
centerCoords[proteinPdbPrefix] = [ numpy.mean(allCoords[proteinPdbPrefix][:, 0]), numpy.mean(allCoords[proteinPdbPrefix][:, 1]), numpy.mean(allCoords[proteinPdbPrefix][:, 2]) ] # Generate the PDB map sideLength = 30 protein_boundaries = [ centerCoords[proteinPdbPrefix][0] - sideLength, centerCoords[proteinPdbPrefix][0] + sideLength, centerCoords[proteinPdbPrefix][1] - sideLength, centerCoords[proteinPdbPrefix][1] + sideLength, centerCoords[proteinPdbPrefix][2] - sideLength, centerCoords[proteinPdbPrefix][2] + sideLength ] protein_molecule = pymolecule.Molecule() protein_molecule.fileio.load_pdb_into(pdbFileName, serial_reindex=True, resseq_reindex=False) protein_peel = peel.peel(protein_molecule, my_params) protein_feature_maps = protein_peel.create_feature_maps( protein_boundaries, gridResolution, features=features) # Now save the featureMaps for this protein #with gzip.open('%s/%s_featureMaps.cPickle.gz' %(proteinFmOutputDir, proteinPdbPrefix),'wb') as my_file: my_file = gzip.open( '%s/%s_featureMaps.cPickle.gz' % (proteinFmOutputDir, proteinPdbPrefix), 'wb') cPickle.dump(protein_feature_maps, my_file, protocol=2) my_file.close() else: #If the job is marked as started, let's see if it's finished. If so, load that receptor map
import packages.binana.peel as peel import packages.pymolecule.pymolecule as pymolecule #import numpy my_params = peel.defaultParams my_protein = pymolecule.Molecule() my_protein.fileio.load_pdb_into('2gfc_reduced.pdb', serial_reindex=True, resseq_reindex=False) my_peel = peel.peel(my_protein, my_params) my_peel.write_vmd_script('visualize_2gfc.vmd', peel.defaultParams) #povmeMap = numpy.ones((13,13,13)) #my_peel.color_povme_map(povmeMap, [0,13,0,13,0,13], 1) # If given no "features" argument, create_feature_maps will create maps of all features my_feature_maps = my_peel.create_feature_maps([10, 80, -30, 45, -30, 30], 1) my_feature_maps['hbondAcceptor'].write_pdb('HBA.pdb') my_feature_maps['hbondAcceptor'].write_dx_file('HBA.dx') my_feature_maps['hbondDonor'].write_pdb('HBD.pdb') my_feature_maps['hbondDonor'].write_dx_file('HBD.dx') my_feature_maps['aromatic'].write_pdb('ARO.pdb') my_feature_maps['aromatic'].write_dx_file('ARO.dx') my_feature_maps['hydrophobic'].write_pdb('HPB.pdb') my_feature_maps['hydrophobic'].write_dx_file('HPB.dx') my_feature_maps['hydrophilic'].write_pdb('HPL.pdb') my_feature_maps['hydrophilic'].write_dx_file('HPL.dx') #my_feature_maps['hydrophobicity'].write_pdb('HPBTY.pdb') #my_feature_maps['hydrophobicity'].write_dx_file('HPBTY.dx')
#import numpy import packages.pymolecule.pymolecule as pymolecule import packages.binana.peel as peel import sys #print sys.modules my_params = peel.defaultParams #DEFAULT #arg = pymolecule.FileIO.load_pdb_into( 'arg.pdb', bonds_by_distance=True, serial_reindex = True, resseq_reindex=False) arg = pymolecule.Molecule() arg.fileio.load_pdb_into('arg.pdb', bonds_by_distance=True, serial_reindex=True, resseq_reindex=False) my_peel = peel.peel(arg, my_params) my_peel.write_vmd_script('visualize_arg.vmd', peel.defaultParams) my_feature_maps = my_peel.create_feature_maps([-10, 15, -5, 15, -10, 15], 1) my_feature_maps['hbondAcceptor'].write_pdb('HBA.pdb') my_feature_maps['hbondAcceptor'].write_dx_file('HBA.dx') my_feature_maps['hbondDonor'].write_pdb('HBD.pdb') my_feature_maps['hbondDonor'].write_dx_file('HBD.dx') my_feature_maps['occupancy'].write_dx_file('OCC.dx') #my_feature_maps['aromatic'].write_pdb('ARO.pdb') #don't bother with this my_feature_maps['hydrophobic'].write_pdb('HBC.pdb') my_feature_maps['hydrophilic'].write_pdb('HPL.pdb') #my_feature_maps['hydrophobicity'].write_pdb('HPBTY.pdb') #my_feature_maps['hydrophobicity'].write_dx_file('HPBTY.dx') #HBAMap = my_feature_maps[0].data