Ejemplo n.º 1
0
def homologousonePointcrossover(eaObj, inParent):
    similarpoints = []  # Creating a list to store points with similar angles found
    randParent = Pose()

    # Searching for similar angles
    while (len(similarpoints) == 0):
        randParent.assign(randomParent(eaObj, inParent))
        for i in range(1, inParent.pose.size()):
            if((inParent.pose.phi(i) == randParent.phi(i)) and
                (inParent.pose.psi(i) == randParent.psi(i)) and
                    (inParent.pose.omega(i) == randParent.omega(i))):
                similarpoints.append(i)

    child = Pose()
    child.assign(inParent.pose)

    # Now we select a random point from the list of points that had similar angles as our crossOverPoint
    crossOverPoint = random.choice(similarpoints)

    # We should switch the values from the parents
    for residue in range(1, crossOverPoint):
        Pose.replace_residue(
            child, residue, Pose.residue(randParent, residue), True)

    inParent.pose.assign(child)
Ejemplo n.º 2
0
def get_NGL_selection_from_AtomID(pose: pyrosetta.Pose,
                                  atom_id: pyrosetta.AtomID):
    pose_resi = atom_id.rsd()
    residue = pose.residue(pose_resi)
    atom_name = residue.atom_name(atom_id.atomno()).strip()
    pdb_resi, chain = pose.pdb_info().pose2pdb(pose_resi).strip().split()
    return f'[{residue.name3().strip()}]{pdb_resi}:{chain}.{atom_name}'
Ejemplo n.º 3
0
    def make_mutant(self,
                    pose: pyrosetta.Pose,
                    mutation: str,
                    chain='A') -> pyrosetta.Pose:
        """
        Make a point mutant (``A23D``).

        :param pose: pose
        :param mutation:
        :param chain:
        :return:
        """
        mutant = pose.clone()
        pose2pdb = pose.pdb_info().pdb2pose
        rex = re.match('(\w)(\d+)(\w)', mutation)
        r = pose2pdb(res=int(rex.group(2)), chain=chain)
        rn = pose.residue(r).name1()
        assert rn == rex.group(
            1
        ), f'residue {r}(pose)/{rex.group(2)}(pdb) is a {rn}, not a {rex.group()}'
        MutateResidue = pyrosetta.rosetta.protocols.simple_moves.MutateResidue
        MutateResidue(target=r,
                      new_res=self._name3[rex.group(3)]).apply(mutant)
        self.relax_around_mover(mutant,
                                int(rex.group(2)),
                                chain,
                                distance=12,
                                cycles=15)
        return mutant
Ejemplo n.º 4
0
    def movement(self, original: pyrosetta.Pose, resi: int, chain: str, distance: int,
                 trials: int = 50, temperature: int = 1.0, replicate_number: int = 10):
        """
        This method adapted from a notebook of mine, but not from an official source, is not well written.
        It should be a filter and score combo.

        It returns the largest bb_rmsd of the pdb residue resi following backrub.
        """
        # this code is experimental

        n = self.get_neighbour_vector(pose=original, resi=resi, chain=chain, distance=distance,
                                      own_chain_only=False)
        # resi
        if chain is None:  # pose numbering.
            target_res = resi
        else:
            target_res = original.pdb_info().pdb2pose(chain=chain, res=resi)
        # prep
        rv = pyrosetta.rosetta.core.select.residue_selector.ResidueVector(n)
        backrub = pyrosetta.rosetta.protocols.backrub.BackrubMover()
        backrub.set_pivot_residues(rv)
        # https://www.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/Movers/movers_pages/GenericMonteCarloMover
        monégasque = pyrosetta.rosetta.protocols.monte_carlo.GenericMonteCarloMover(maxtrials=trials,
                                                                                    max_accepted_trials=trials,
                                                                                    # gen.max_accepted_trials() = 0
                                                                                    task_scaling=5,
                                                                                    # gen.task_scaling()
                                                                                    mover=backrub,
                                                                                    temperature=temperature,
                                                                                    sample_type='low',
                                                                                    drift=True)
        monégasque.set_scorefxn(self.scorefxn)
        # monégasque.add_filter(filters , False , 0.005 , 'low'  , True )
        # define the first 4 atoms (N C CA O)
        am = pyrosetta.rosetta.utility.vector1_unsigned_long(4)
        for i in range(1, 5):
            am[i] = i
        # find most deviant
        best_r = 0
        for i in range(replicate_number):
            variant = original.clone()
            monégasque.apply(variant)
            if monégasque.accept_counter() > 0:
                variant = monégasque.last_accepted_pose()  # pretty sure redundant
                # bb_rmsd is all residues: pyrosetta.rosetta.core.scoring.bb_rmsd(pose, ori)
                r = pyrosetta.rosetta.core.scoring.residue_rmsd_nosuper(variant.residue(target_res),
                                                                        original.residue(target_res), am)
                if r > best_r:
                    best_r = r
        return best_r
 def add_cst(self, pose: pyrosetta.Pose,
             res_i: int, atm_i: str, res_j: int, atm_j: str,
             distance: float = 2.4,
             sigma: float = 0.1) \
         -> pyrosetta.rosetta.core.scoring.constraints.AtomPairConstraint:
     AtomID = pyrosetta.rosetta.core.id.AtomID
     id_i = AtomID(pose.residue(res_i).atom_index(atm_i), res_i)
     id_j = AtomID(pose.residue(res_j).atom_index(atm_j), res_j)
     ijfunc = pyrosetta.rosetta.core.scoring.constraints.BoundFunc(
         0.0, distance, sigma, 'cst1')
     cst_ij = pyrosetta.rosetta.core.scoring.constraints.AtomPairConstraint(
         id_i, id_j, ijfunc)
     pose.add_constraint(cst_ij)
     return cst_ij
