Esempio n. 1
0
def Interface_axis(
        pose, dist, resmuts, score
):  ## return the interface rotation/translation axis and the center

    ## Compute interface at "dist" of distance and store:
    ## The contact_list=[i := contact of ith residue ]
    ## The interface_list= [[interface_1],[interface_2]]
    copy_pose = Pose()
    copy_pose.assign(pose)

    score(copy_pose)
    interface = Interface(1)
    interface.distance(dist)
    interface.calculate(copy_pose)
    contact = interface.contact_list()
    interface_residue = interface.pair_list()

    centroid_interface = []
    for interface in interface_residue:  ## Compute the axis by taking the whole interfaces.
        centroid_interface.append(
            centroid([
                copy_pose.residue(res).xyz('CA') for res in interface
            ]))  ## store the centroids of the residue in the interfaces.
    interface_axis = map(sub, centroid_interface[0], centroid_interface[1])
    center = centroid_interface[0]
    return (interface_axis, center)
    def get_interface_residues(self, chains,
            name=None):

        # We are going to only change jump 1, so we know which jump to look at
        # in the Interface class
        movable_jumps = vector1_int(1)
        # Now we can alter the fold tree such that the jump is between the
        # chains we care about
        # chains = left_chains + '_' + right_chains
        sfxn = create_score_function('ref2015')
        sfxn(self.pose)
        print('SETTING UP FOLD TREE FOR INTERFACE {}'.format(chains))
        setup_foldtree(self.pose, chains, movable_jumps)


        # Set up interface class
        interface = Interface(1)
        interface.distance(self.dist)
        interface.calculate(self.pose)

        if not name:
            name = self.pdbid

        # Logic for filtering out residues not on chains of interest
        interface_list = []
        # interface_resis = []
        for side in interface.pair_list():
            for resi in side:
                # Find out what chain the residue belongs to
                pdbinfo = self.pose.pdb_info().pose2pdb(resi)
                # resnum = pdbinfo.split(' ')[0]
                chain = pdbinfo.split(' ')[1]
                # Find out what chain the resiude is interacting with
                closest = interface.closest_interface_residue(self.pose,
                        resi, self.dist)
                interacting_chain = self.pose.pdb_info().pose2pdb(closest).split(' ')[1]
                interacting_resi = self.pose.pdb_info().pose2pdb(closest).split(' ')[0]
                # If both this chain and its partner are in the chains we care
                # about, do something with them (in this case I'm spitting out a
                # string that will let me select all the interface residues in
                # PyMOL as a sanity check, you'll obviously want to save these
                # to a dictionary or something)
                if chain in list(chains) and interacting_chain in list(chains):
                    # interface_resis.append(resi)
                    row = {'pdb': name,
                            'interface': chains,
                            'chain':chain,
                            'rosetta_resnum': resi,
                            'closest_chain': interacting_chain, 
                            'closest_rosetta_resnum': closest,
                            }
                            # 'closest_pdb_resnum': interacting_resi}
                            # 'pdb_resnum': resnum,
                    interface_list.append(row)

        return interface_list
