コード例 #1
0
ファイル: crossover.py プロジェクト: codyb29/HEA
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)
コード例 #2
0
# TODO: rename pose_from_file or make_pose_from_sequence to be parallel

print('Building Pose from sequence...')
pose3 = pose_from_sequence("DSEEKFLRRIGRFGYGYGPYE", 'centroid')
print(pose3)

pose4 = pose_from_sequence("ARNDCEQGHILKMFPSTWYV", 'fa_standard')

print('Dump PDB...')
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")