Ejemplo n.º 6
0
def add_bfactor_from_score(pose: pyrosetta.Pose):
    """
    Adds the bfactors from total_score.
    Snippet for testing in Jupyter

    >>> import nglview as nv
    >>> view = nv.show_rosetta(pose)
    >>> # view = nv.show_file('test.cif')
    >>> view.clear_representations()
    >>> view.add_tube(radiusType="bfactor", color="bfactor", radiusScale=0.10, colorScale="RdYlBu")
    >>> view

    ``replace_res_remap_bfactors`` may have been a cleaner strategy. This was quicker to write.

    If this fails, it may be because the pose was not scored first.
    """
    if pose.pdb_info().obsolete():
        raise ValueError(
            'Pose pdb_info is flagged as obsolete (change `pose.pdb_info().obsolete(False)`)'
        )
    # scores
    energies = pose.energies()

    def get_res_score(res):
        total_score = pyrosetta.rosetta.core.scoring.ScoreType.total_score
        # if pose.residue(res).is_polymer()
        try:
            return energies.residue_total_energies(res)[total_score]
        except:
            return float('nan')

    # the array goes from zero (nan) to n_residues
    total_scores = np.array(
        [float('nan')] +
        [get_res_score(res) for res in range(1,
                                             pose.total_residue() + 1)])
    mask = np.isnan(total_scores)
    total_scores -= np.nanmin(total_scores)
    total_scores *= 100 / np.nanmax(total_scores)
    total_scores = np.nan_to_num(total_scores, nan=100)
    total_scores[mask] = 0.
    # add to pose
    pdb_info = pose.pdb_info()
    for res in range(pose.total_residue()):
        for i in range(pose.residue(res + 1).natoms()):
            pdb_info.bfactor(res + 1, i + 1, total_scores[res + 1])
Ejemplo n.º 7
0
def pose2pandas(pose: pyrosetta.Pose,
                scorefxn: pyrosetta.ScoreFunction) -> pd.DataFrame:
    """
    Return a pandas dataframe from the scores of the pose

    :param pose:
    :return:
    """
    pose.energies().clear_energies()
    scorefxn(pose)
    scores = pd.DataFrame(pose.energies().residue_total_energies_array())
    pi = pose.pdb_info()
    scores['residue'] = scores.index.to_series() \
        .apply(lambda r: pose.residue( r +1) \
               .name1() + pi.pose2pdb( r +1)
               )
    return scores
Ejemplo n.º 8
0
 def __init__(self, mutation_name: str, chain: str, pose: pyrosetta.Pose):
     self.mutation = self.parse_mutation(mutation_name)
     rex = re.match('(\w)(\d+)(\w)', self.mutation)
     self.pdb_resi = int(rex.group(2))
     self.chain = chain
     self.from_resn1 = rex.group(1)
     self.from_resn3 = self._name3[rex.group(1)]
     self.to_resn1 = rex.group(3)
     self.to_resn3 = self._name3[rex.group(3)]
     pose2pdb = pose.pdb_info().pdb2pose
     self.pose_resi = pose2pdb(res=self.pdb_resi, chain=self.chain)
     if self.pose_resi != 0:
         self.pose_residue = pose.residue(self.pose_resi)
         self.pose_resn1 = self.pose_residue.name1()
         self.pose_resn3 = self.pose_residue.name3()
     else:
         self.pose_residue = None
         self.pose_resn1 = None
         self.pose_resn3 = None
