예제 #1
0
    def __init__(self, params):

        self.params = params

        print("\n> Input DATA:")
        print(">> protein receptor: %s" % params.receptor)
        print(">> ligand: %s" % params.ligand)

        #import protein structures - get receptor and ligand
        print(">> importing PDB files...")
        self.M1 = bb.Molecule()
        self.M2 = bb.Molecule()
        self.M1.import_pdb(params.receptor)
        self.M2.import_pdb(params.ligand)

        print(">> importing density files...")
        self.E2 = bb.Density()
        self.E2._import_dx(params.ligand_map)
        self.E1 = bb.Density()
        self.E1._import_dx(params.receptor_map)

        # Build the jabber maps so we save computation time (essentially just the chosen isosurface from dx)
        self.J1 = jd.Jabber(params.receptor_map, params.iso_cutoff)
        self.J2 = jd.Jabber(params.ligand_map, params.iso_cutoff)

        # The structures are already in the correct positions as that was part of the parsing process
        trans_M1 = deepcopy(self.M1.get_center())
        trans_M2 = deepcopy(self.M2.get_center())

        self.E1.write_dx('./models/initial_%s' % (params.receptor_map))
        self.E2.write_dx('./models/initial_%s' % (params.ligand_map))
        self.M1.write_pdb('./models/initial_%s' % (params.receptor))
        self.M2.write_pdb('./models/initial_%s' % (params.ligand))
        self.J1.write_jabber('./models/initial_receptormap.pdb')
        self.J2.write_jabber('./models/initial_ligandmap.pdb')
예제 #2
0
    def __init__(self, params):

        self.params = params

        print("\n> Input DATA:")
        print(">> protein receptor: %s" % params.receptor)
        print(">> ligand: %s" % params.ligand)

        #import protein structures - get receptor and ligand
        print(">> importing PDB files...")
        self.M1 = bb.Molecule()
        self.M2 = bb.Molecule()
        self.M1.import_pdb(params.receptor)
        self.M2.import_pdb(params.ligand)

        print(">> importing density files...")
        self.E2 = bb.Density()
        self.E2._import_dx(params.ligand_map)
        self.E1 = bb.Density()
        self.E1._import_dx(params.receptor_map)

        # Build the jabber maps so we save computation time (essentially just the chosen isosurface from dx)
        self.J1 = jd.Jabber(params.receptor_map, params.iso_cutoff)
        self.J2 = jd.Jabber(params.ligand_map, params.iso_cutoff)

        # move the structures to the geometric center (so they're overlapping)
        trans_M1 = deepcopy(self.M1.get_center())
        trans_M2 = deepcopy(self.M2.get_center())

        self.M1.translate(-trans_M1[0], -trans_M1[1], -trans_M1[2])
        self.M2.translate(-trans_M2[0], -trans_M2[1], -trans_M2[2])
        jd.geometry.translate_map(self.E1, -trans_M1[0], -trans_M1[1],
                                  -trans_M1[2])
        jd.geometry.translate_map(self.E2, -trans_M2[0], -trans_M2[1],
                                  -trans_M2[2])
        self.J1.translate(-trans_M1)
        self.J2.translate(-trans_M2)

        self.E1.write_dx('./models/initial_%s' % (params.receptor_map))
        self.E2.write_dx('./models/initial_%s' % (params.ligand_map))
        self.M1.write_pdb('./models/initial_%s' % (params.receptor))
        self.M2.write_pdb('./models/initial_%s' % (params.ligand))
        self.J1.write_jabber('./models/initial_receptormap.pdb')
        self.J2.write_jabber('./models/initial_ligandmap.pdb')
예제 #3
0
def match_residue(name1, name2):
    """
    Match residues of two pdbs, similar to bb.match_residue, but better with biopython
    """

    # Import structures
    R1 = bb.Molecule()
    R2 = bb.Molecule()
    
    R1.import_pdb(name1) 
    R2.import_pdb(name2)

    # Assign atomtypes just in case
    R1.assign_atomtype()
    R2.assign_atomtype()

    # we need to align to the pdb with more residues (otherwise we might get funky matching answers)
    # check the length of each first
    R1_CA = R1.atomselect("*", "*", "CA", get_index=True)[1]
    R2_CA = R2.atomselect("*", "*", "CA", get_index=True)[1]

    if len(R1_CA) > len(R2_CA):
        # get alignment
        ali = get_alignment(R1, R2)
        R1_seq, lines, R2_seq = ali.split('\n')[:3]
    else:
        ali = get_alignment(R2, R1)
        R2_seq, lines, R1_seq = ali.split('\n')[:3]

    # now only get resid matches which works for both
    matches = np.asarray(["|" in a for a in lines])

    matches1 = condense_sequence(R1_seq, matches)
    matches2 = condense_sequence(R2_seq, matches)

    # need to match where there is a line and a letter in each
    return matches1, matches2