def Interface_axis(
        pose, dist, resmuts, score
):  ## return the interface rotation/translation axis and the center

    ## Compute interface at "dist" of distance and store:
    ## The contact_list=[i := contact of ith residue ]
    ## The interface_list= [[interface_1],[interface_2]]
    copy_pose = Pose()
    copy_pose.assign(pose)
    setup_foldtree(copy_pose, "A_B", Vector1([1]))
    score(copy_pose)
    interface = Interface(1)
    interface.distance(dist)
    interface.calculate(copy_pose)
    contact = interface.contact_list()
    interface_residue = interface.pair_list()

    centroid_interface = []
    for interface in interface_residue:  ## Compute the axis by taking the whole interfaces. (Only for the native)
        centroid_interface.append(
            centroid([
                copy_pose.residue(res).xyz('CA') for res in interface
            ]))  ## store the centroids of the residue in the interfaces.
    interface_axis = map(sub, centroid_interface[0], centroid_interface[1])
    center = centroid_interface[0]

    ## If there is mutation. The axis change by moving to the centroid of mutable residue.
    if (len(resmuts) != 0 and len(interface_residue[1]) != 0
            and len(interface_residue[2]) != 0):
        centroid_muts = []  ## array for the mutables centroids
        centroid_flexs = [
        ]  ## array for the flexibles centroids i.e centroid of flexible 1, flexible 2 etc...
        for res in resmuts:  ## Calculate the centroid of flexibles of (of res in resnames)
            centroid_flexs.append(
                centroid([
                    copy_pose.residue(i).xyz("CA")
                    for i in sorted(list(set(contact[int(res)])))
                ]))
            centroid_muts.append(copy_pose.residue(int(res)).xyz("CA"))
        centroid_flex = centroid(
            centroid_flexs)  ## calculate the centroid of flexibles centroids
        centroid_mut = centroid(
            centroid_muts)  ## calculate the centroid of mutables
        interface_axis = [
            centroid_flex[0] - centroid_mut[0],
            centroid_flex[1] - centroid_mut[1],
            centroid_flex[2] - centroid_mut[2]
        ]  ## Calculate the axis
        center = centroid_mut
    return (interface_axis, center)
Esempio n. 4
0
def Interface_axis(pose, dist, resmuts, score): ## return the interface rotation/translation axis and the center
    
    ## Compute interface at "dist" of distance and store: 
    ## The contact_list=[i := contact of ith residue ] 
    ## The interface_list= [[interface_1],[interface_2]]
    copy_pose=Pose()
    copy_pose.assign(pose)

    score(copy_pose)
    interface = Interface(1)
    interface.distance(dist)
    interface.calculate(copy_pose)
    contact = interface.contact_list()
    interface_residue = interface.pair_list()
    
    centroid_interface=[]
    for interface in interface_residue: ## Compute the axis by taking the whole interfaces.
      centroid_interface.append(centroid([copy_pose.residue(res).xyz('CA') for res in interface])) ## store the centroids of the residue in the interfaces.
    interface_axis= map(sub,centroid_interface[0],centroid_interface[1])
    center=centroid_interface[0]
    return (interface_axis, center)
Esempio n. 5
0
from toolbox import *
import StringIO

parser = optparse.OptionParser()
parser.add_option('--pdb',
                  dest='pdb_file',
                  default='',
                  help='Protein comple in PDB format')
parser.add_option('--dist',
                  dest='dist',
                  default=10.0,
                  help='Size of interface')

(options, args) = parser.parse_args()
pdb_file = options.pdb_file
dist = float(options.dist)

init()
pose = pose_from_pdb(pdb_file)
setup_foldtree(pose, "A_B", Vector1([1]))
score = create_score_function("talaris2014")
score(pose)
interface = Interface(1)
interface.distance(dist)
interface.calculate(pose)
contact = interface.contact_list()
interface_residue = interface.pair_list()

print pose.fold_tree()
print interface_residue
Esempio n. 6
0
from rosetta.core.scoring import *
from rosetta.core.graph import *
from rosetta.protocols.scoring import Interface 

from toolbox import *
import StringIO

parser=optparse.OptionParser()
parser.add_option('--pdb', dest = 'pdb_file', default = '', help = 'Protein comple in PDB format' )
parser.add_option( '--dist', dest='dist' ,
    default = 10.0,   
    help = 'Size of interface')

(options,args) = parser.parse_args()
pdb_file=options.pdb_file
dist=float(options.dist)

init()
pose=pose_from_pdb(pdb_file)
setup_foldtree(pose, "A_B", Vector1([1]))
score=create_score_function("talaris2014")
score(pose)
interface = Interface(1)
interface.distance(dist)
interface.calculate(pose)
contact = interface.contact_list()
interface_residue = interface.pair_list()

print pose.fold_tree()
print interface_residue