Ejemplo n.º 9
0
def input_silent_score_seq(filename):
    hbond_list = {}
    torsion_list = {}
    score_list = {}
    seq_list = {}
    #  sfd=SilentFileData()
    sfd = SilentFileData(SilentFileOptions())
    sfd.read_file(filename)
    p = Pose()
    sf_tags = sfd.tags()
    for tag in sf_tags:
        silent_struct = sfd.get_structure(tag)
        silent_struct.fill_pose(p)
        en = silent_struct.energies()[1]
        score_list[tag] = en.value()
        seq_list[tag] = [p.residue(i).name() for i in range(1, p.size() + 1)]
        torsion_list[tag] = get_torsions(p)
        hbond_list[tag] = find_hbonds(p)
    return torsion_list, hbond_list, score_list, seq_list
Ejemplo n.º 10
0
def twoPointcrossover(eaObj, inParent):
    randParent = Pose()
    randParent.assign(randomParent(eaObj, inParent))

    crossOverPoint1 = randint(1, inParent.pose.size())
    crossOverPoint2 = randint(1, inParent.pose.size())
    # the first crossover point should be smaller than the second one.
    while(crossOverPoint1 >= crossOverPoint2):
        crossOverPoint1 = randint(1, inParent.pose.size())
        crossOverPoint2 = randint(1, inParent.pose.size())

    # The crossover'd child
    child = Pose()
    child.assign(inParent.pose)

    # We switch the values between the two crossover points with values from the random parent
    for residue in range(crossOverPoint1, crossOverPoint2):
        Pose.replace_residue(
            child, residue, Pose.residue(randParent, residue), True)

    inParent.pose.assign(child)
Ejemplo n.º 11
0
def onePointcrossover(eaObj, inParent):
    # Get random parent from population, ensure that we didn't get the same one.
    randParent = Pose()
    randParent.assign(randomParent(eaObj, inParent))

    # Pick a random point in the sequence of the strand of amino acids to crossover
    crossOverPoint = randint(1, inParent.pose.size())

    # Create a new pose to be crossover'd by the two parents
    child = Pose()
    child.assign(inParent.pose)

    """
    We iterate through the size of the crossover point (since we already have one of the parents copied)
    one by one until the offspring has reached it's crossoverpoint and we should have a fully newborn
    offspring by the end of the loop.
    """
    for residue in range(1, crossOverPoint):
        Pose.replace_residue(
            child, residue, Pose.residue(randParent, residue), True)

    inParent.pose.assign(child)
Ejemplo n.º 12
0
def pose_from_sequence( seq , res_type = 'fa_standard' , name = '' , chain_id = 'A' ):
    """
    Returns a pose generated from amino acid single letters in  <seq>  using
    the  <res_type>  ResidueType, the new pose's PDBInfo is named  <name>
    and all residues have chain ID  <chain_id>

    example:
        pose=pose_from_sequence('LIGAND')
    See also:
        Pose
        make_pose_from_sequence
        pose_from_file
        pose_from_rcsb
    """
    pose=Pose()
    make_pose_from_sequence(pose,seq,res_type)
    #pdb_info = rosetta.core.pose.PDBInfo(pose.total_residue())    # actual, for other code
    pdb_info = PDBInfo(pose.total_residue())    # create a PDBInfo object
    for i in range(0,pose.total_residue()):
        if pose.residue(i+1).is_protein():
            # set to a more reasonable default
            pose.set_phi(i+1,-150)
            pose.set_psi(i+1,150)
            pose.set_omega(i+1,180)
            # set PDBInfo info for chain and number
        #pdb_info.chain(i+1,chain_id)
        #pdb_info.number(i+1,i+1)
    #### you can alternatively use the deprecated method set_extended_torsions
    ####    which requires a Pose and a Loop object...so make a large loop
    #set_extended_torsions( pose , Loop ( 1 , pose.total_residue() ) )
    # set the PDBInfo
    pose.pdb_info(pdb_info)
    # default name to first 3 letters
    if not name:
        name = seq[:4]
    pose.pdb_info().name(name)
#	print pose
    return pose