예제 #4
0
logger = logging.getLogger("dipole")
fh = logging.FileHandler(logname)
ch = logging.StreamHandler()
logger.addHandler(fh)
logger.addHandler(ch)

if not args["v"]:
    logger.setLevel(logging.DEBUG)
else:
    logger.setLevel(logging.INFO)

logger.info("> Loading in files...")

R = jd.Dipole()
L = jd.Dipole()
L_pdb = bb.Molecule()

R.import_dipole(receptor_tcl)
L.import_dipole(ligand_tcl)
L_pdb.import_pdb(ligand_pdb)
data = np.loadtxt(data_file)

COM = L_pdb.get_center()

S = []
no_samples = np.shape(data)[0]

logger.info("> Assessing the dipole alignment...")

for i in range(no_samples):
예제 #5
0
else:
    logger.setLevel(logging.INFO)

logger.info(cmd_output)

# Run error checks if time is too short / long
if time_start >= time_end:
    raise Exception('ERROR: time_end must be at least 1 frame more than time_start')

if time_end != -1:
    time_end += 1 # shift by 1 to account for python counting

# Begin building grid map
logger.info("> Building the voxel map...")

M = bb.Molecule()
M.import_pdb(pdb)

window_size = vox * width # resolution, in angstroms
crds = M.coordinates[time_start:time_end, :]

if ac == 1:
    M_pqr = M.pdb2pqr(ff=ff)
else:
    M_pqr = M.pdb2pqr(ff=ff, amber_convert=False)

M.assign_atomtype()
mass = M.get_mass_by_atom()

# Find the max / min boundaries of our box and add buffer regions to use desired resolutions and get a complete picture
maxmin = []
예제 #6
0
    def __init__(self, params):

        self.params = params

        print("\n> Input DATA:")
        print(">> protein receptor: %s" % params.receptor)
        print(">> ligand: %s" % params.ligand)

        #import protein structures - get receptor and ligand
        print(">> importing PDB files...")
        self.M1 = bb.Molecule()
        self.M2 = bb.Molecule()
        self.M1.import_pdb(params.receptor)
        self.M2.import_pdb(params.ligand)

        print(">> importing density files...")
        self.E2 = bb.Density()
        self.E2._import_dx(params.ligand_map)
        self.E1 = bb.Density()
        self.E1._import_dx(params.receptor_map)

        # Import dipole maps to get initial positions (if necessary)
        if params.receptor_dip != 'None':

            if not os.path.isfile(params.receptor_dip):
                raise Exception("ERROR: receptor tcl file %s not found!" %
                                params.receptor_dip)
                sys.exit(0)
            if not os.path.isfile(params.ligand_dip):
                raise Exception("ERROR: ligand tcl file %s not found!" %
                                params.ligand_dip)
                sys.exit(0)
            self.D1 = jd.Dipole()
            self.D1.import_dipole(params.receptor_dip)
            self.D2 = jd.Dipole()
            self.D2.import_dipole(params.ligand_dip)
            dip = True

        else:
            dip = False

        # Build the jabber maps so we save computation time (essentially just the chosen isosurface from dx)
        self.J1 = jd.Jabber(params.receptor_map, params.iso_cutoff)
        self.J2 = jd.Jabber(params.ligand_map, params.iso_cutoff)

        # move the structures to the geometric center (so they're overlapping)
        trans_M1 = deepcopy(self.M1.get_center())
        trans_M2 = deepcopy(self.M2.get_center())

        self.M1.translate(-trans_M1[0], -trans_M1[1], -trans_M1[2])
        self.M2.translate(-trans_M2[0], -trans_M2[1], -trans_M2[2])
        jd.geometry.translate_map(self.E1, -trans_M1[0], -trans_M1[1],
                                  -trans_M1[2])
        jd.geometry.translate_map(self.E2, -trans_M2[0], -trans_M2[1],
                                  -trans_M2[2])
        self.J1.translate(-trans_M1)
        self.J2.translate(-trans_M2)
        if dip:
            self.D1.translate_dipole(-trans_M1)
            self.D2.translate_dipole(-trans_M2)
            self.D1.write_dipole('./models/initial_%s' % (params.receptor_dip))
            self.D2.write_dipole('./models/initial_%s' % (params.ligand_dip))

        self.E1.write_dx('./models/initial_%s' % (params.receptor_map))
        self.E2.write_dx('./models/initial_%s' % (params.ligand_map))
        self.M1.write_pdb('./models/initial_%s' % (params.receptor))
        self.M2.write_pdb('./models/initial_%s' % (params.ligand))
        self.J1.write_jabber('./models/initial_receptormap.pdb')
        self.J2.write_jabber('./models/initial_ligandmap.pdb')