示例#1
0
    def test_ComplexTraj(self):
        """Dock.ComplexTraj test"""

        import biskit.tools as T

        ## there is no complex trajectory in the test folder so will have
        ## to create a fake trajectory with a complex
        f =  [ T.testRoot()+ '/com/1BGS.pdb' ] * 5
        t = Trajectory( f, verbose=self.local )

        t = ComplexTraj( t, recChains=[0] )

        #if self.local:
            #print 'plotting contact density...'
            #t.plotContactDensity( step=2 )

        ## create a fake second chain in the ligand
        for i in range( 1093+98, 1968 ):
            t.ref.atoms['chain_id'][i] = 'B'

        t.ref.chainIndex( force=1, cache=1 )
        t.cl = [1,2]

        r = N0.concatenate((list(range(1093,1191)), list(range(0,1093)), list(range(1191,1968))))

        tt = t.takeAtoms( r )

        contactMat = tt.atomContacts( 1 )
        
        if self.local:
            print('Receptor chains: %s    Ligand chains: %s'%(t.cr, t.cl))
            
        self.assertEqual( N0.sum(N0.ravel(contactMat)), 308 )
示例#2
0
    def test_ComplexTraj(self):
        """Dock.ComplexTraj test"""

        import biskit.tools as T

        ## there is no complex trajectory in the test folder so will have
        ## to create a fake trajectory with a complex
        f = [T.testRoot() + '/com/1BGS.pdb'] * 5
        t = Trajectory(f, verbose=self.local)

        t = ComplexTraj(t, recChains=[0])

        #if self.local:
        #print 'plotting contact density...'
        #t.plotContactDensity( step=2 )

        ## create a fake second chain in the ligand
        for i in range(1093 + 98, 1968):
            t.ref.atoms['chain_id'][i] = 'B'

        t.ref.chainIndex(force=1, cache=1)
        t.cl = [1, 2]

        r = N0.concatenate(
            (list(range(1093,
                        1191)), list(range(0, 1093)), list(range(1191, 1968))))

        tt = t.takeAtoms(r)

        contactMat = tt.atomContacts(1)

        if self.local:
            print('Receptor chains: %s    Ligand chains: %s' % (t.cr, t.cl))

        self.assertEqual(N0.sum(N0.ravel(contactMat)), 308)
示例#3
0
    def takeAtoms( self, indices, returnClass=None ):
        """
        takeAtoms( indices, [returnClass] ) -> ComplexTraj
    
        @param indices: atoms to extract
        @type  indices: [int]
        @param returnClass: return type (default: current class)
        @type  returnClass: class

        @return: ComplexTraj
        @rtype: ComplexTraj
        
        @raise ComplexTrajError: if (parts of) chains are inserted into
                                 each other
        """
        r = Trajectory.takeAtoms( self, indices, returnClass )

        oldToNew = self.__translateChainIndices( indices, r.ref.chainMap() )

        r.cr = [ oldToNew[ c ] for c in self.cr if c in oldToNew ]
        r.cl = [ oldToNew[ c ] for c in self.cl if c in oldToNew ]

        return r
示例#4
0
    def takeAtoms(self, indices, returnClass=None):
        """
        takeAtoms( indices, [returnClass] ) -> ComplexTraj
    
        @param indices: atoms to extract
        @type  indices: [int]
        @param returnClass: return type (default: current class)
        @type  returnClass: class

        @return: ComplexTraj
        @rtype: ComplexTraj
        
        @raise ComplexTrajError: if (parts of) chains are inserted into
                                 each other
        """
        r = Trajectory.takeAtoms(self, indices, returnClass)

        oldToNew = self.__translateChainIndices(indices, r.ref.chainMap())

        r.cr = [oldToNew[c] for c in self.cr if c in oldToNew]
        r.cl = [oldToNew[c] for c in self.cl if c in oldToNew]

        return r