Ejemplo n.º 13
0
ATOM      8  HA  SER A   1       4.525   0.411  -1.793  1.00  0.00           H
ATOM      9 1HB  SER A   1       4.783   1.209  -4.524  1.00  0.00           H
ATOM     10 2HB  SER A   1       5.814   1.615  -3.161  1.00  0.00           H
ATOM     11  HG  SER A   1       6.258  -0.895  -3.881  1.00  0.00           H
HETATM   12  CV  A__ A   2       3.512  -1.512  -7.034  1.00  0.00           X
HETATM   13  NZ  A__ A   2       4.049  -1.531  -5.683  1.00  0.00           N
HETATM   14 1HZ  A__ A   2       4.411  -0.616  -5.451  1.00  0.00           H
HETATM   15 2HZ  A__ A   2       3.316  -1.777  -5.031  1.00  0.00           H
HETATM   16 3HZ  A__ A   2       4.794  -2.211  -5.622  1.00  0.00           H
TER
CONECT   12   13
CONECT   13   12   14   15   16
CONECT   14   13
CONECT   15   13
CONECT   16   13
"""

pose = Pose()
pose_from_pdbstring(pose, contents)

sc_donor = {
    1: [pick_ray(pose.residue(1), "HG", "OG")],
    2: [
        pick_ray(pose.residue(2), "1HZ", "NZ"),
        pick_ray(pose.residue(2), "2HZ", "NZ"),
        pick_ray(pose.residue(2), "3HZ", "NZ")
    ]
}

sc_acceptor = {1: [pick_ray(pose.residue(1), "OG", "CB")]}
Ejemplo n.º 14
0
TER
CONECT    1    2
CONECT    2    1    3    4
CONECT    3    2
CONECT    4    2
CONECT    5    6
CONECT    6    5    7    8
CONECT    7    6
CONECT    8    6    9   10
CONECT    9    8
CONECT   10    8
"""

pose = Pose()
pose_from_pdbstring(pose, contents)

sc_donor = {
    2: [
        pick_ray(pose.residue(2), "1HD2", "ND2"),
        pick_ray(pose.residue(2), "2HD2", "ND2")
    ]
}

sc_acceptor = {
    1: [
        pick_ray(pose.residue(1), "OE1", "CD"),
        pick_ray(pose.residue(1), "OE2", "CD")
    ],
    2: [pick_ray(pose.residue(2), "OD1", "CG")]
}
Ejemplo n.º 15
0
def calc_binding_energy(pose, scorefxn, center, cutoff=8.0):
    # create a copy of the pose for manipulation
    test_pose = Pose()
    test_pose.assign(pose)

    # setup packer options
    # the sidechain conformations of residues "near the interface", defined as
    #    within  <cutoff>  Angstroms of an interface residue, may change and
    #    must be repacked, if all residues are repacked, aberrant sidechain
    #    conformations near the interface, but independent of complex
    #    interactions, will be repacked for the mutant and wild-type structures
    #    preventing them from adding noise to the score difference
    # this method of setting up a PackerTask is different from packer_task.py
    tf = standard_task_factory()  # create a TaskFactory
    tf.push_back(core.pack.task.operation.RestrictToRepacking()
                 )  # restrict it to repacking

    # this object contains repacking options, instead of turning the residues
    #    "On" or "Off" directly, this will create an object for these options
    #    and assign it to the TaskFactory
    prevent_repacking = core.pack.task.operation.PreventRepacking()

    # the "center" (nbr_atom) of the mutant residue, for distance calculation
    center = test_pose.residue(center).nbr_atom_xyz()
    for i in range(1, test_pose.total_residue() + 1):
        # the .distance_squared method is (a little) lighter than .norm
        # if the residue is further than <cutoff> Angstroms away, do not repack
        if center.distance_squared(
                test_pose.residue(i).nbr_atom_xyz()) > cutoff**2:
            prevent_repacking.include_residue(i)

    # apply these settings to the TaskFactory
    tf.push_back(prevent_repacking)

    # setup a PackRotamersMover
    packer = protocols.minimization_packing.PackRotamersMover(scorefxn)
    packer.task_factory(tf)

    #### create a Mover for performing translation
    #### RigidBodyTransMover is SUPPOSED to translate docking partners of a
    ####    pose based on an axis and magnitude
    #### test it using the PyMOLMover, it does not perform a simple translation
    ####    I also observed a "Hbond Tripped" error when packing after applying
    ####    the Mover, it appears to store inf and NaN values into hbonds
    #transmover = RigidBodyTransMover()
    # calc_interaction_energy separates the chains by 500.0 Angstroms,
    #    so does this Mover
    # if using this Mover, the step_size MUST be a float
    # if this setting is left to default, it will move the proteins
    #    VERY far apart
    #transmover.step_size( 5.0 )

    # repack the test_pose
    packer.apply(test_pose)

    # score this structure
    before = scorefxn(test_pose)

    # separate the docking partners
    #### since RigidBodyTransMover DOES NOT WORK, it is not used
    #transmover.apply(test_pose)

    # here are two methods for applying a translation onto a pose structure
    # both require an xyzVector
    xyz = rosetta.numeric.xyzVector_double_t()  # a Vector for coordinates
    xyz.x = 500.0  # arbitrary separation magnitude, in the x direction
    xyz.y = 0.0  #...I didn't have this and it defaulted to 1e251...?
    xyz.z = 0.0  #...btw thats like 1e225 light years,
    #    over 5e245 yrs at Warp Factor 9.999 (thanks M. Pacella)

    #### here is a hacky method for translating the downstream partner of a
    #    pose protein-protein complex (must by two-body!)
    chain2starts = len(pose.chain_sequence(1)) + 1
    for r in range(chain2starts, test_pose.total_residue() + 1):
        for a in range(1, test_pose.residue(r).natoms() + 1):
            test_pose.residue(r).set_xyz(a, test_pose.residue(r).xyz(a) + xyz)

    # here is an elegant way to do it, it assumes that jump number 1
    #    defines the docking partners "connectivity"
    # the pose.jump method returns a jump object CREATED from the pose jump
    #    data, the pose itself does not own a Jump object, thus you can use
    #    Jump methods, such as pose.jump(1).set_translation, however the object
    #    has not been properly constructed for manipulation, thus performing
    #    a change does not cause any problems, but is not permanently applied
    #translate = test_pose.jump( 1 )    # copy this information explicitly
    # adjust its translation via vector addition
    #translate.set_translation( translate.get_translation() + xyz )
    #test_pose.set_jump( 1 , translate )
    # as explained above, this call will NOT work
    #test_pose.jump(1).set_translation( test_pose.get_translation() + xyz )

    # repack the test_pose after separation
    packer.apply(test_pose)

    # return the change in score
    return before - scorefxn(test_pose)
Ejemplo n.º 16
0
ATOM     30  O   ALA A   3       8.260   5.868   1.023  1.00  0.00           O
ATOM     31  OXT ALA A   3       8.596   5.737  -1.023  1.00  0.00           O
ATOM     32  CB  ALA A   3       8.190   3.050  -1.199  1.00  0.00           C
ATOM     33  H   ALA A   3       5.710   4.705  -0.000  1.00  0.00           H
ATOM     34  HA  ALA A   3       7.999   3.333   0.913  1.00  0.00           H
ATOM     35 1HB  ALA A   3       9.280   3.059  -1.185  1.00  0.00           H
ATOM     36 2HB  ALA A   3       7.835   2.021  -1.154  1.00  0.00           H
ATOM     37 3HB  ALA A   3       7.835   3.516  -2.117  1.00  0.00           H
TER
"""

pose = Pose()
pose_from_pdbstring(pose, contents)

n_rays = {
    1: pick_ray(pose.residue(1), "1H", "N"),
    3: pick_ray(pose.residue(3), "H", "N")
}

c_rays = {
    1: pick_ray(pose.residue(1), "O", "C"),
    2: pick_ray(pose.residue(2), "O", "C"),
    3: pick_ray(pose.residue(3), "O", "C")
}

sc_donor = {}

sc_acceptor = {}

cat_pi = []
Ejemplo n.º 17
0
CONECT    1    2
CONECT    2    1    3    4    5
CONECT    3    2
CONECT    4    2
CONECT    5    2
CONECT    6    7
CONECT    7    6    8    9
CONECT    8    7
CONECT    9    7   10   11
CONECT   10    9
CONECT   11    9

"""

pose = Pose()
pose_from_pdbstring(pose, contents)

sc_donor = {
    1: [
        pick_ray(pose.residue(1), "1HZ", "NZ"),
        pick_ray(pose.residue(1), "2HZ", "NZ"),
        pick_ray(pose.residue(1), "3HZ", "NZ")
    ],
    2: [
        pick_ray(pose.residue(2), "1HD2", "ND2"),
        pick_ray(pose.residue(2), "2HD2", "ND2")
    ]
}

sc_acceptor = {2: [pick_ray(pose.residue(2), "OD1", "CG")]}
Ejemplo n.º 18
0
HETATM    9 3HZ  A__ A   2       5.292  -0.607  -4.650  1.00  0.00           H
TER
CONECT    1    2
CONECT    2    1    3    4
CONECT    3    2
CONECT    4    2
CONECT    5    6
CONECT    6    5    7    8    9
CONECT    7    6
CONECT    8    6
CONECT    9    6
"""

pose = Pose()
pose_from_pdbstring(pose, contents)

sc_donor = {
    2: [
        pick_ray(pose.residue(2), "1HZ", "NZ"),
        pick_ray(pose.residue(2), "2HZ", "NZ"),
        pick_ray(pose.residue(2), "3HZ", "NZ")
    ]
}

sc_acceptor = {
    1: [
        pick_ray(pose.residue(1), "OE1", "CD"),
        pick_ray(pose.residue(1), "OE2", "CD")
    ]
}
Ejemplo n.º 19
0
CONECT    9    8   10   11
CONECT   10    9   13   14
CONECT   11    9   15   16
CONECT   12    8
CONECT   13   10
CONECT   14   10
CONECT   15   11
CONECT   16   11
"""

pose = Pose()
pose_from_pdbstring(pose, contents)

sc_donor = {
    1: [
        pick_ray(pose.residue(1), "1HD2", "ND2"),
        pick_ray(pose.residue(1), "2HD2", "ND2")
    ],
    2: [
        pick_ray(pose.residue(2), "HE", "NE"),
        pick_ray(pose.residue(2), "1HH1", "NH1"),
        pick_ray(pose.residue(2), "2HH1", "NH1"),
        pick_ray(pose.residue(2), "1HH2", "NH2"),
        pick_ray(pose.residue(2), "2HH2", "NH2")
    ]
}

sc_acceptor = {
    1: [
        pick_ray(pose.residue(1), "OD1", "CG")
    ]
Ejemplo n.º 20
0
ATOM      5  N   SER A   2       7.756  -0.439  -5.359  1.00  0.00           N
ATOM      6  CA  SER A   2       7.794  -1.267  -4.159  1.00  0.00           C
ATOM      7  C   SER A   2       7.667  -0.419  -2.900  1.00  0.00           C
ATOM      8  O   SER A   2       8.086   0.738  -2.875  1.00  0.00           O
ATOM      9  CB  SER A   2       9.083  -2.064  -4.116  1.00  0.00           C
ATOM     10  OG  SER A   2       9.881  -1.788  -5.234  1.00  0.00           O
ATOM     11  H   SER A   2       8.106   0.507  -5.315  1.00  0.00           H
ATOM     12  HA  SER A   2       6.952  -1.961  -4.191  1.00  0.00           H
ATOM     13 1HB  SER A   2       9.630  -1.821  -3.206  1.00  0.00           H
ATOM     14 2HB  SER A   2       8.852  -3.128  -4.084  1.00  0.00           H
ATOM     15  HG  SER A   2       9.394  -1.147  -5.756  1.00  0.00           H
TER
CONECT    1    2
CONECT    2    1    3    4
CONECT    3    2
CONECT    4    2
"""

pose = Pose()
pose_from_pdbstring(pose, contents)

sc_donor = {2: [pick_ray(pose.residue(2), "HG", "OG")]}

sc_acceptor = {
    1: [
        pick_ray(pose.residue(1), "OE1", "CD"),
        pick_ray(pose.residue(1), "OE2", "CD")
    ],
    2: [pick_ray(pose.residue(2), "OG", "CB")]
}
Ejemplo n.º 21
0
ATOM     33  O   ALA A   3       8.260   5.868   1.023  1.00  0.00           O
ATOM     34  OXT ALA A   3       8.596   5.737  -1.023  1.00  0.00           O
ATOM     35  CB  ALA A   3       8.190   3.050  -1.199  1.00  0.00           C
ATOM     36  H   ALA A   3       5.710   4.705  -0.000  1.00  0.00           H
ATOM     37  HA  ALA A   3       7.999   3.333   0.913  1.00  0.00           H
ATOM     38 1HB  ALA A   3       9.280   3.059  -1.185  1.00  0.00           H
ATOM     39 2HB  ALA A   3       7.835   2.021  -1.154  1.00  0.00           H
ATOM     40 3HB  ALA A   3       7.835   3.516  -2.117  1.00  0.00           H
TER
"""

pose = Pose()
pose_from_pdbstring(pose, contents)

n_rays = {
    1: pick_ray(pose.residue(1), "1H", "N"),
    2: pick_ray(pose.residue(2), "H", "N"),
    3: pick_ray(pose.residue(3), "H", "N")
}

c_rays = {
    1: pick_ray(pose.residue(1), "O", "C"),
    2: pick_ray(pose.residue(2), "O", "C"),
    3: pick_ray(pose.residue(3), "O", "C")
}

sc_donor = {
    2: [
        pick_ray(pose.residue(2), "HE2", "NE2")
    ]
}
Ejemplo n.º 22
0
ATOM     28  O   ALA A   3       8.260   5.868   1.023  1.00  0.00           O
ATOM     29  OXT ALA A   3       8.596   5.737  -1.023  1.00  0.00           O
ATOM     30  CB  ALA A   3       8.190   3.050  -1.199  1.00  0.00           C
ATOM     31  H   ALA A   3       5.710   4.705  -0.000  1.00  0.00           H
ATOM     32  HA  ALA A   3       7.999   3.333   0.913  1.00  0.00           H
ATOM     33 1HB  ALA A   3       9.280   3.059  -1.185  1.00  0.00           H
ATOM     34 2HB  ALA A   3       7.835   2.021  -1.154  1.00  0.00           H
ATOM     35 3HB  ALA A   3       7.835   3.516  -2.117  1.00  0.00           H
TER
"""

pose = Pose()
pose_from_pdbstring(pose, contents)

n_rays = {
    1: pick_ray(pose.residue(1), "1H", "N"),
    2: pick_ray(pose.residue(2), "H", "N"),
    3: pick_ray(pose.residue(3), "H", "N")
}

c_rays = {
    1: pick_ray(pose.residue(1), "O", "C"),
    2: pick_ray(pose.residue(2), "O", "C"),
    3: pick_ray(pose.residue(3), "O", "C")
}

sc_donor = { }

sc_acceptor = {
    2: [
        pick_ray(pose.residue(2), "OD1", "CG"),
Ejemplo n.º 23
0
ATOM     37  O   ALA A   3       8.260   5.868   1.023  1.00  0.00           O
ATOM     38  OXT ALA A   3       8.596   5.737  -1.023  1.00  0.00           O
ATOM     39  CB  ALA A   3       8.190   3.050  -1.199  1.00  0.00           C
ATOM     40  H   ALA A   3       5.710   4.705  -0.000  1.00  0.00           H
ATOM     41  HA  ALA A   3       7.999   3.333   0.913  1.00  0.00           H
ATOM     42 1HB  ALA A   3       9.280   3.059  -1.185  1.00  0.00           H
ATOM     43 2HB  ALA A   3       7.835   2.021  -1.154  1.00  0.00           H
ATOM     44 3HB  ALA A   3       7.835   3.516  -2.117  1.00  0.00           H
TER
"""

pose = Pose()
pose_from_pdbstring(pose, contents)

n_rays = {
    1: pick_ray(pose.residue(1), "1H", "N"),
    2: pick_ray(pose.residue(2), "H", "N"),
    3: pick_ray(pose.residue(3), "H", "N")
}

c_rays = {
    1: pick_ray(pose.residue(1), "O", "C"),
    2: pick_ray(pose.residue(2), "O", "C"),
    3: pick_ray(pose.residue(3), "O", "C")
}

sc_donor = {2: [pick_ray(pose.residue(2), "HH", "OH")]}

sc_acceptor = {2: [pick_ray(pose.residue(2), "OH", "CZ")]}

cat_pi = [(pick_ray(pose.residue(2), "CE1",
Ejemplo n.º 24
0
dump_pdb(pose, "T110_Basic._.pdb")

print('accessing pose attributes')
print(pose)
# TODO: remove extra blank lines at end
print('there are ', pose.total_residue(), 'residues in this pose object')
print('phi of residue 5 is ', pose.phi(5))
print('psi of residue 5 is ', pose.psi(5))

print('set phi of residue 5 to -60')
pose.set_phi(1, -60)
print('set psi of residue 5 to -50')
pose.set_psi(1, -50)

print('accessing residue 5 from pose')
res5 = pose.residue(5)
print(res5)

print('accessing atoms from residue 5')
at5N = res5.atom('N')
at5CA = res5.atom("CA")
at5C = res5.atom("C")

print(at5N)
# TODO: above should print atom type key not magic number
# 2/23/9: hm, not sure this is possible b/c atom does not know which AtomTypeSet to use!

print('xyz of at5N:', at5N.xyz().x, at5N.xyz().y, at5N.xyz().z)
print('norm of xyz at5N:', at5N.xyz().norm)

print(res5.atoms())  # <-- Still missing
Ejemplo n.º 25
0
ATOM     20 2HB  SER A   2       3.626  -3.951  -6.042  1.00  0.00           H
ATOM     21  HG  SER A   2       3.450  -3.695  -3.412  1.00  0.00           H
TER
CONECT    1    2
CONECT    2    1    3    6
CONECT    3    2    4    5
CONECT    4    3    7    8
CONECT    5    3    9   10
CONECT    6    2
CONECT    7    4
CONECT    8    4
CONECT    9    5
CONECT   10    5
"""

pose = Pose()
pose_from_pdbstring(pose, contents)

sc_donor = {
    1: [
        pick_ray(pose.residue(1), "HE", "NE"),
        pick_ray(pose.residue(1), "1HH1", "NH1"),
        pick_ray(pose.residue(1), "2HH1", "NH1"),
        pick_ray(pose.residue(1), "1HH2", "NH2"),
        pick_ray(pose.residue(1), "2HH2", "NH2")
    ],
    2: [pick_ray(pose.residue(2), "HG", "OG")]
}

sc_acceptor = {2: [pick_ray(pose.residue(2), "OG", "CB")]}
Ejemplo n.º 26
0
CONECT    7    4
CONECT    8    4
CONECT    9    5
CONECT   10    5
CONECT   11   12
CONECT   12   11   13   14
CONECT   13   12
CONECT   14   12   15   16
CONECT   15   14
CONECT   16   14
"""

pose = Pose()
pose_from_pdbstring(pose, contents)

sc_donor = {
    1: [
        pick_ray(pose.residue(1), "HE", "NE"),
        pick_ray(pose.residue(1), "1HH1", "NH1"),
        pick_ray(pose.residue(1), "2HH1", "NH1"),
        pick_ray(pose.residue(1), "1HH2", "NH2"),
        pick_ray(pose.residue(1), "2HH2", "NH2")
    ],
    2: [
        pick_ray(pose.residue(2), "1HD2", "ND2"),
        pick_ray(pose.residue(2), "2HD2", "ND2")
    ]
}

sc_acceptor = {2: [pick_ray(pose.residue(2), "OD1", "CG")]}
Ejemplo n.º 27
0
ATOM     12  OG  SER A   2       4.273  -0.309  -4.595  1.00  0.00           O
ATOM     13  H   SER A   2       1.939  -0.680  -2.908  1.00  0.00           H
ATOM     14  HA  SER A   2       3.320   1.908  -2.627  1.00  0.00           H
ATOM     15 1HB  SER A   2       3.330   1.306  -5.420  1.00  0.00           H
ATOM     16 2HB  SER A   2       4.691   1.679  -4.374  1.00  0.00           H
ATOM     17  HG  SER A   2       3.848  -0.782  -3.875  1.00  0.00           H
TER
CONECT    1    2
CONECT    2    1    3    4
CONECT    3    2
CONECT    4    2    5    6
CONECT    5    4
CONECT    6    4
"""

pose = Pose()
pose_from_pdbstring(pose, contents)

sc_donor = {
    1: [
        pick_ray(pose.residue(1), "1HD2", "ND2"),
        pick_ray(pose.residue(1), "2HD2", "ND2")
    ],
    2: [pick_ray(pose.residue(2), "HG", "OG")]
}

sc_acceptor = {
    1: [pick_ray(pose.residue(1), "OD1", "CG")],
    2: [pick_ray(pose.residue(2), "OG", "CB")]
}
Ejemplo n.º 28
0
ATOM     40  O   ALA A   3       8.260   5.868   1.023  1.00  0.00           O
ATOM     41  OXT ALA A   3       8.596   5.737  -1.023  1.00  0.00           O
ATOM     42  CB  ALA A   3       8.190   3.050  -1.199  1.00  0.00           C
ATOM     43  H   ALA A   3       5.710   4.705  -0.000  1.00  0.00           H
ATOM     44  HA  ALA A   3       7.999   3.333   0.913  1.00  0.00           H
ATOM     45 1HB  ALA A   3       9.280   3.059  -1.185  1.00  0.00           H
ATOM     46 2HB  ALA A   3       7.835   2.021  -1.154  1.00  0.00           H
ATOM     47 3HB  ALA A   3       7.835   3.516  -2.117  1.00  0.00           H
TER
"""

pose = Pose()
pose_from_pdbstring(pose, contents)

n_rays = {
    1: pick_ray(pose.residue(1), "1H", "N"),
    2: pick_ray(pose.residue(2), "H", "N"),
    3: pick_ray(pose.residue(3), "H", "N")
}

c_rays = {
    1: pick_ray(pose.residue(1), "O", "C"),
    2: pick_ray(pose.residue(2), "O", "C"),
    3: pick_ray(pose.residue(3), "O", "C")
}

sc_donor = {
    2: [
        pick_ray(pose.residue(2), "HE", "NE"),
        pick_ray(pose.residue(2), "1HH1", "NH1"),
        pick_ray(pose.residue(2), "2HH1", "NH1"),
Ejemplo n.º 29
0
 def test_apply_pose(self):
     new_pose = Pose()
     new_pose.assign(self.pose)
     self.small_mv(new_pose)
     assert new_pose.residue(6).xyz(4) != self.pose.residue(6).xyz(4)
Ejemplo n.º 30
0
CONECT    6    5    7   10
CONECT    7    6    8    9
CONECT    8    7   11   12
CONECT    9    7   13   14
CONECT   10    6
CONECT   11    8
CONECT   12    8
CONECT   13    9
CONECT   14    9
"""

pose = Pose()
pose_from_pdbstring(pose, contents)

sc_donor = {
    2: [
        pick_ray(pose.residue(2), "HE", "NE"),
        pick_ray(pose.residue(2), "1HH1", "NH1"),
        pick_ray(pose.residue(2), "2HH1", "NH1"),
        pick_ray(pose.residue(2), "1HH2", "NH2"),
        pick_ray(pose.residue(2), "2HH2", "NH2")
    ]
}

sc_acceptor = {
    1: [
        pick_ray(pose.residue(1), "OE1", "CD"),
        pick_ray(pose.residue(1), "OE2", "CD")
    ]
}