Exemplo n.º 1
0
class Test(BT.BiskitTest):
    """Test"""

    TAGS = [ BT.EXE ]

    def test_Prosa2003(self):
        """Prosa2003 test"""
        from Biskit import PDBModel
        
        ## Loading PDB...
        self.ml = PDBModel( T.testRoot()+'/lig/1A19.pdb' )
        self.ml = self.ml.compress( self.ml.maskProtein() )

        self.mr = PDBModel( T.testRoot()+'/rec/1A2P.pdb' )
        self.mr = self.mr.compress( self.mr.maskProtein() )

        ## Starting Prosa2003
        self.prosa = Prosa2003( [self.ml, self.mr], debug=0, verbose=0 )

        ## Running
        self.ene = self.prosa.run()

        self.result = self.prosa.prosaEnergy()

        if self.local:
            print "Result: ", self.result

        self.assert_( N.sum(self.result - [ -94.568,  -64.903, -159.463 ] ) \
                      < 0.0000001 )
Exemplo n.º 2
0
class Test(BT.BiskitTest):
    """Test"""

    TAGS = [BT.EXE]

    def test_Prosa2003(self):
        """Prosa2003 test"""
        from Biskit import PDBModel

        ## Loading PDB...
        self.ml = PDBModel(T.testRoot() + '/lig/1A19.pdb')
        self.ml = self.ml.compress(self.ml.maskProtein())

        self.mr = PDBModel(T.testRoot() + '/rec/1A2P.pdb')
        self.mr = self.mr.compress(self.mr.maskProtein())

        ## Starting Prosa2003
        self.prosa = Prosa2003([self.ml, self.mr], debug=0, verbose=0)

        ## Running
        self.ene = self.prosa.run()

        self.result = self.prosa.prosaEnergy()

        if self.local:
            print "Result: ", self.result

        self.assert_( N0.sum(self.result - [ -94.568,  -64.903, -159.463 ] ) \
                      < 0.0000001 )
Exemplo n.º 3
0
    def test_model(self):
        """PDBDope test final model"""
        from Biskit import PDBModel

        if self.local:
            print '\nData added to info record of model (key -- value):'
            for k in self.d.m.info.keys():
                print '%s -- %s' % (k, self.d.m.info[k])

            print '\nAdded atom profiles:'
            print self.M.atoms

            print '\nAdded residue  profiles:'
            print self.M.residues

            ## check that nothing has changed
            print '\nChecking that models are unchanged by doping ...'

        m_ref = PDBModel(self.f)
        m_ref = m_ref.compress(m_ref.maskProtein())
        for k in m_ref.atoms.keys():
            #ref = [ m_ref.atoms[i][k] for i in m_ref.atomRange() ]
            #mod = [ self.M.atoms[i][k] for i in self.M.atomRange() ]
            self.assert_(N.all(m_ref[k] == self.M[k]))

        ## display in Pymol
        if self.local:
            print "Starting PyMol..."
            from Biskit.Pymoler import Pymoler

            pm = Pymoler()
            pm.addPdb(self.M, 'm')
            pm.colorAtoms('m', N0.clip(self.M.profile('relAS'), 0.0, 100.0))
            pm.show()
Exemplo n.º 4
0
class Test(BT.BiskitTest):
    """Test case"""
    def test_molTools(self):
        """molTools test"""
        from Biskit import PDBModel

        ## Loading PDB...
        self.m = PDBModel(T.testRoot() + '/lig/1A19.pdb')
        self.m = self.m.compress(self.m.maskProtein())

        hb = hbonds(self.m)

        xyz = xyzOfNearestCovalentNeighbour(40, self.m)

        if self.local:
            print '\nThe nearest covalently attached atom to the'
            print '  atom with index 40 has the coordinates:'
            print xyz

            print 'Potential h-bonds in model:'
            print '(donor index, acceptor index, distance and angle)'
            for h in hb:
                print h

            globals().update(locals())

        self.r = N0.sum(N0.ravel(hb[3:5])) + N0.sum(xyz)

        self.assertAlmostEqual(self.r, self.EXPECT, 3)

    EXPECT = 2025.8997840075292 + 152.687011719
Exemplo n.º 5
0
class Test(BT.BiskitTest):
    """DSSP test"""

    TAGS = [BT.EXE]

    def prepare(self):
        self.f = T.testRoot() + "/com/1BGS.pdb"

    def test_DSSP(self):
        """DSSP test"""

        from Biskit import PDBModel

        if self.local: print 'Loading PDB...'
        self.m = PDBModel(self.f)
        self.m = self.m.compress(self.m.maskProtein())

        if self.local: print 'Starting DSSP'
        self.dssp = Dssp(self.m, verbose=self.local, debug=self.DEBUG)

        if self.local: print 'Running DSSP'

        self.result = self.dssp.run()

        if self.local:
            print "Sequence :", self.m.sequence()
            print "Secondary:", self.result

        self.assertEquals(self.result, self.EXPECTED)

    EXPECTED = '.....SHHHHHHHHHHHSS..TTEE.HHHHHHHT..GGGT.HHHHSTT.EEEEEEE..TT..S...TT..EEEEE.S..SSS..S.EEEEETT..EEEESSSSSS.EE...EEEEETTT..SHHHHHHHHHHHHT..TT..SSHHHHHHHHHHT..SSEEEEEE.HHHHHHHTTTTHHHHHHHHHHHHHHT..EEEEE.'
Exemplo n.º 6
0
class Test(BT.BiskitTest):
    """Test case"""

    def test_molTools(self):
        """molTools test"""
        from Biskit import PDBModel
        
        ## Loading PDB...
        self.m = PDBModel( T.testRoot() + '/lig/1A19.pdb' )
        self.m = self.m.compress( self.m.maskProtein() )

        hb = hbonds( self.m )

        xyz = xyzOfNearestCovalentNeighbour( 40, self.m )
        
        if self.local:
            print '\nThe nearest covalently attached atom to the'
            print '  atom with index 40 has the coordinates:'
            print xyz
    
            print 'Potential h-bonds in model:'
            print '(donor index, acceptor index, distance and angle)'
            for h in hb:
                print h
                
            globals().update( locals() )
                              
        self.r = N0.sum(N0.ravel(hb[3:5])) + N0.sum(xyz)

        self.assertAlmostEqual( self.r, self.EXPECT, 3 )

    EXPECT = 2025.8997840075292 + 152.687011719
Exemplo n.º 7
0
    def test_SurfaceRacer(self):
        """SurfaceRacer test"""

        from Biskit import PDBModel
        import Biskit.mathUtils as MA

        if self.local: print 'Loading PDB...'
        f = T.testRoot() + '/lig/1A19.pdb'
        m = PDBModel(f)
        m = m.compress(m.maskProtein())

        if self.local: print 'Starting SurfaceRacer'

        self.x = SurfaceRacer(m, 1.4, vdw_set=1, debug=self.DEBUG, verbose=0)

        if self.local:
            print 'Running ...'

        self.r = self.x.run()

        c = self.r['curvature']
        ms = self.r['MS']

        if self.local:
            print "Curvature: weighted mean %.6f and standard deviation %.3f"\
                  %(MA.wMean(c,ms), MA.wSD(c,ms))

            print 'Relative MS of atoms 10 to 20:', self.r['relMS'][10:20]

            print 'Relative AS of atoms 10 to 20:', self.r['relAS'][10:20]

        self.e = (N.sum(self.r['relMS'][10:20]), N.sum(self.r['relAS'][10:20]),
                  N.sum(self.r['curvature'][10:20]))

        self.assertAlmostEqual(self.e, self.EXPECT)
Exemplo n.º 8
0
    def test_SurfaceRacer(self):
        """SurfaceRacer test"""

        from Biskit import PDBModel
        import Biskit.mathUtils as MA

        if self.local: print 'Loading PDB...'
        f = T.testRoot()+'/lig/1A19.pdb'
        m = PDBModel(f)
        m = m.compress( m.maskProtein() )

        if self.local: print 'Starting SurfaceRacer'

        self.x = SurfaceRacer( m, 1.4, vdw_set=1, debug=self.DEBUG, verbose=0 )

        if self.local:
            print 'Running ...'

        self.r = self.x.run()

        c= self.r['curvature']
        ms= self.r['MS']

        if self.local:
            print "Curvature: weighted mean %.6f and standard deviation %.3f"\
                  %(MA.wMean(c,ms), MA.wSD(c,ms))

            print 'Relative MS of atoms 10 to 20:',self.r['relMS'][10:20]

            print 'Relative AS of atoms 10 to 20:',self.r['relAS'][10:20]

        self.e = ( N.sum(self.r['relMS'][10:20]), N.sum(self.r['relAS'][10:20]),
              N.sum(self.r['curvature'][10:20]) )

        self.assertAlmostEqual( self.e, self.EXPECT )
Exemplo n.º 9
0
class Test(BT.BiskitTest):
    """Fold_X test"""

    TAGS = [ BT.EXE ]

    def test_Fold_X( self):
        """Fold_X test"""
        from Biskit import PDBModel

        ## Loading PDB...
        self.m = PDBModel( T.testRoot() + '/rec/1A2P.pdb' )
        self.m = self.m.compress( self.m.maskProtein() )

        ## Starting fold_X
        self.x = Fold_X( self.m, debug=self.DEBUG,
                         verbose=(self.VERBOSITY>2) )

        ## Running
        self.r = self.x.run()

        if self.local:
            print "Result: ", self.r

        for k, v in self.r.items():
            self.assertAlmostEqual( v, self.EXPECTED[k], 6 )


    EXPECTED = {'el': -13.766400000000001, 'wtbr': -4.8059700000000003, 'ene': -18.475000000000001, 'mc': 160.28800000000001, 'sloop': 0.0, 'dip': 0.00177626, 'sol_p': 167.71100000000001, 'disu': 0.0, 'tcl': 0.72696700000000003, 'cis': 0.0, 'p_cov': 0.0, 'sol_h': -134.613, 'bb_hb': -87.362499999999997, 'sc_hb': -48.350000000000001, 'vw': -116.67100000000001, 'sc': 58.089300000000001, 'el_kon': 0.0, 'mloop': 0.0, 'vwcl': 0.27728599999999998, 'bbcl': 0.37019200000000002}
Exemplo n.º 10
0
class Test(BT.BiskitTest):
    """DSSP test"""

    TAGS = [BT.EXE]

    def prepare(self):
        self.f = T.testRoot()+"/com/1BGS.pdb"


    def test_DSSP( self ):
        """DSSP test"""

        from Biskit import PDBModel

        if self.local: print 'Loading PDB...'
        self.m = PDBModel(self.f)
        self.m = self.m.compress( self.m.maskProtein() )

        if self.local:  print 'Starting DSSP'
        self.dssp = Dssp( self.m )

        if self.local: print 'Running DSSP'

        self.result = self.dssp.run()

        if self.local:
            print "Sequence :", self.m.sequence()
            print "Secondary:", self.result            

        self.assertEquals( self.result, self.EXPECTED)


    EXPECTED =  '.....SHHHHHHHHHHHSS..TTEE.HHHHHHHT..GGGT.HHHHSTT.EEEEEEE..TT..S...TT..EEEEE.S..SSS..S.EEEEETT..EEEESSSSSS.EE...EEEEETTT..SHHHHHHHHHHHHT..TT..SSHHHHHHHHHHT..SSEEEEEE.HHHHHHHTTTTHHHHHHHHHHHHHHT..EEEEE.'
Exemplo n.º 11
0
class Test(BT.BiskitTest):
    """Test case"""

    TAGS = [ BT.OLD, BT.EXE ]  ## msms is superseeded by SurfaceRacer

    def test_msms(self):
        """msms test"""
        from Biskit import PDBModel

        if self.local: print 'Loading PDB...'
        self.m = PDBModel( T.testRoot() + '/lig/1A19.pdb' )
        self.m = self.m.compress( self.m.maskProtein() )

        if self.local: print 'Getting surfaces via the MSMS executable'
        self.ms = MSMS( self.m, debug=self.DEBUG, verbose=self.local )

        if self.local: print 'Running'
        out, sesList, sasList, atmList = self.ms.run()

        if self.local:
            print out
            print '\nResult from MSMS (first 5 lines): '
            print 'SES \tSAS \tAtom name'
            for i in range(5):
                print '%.2f \t%.2f \t%s'%(sesList[i], sasList[i], atmList[i])

            print 'MSMS done'

            globals().update( locals() )


        self.assertAlmostEqual( out['sas'] + out['ses'],
                                5085.1580000000004 + 4208.7389999999996, 8 )
Exemplo n.º 12
0
class Test(BT.BiskitTest):
    """Test case"""

    TAGS = [ BT.OLD, BT.EXE ]  ## msms is superseeded by SurfaceRacer

    def test_msms(self):
        """msms test"""
        from Biskit import PDBModel

        if self.local: print 'Loading PDB...'
        self.m = PDBModel( T.testRoot() + '/lig/1A19.pdb' )
        self.m = self.m.compress( self.m.maskProtein() )

        if self.local: print 'Getting surfaces via the MSMS executable'
        self.ms = MSMS( self.m, debug=self.DEBUG, verbose=self.local )

        if self.local: print 'Running'
        out, sesList, sasList, atmList = self.ms.run()

        if self.local:
            print out
            print '\nResult from MSMS (first 5 lines): '
            print 'SES \tSAS \tAtom name'
            for i in range(5):
                print '%.2f \t%.2f \t%s'%(sesList[i], sasList[i], atmList[i])

            print 'MSMS done'

            globals().update( locals() )


        self.assertAlmostEqual( out['sas'] + out['ses'],
                                5085.1580000000004 + 4208.7389999999996, 8 )
Exemplo n.º 13
0
    def test_model(self):
        """PDBDope test final model"""
        from Biskit import PDBModel

        if self.local:
            print '\nData added to info record of model (key -- value):'
            for k in self.d.m.info.keys():
                print '%s -- %s'%(k, self.d.m.info[k])

            print '\nAdded atom profiles:'
            print self.M.atoms

            print '\nAdded residue  profiles:'
            print self.M.residues

            ## check that nothing has changed
            print '\nChecking that models are unchanged by doping ...'

        m_ref = PDBModel( self.f )
        m_ref = m_ref.compress( m_ref.maskProtein() )
        for k in m_ref.atoms.keys():
            #ref = [ m_ref.atoms[i][k] for i in m_ref.atomRange() ]
            #mod = [ self.M.atoms[i][k] for i in self.M.atomRange() ]
            self.assert_( N.all( m_ref[k] == self.M[k]) )

        ## display in Pymol
        if self.local:
            print "Starting PyMol..."
            from Biskit.Pymoler import Pymoler

            pm = Pymoler()
            pm.addPdb( self.M, 'm' )
            pm.colorAtoms( 'm', N.clip(self.M.profile('relAS'), 0.0, 100.0) )
            pm.show()
Exemplo n.º 14
0
    def test_addSecondaryNonFiltered(self):
        from Biskit import PDBModel
        m = PDBModel('1R4Q')
        d = PDBDope(m)
        d.addSecondaryStructure()

        r = m.compress(m.maskProtein())['secondary']
        self.assertEqual(''.join(r), self.EXPECT_1RQ4)
Exemplo n.º 15
0
    def test_Whatif(self):
        """Whatif test"""

        from Biskit import PDBModel

        ## Loading PDB...

        f = T.testRoot() + "/com/1BGS.pdb"
        m = PDBModel(f)

        m = m.compress(m.maskProtein())
        m = m.compress(m.maskHeavy())

        ## Starting WhatIf
        x = WhatIf(m, debug=0, verbose=0)

        ## Running
        atomAcc, resAcc, resMask = x.run()

        if self.local:
            ## check that model hasn't changed
            m_ref = PDBModel(f)
            m_ref = m.compress(m.maskProtein())
            for k in m_ref.atoms.keys():
                if not N0.all(m_ref[k] == m[k]):
                    print 'Not equal ', k
                else:
                    print 'Equal ', k

            ## display exposed residues in PyMol
            from Pymoler import Pymoler
            pm = Pymoler()
            model = pm.addPdb(m, '1')
            pm.colorRes('1', resAcc[:, 0])
            pm.show()

            print "\nResult for first 10 atoms/residues: "
            print '\nAccessability (A^2):\n', atomAcc[:10]
            print '\nResidue accessability (A^2)'
            print '[total, backbone, sidechain]:\n', resAcc[:10]
            print '\nExposed residue mask:\n', resMask[:10]
            print '\nTotal atom    accessability (A^2): %.2f' % sum(atomAcc)
            print '      residue accessability (A^2): %.2f' % sum(resAcc)[0]

        self.assertAlmostEqual(N0.sum(resAcc[:, 0]), 2814.6903, 7)
Exemplo n.º 16
0
    def test_Whatif(self):
        """Whatif test"""

        from Biskit import PDBModel

        ## Loading PDB...

        f = T.testRoot()+"/com/1BGS.pdb"
        m = PDBModel(f)

        m = m.compress( m.maskProtein() )
        m = m.compress( m.maskHeavy() )

        ## Starting WhatIf
        x = WhatIf( m, debug=0, verbose=0 )

        ## Running
        atomAcc, resAcc, resMask = x.run()

        if self.local:
            ## check that model hasn't changed
            m_ref = PDBModel(f)
            m_ref = m.compress( m.maskProtein() )
            for k in m_ref.atoms.keys():
                if not N0.all(m_ref[k] == m[k]):
                    print 'Not equal ', k
                else:
                    print 'Equal ', k

            ## display exposed residues in PyMol
            from Pymoler import Pymoler
            pm = Pymoler()
            model = pm.addPdb( m, '1' )
            pm.colorRes( '1', resAcc[:,0] )
            pm.show()

            print "\nResult for first 10 atoms/residues: "
            print '\nAccessability (A^2):\n', atomAcc[:10]
            print '\nResidue accessability (A^2)'
            print '[total, backbone, sidechain]:\n', resAcc[:10]
            print '\nExposed residue mask:\n',resMask[:10]
            print '\nTotal atom    accessability (A^2): %.2f'%sum(atomAcc) 
            print '      residue accessability (A^2): %.2f'%sum(resAcc)[0]

        self.assertAlmostEqual( N0.sum(resAcc[:,0]), 2814.6903, 7 ) 
Exemplo n.º 17
0
class Test(BT.BiskitTest):
    """Test case"""
    def test_surfaceRacerTools(self):
        """surfaceRacerTools test"""
        from Biskit import PDBModel
        import Biskit.tools as T

        ## load a structure
        self.m = PDBModel(T.testRoot() + '/lig/1A19.pdb')
        self.m = self.m.compress(self.m.maskProtein())
        self.m = self.m.compress(self.m.maskHeavy())

        ## some fake surface data
        surf = N0.ones(self.m.lenAtoms()) * 10.0

        relExp = relExposure(self.m, surf)

        ##         if self.local:
        ##             globals().update( locals() )

        self.assertAlmostEqual(N0.sum(relExp), 44276.86085222386, 8)
Exemplo n.º 18
0
class Test(BT.BiskitTest):
    """DSSP test"""

    TAGS = [BT.EXE]

    def prepare(self):
        self.f = T.testRoot() + "/com/1BGS.pdb"

    def generic_test(self, pdb, expected=None, proteinonly=False):
        """generic DSSP test"""

        from Biskit import PDBModel

        if self.local: print 'Loading PDB...'
        self.m = PDBModel(pdb)

        if proteinonly:
            self.m = self.m.compress(self.m.maskProtein())

        if self.local: print 'Starting DSSP'
        self.dssp = Dssp(self.m, verbose=self.local, debug=self.DEBUG)

        if self.local: print 'Running DSSP'

        self.result = self.dssp.run()

        if self.local:
            print "Sequence :", self.m.sequence()
            print "Secondary:", self.result

        if expected:
            self.assertEquals(self.result, expected)

    EXPECTED = '.....SHHHHHHHHHHHSS..TTEE.HHHHHHHT..GGGT.HHHHSTT.EEEEEEE..TT..S...TT..EEEEE.S..SSS..S.EEEEETT..EEEESSSSSS.EE...EEEEETTT..SHHHHHHHHHHHHT..TT..SSHHHHHHHHHHT..SSEEEEEE.HHHHHHHTTTTHHHHHHHHHHHHHHT..EEEEE.'

    def test_DSSP(self):
        """DSSP test"""
        self.generic_test(self.f, expected=self.EXPECTED, proteinonly=True)

    def test_DSSP_2W3A(self):
        """DSSP test 2W3A"""
        self.generic_test('2W3A', proteinonly=True)

    def test_DSSP_1R4Q(self):
        """DSSP test"""
        self.generic_test('1R4Q', proteinonly=True)

    def test_DSSP_1AM7(self):
        self.generic_test('1AM7')

    def test_DSSP_5FB8(self):
        self.generic_test('5fb8')
Exemplo n.º 19
0
class Test(BT.BiskitTest):
    """Test case"""

    def test_surfaceRacerTools(self):
        """surfaceRacerTools test"""
        from Biskit import PDBModel
        import Biskit.tools as T
        
        ## load a structure
        self.m = PDBModel( T.testRoot()+'/lig/1A19.pdb' )
        self.m = self.m.compress( self.m.maskProtein() )
        self.m = self.m.compress( self.m.maskHeavy() )
        
        ## some fake surface data
        surf = Numeric.ones( self.m.lenAtoms()) * 10.0

        relExp = relExposure( self.m, surf )
        
##         if self.local:
##             globals().update( locals() )
            
        self.assertEqual( Numeric.sum(relExp), 44276.860852223857 )
Exemplo n.º 20
0
class LongTest(BT.BiskitTest):

    TAGS = [BT.EXE, BT.LONG]

    def prepare(self):
        from Biskit import PDBModel
        self.f = T.testRoot() + '/com/1BGS.pdb'

        self.M = PDBModel(self.f)
        self.M = self.M.compress(self.M.maskProtein())

        self.d = PDBDope(self.M)

    def test_conservation(self):
        """PDBDope.addConservation (Hmmer) test"""
        if self.local: print "Adding conservation data...",
        self.d.addConservation()
        if self.local: print 'Done.'

        ## display in Pymol
        if self.local:
            print "Starting PyMol..."
            from Biskit.Pymoler import Pymoler

            pm = Pymoler()
            pm.addPdb(self.M, 'm')
            pm.colorAtoms('m', N0.clip(self.M.profile('cons_ent'), 0.0, 100.0))
            pm.show()

    def test_delphi(self):
        """PDBDope.addDelphi test"""
        if self.local:
            self.log.add('Calculating Delphi electrostatic potential')
            self.log.add('')

        self.d.addDelphi(scale=1.2)

        self.assertAlmostEqual(self.M['delphi']['scharge'], 0.95, 1)

    ## EXPECT_1RQ4 = '.EEEEE.SSHHHHHHHHHHHHHHHEEEEEEEE.SS.EEEEE..SS...EEEEEEE.SSTTT.....EEEEEESSS..EEEEEETTTTEEEE.GGGTT...TT.EEEE.SS.SSHHHHHHHHTS.STT.EE.HHHHHHHHHHHHT..SS...HHHHHHHHHHHHHTHHHHH.HHHHHHHHGGGT.TT...EE..HHHHHHHTTHHHHHHHGGG.SS.SEEEETTEEESSHHHHHTT..EE.......SS.SSSS..EEEETTEEEEHHHHHHH.....EEEEE.SSHHHHHHHHHHHHHHHEEEEEEEEETTEEEEEE...S...EEEEEEE.SSSSS.....EEEEEETTT..EEEEEETTTTEEEE.GGGTT...TT.EEEE.SS..SHHHHHHHS...TTT.EE.TTHHHHHHHHHHT..SS...HHHHHHHHHHHHHHHHHHH.HHHHHHHGGGSS.TT...EE..HHHHHHHHTHHHHHHHGGG.SS.SEEEETTEEE.SHHHHHTT..EE........S.STTSS.EEESSSEEEEHHHHHHH.......EEEEE.EEEEEE.TTS.EEEEESS.EEEE..HHHHHHHHHHHHHT..EEEE.S..STT.B..EEEE...EEEEE...EEEE.TTS.EEEEETTEEEEE..TTHHHHHHHHHHTT..EEEE.S..STT.B..EEEE...EEEEEEEEEEEE.TTS.EEEEETTEEEEE..TTHHHHHHHHHHHT.EEEEE.S..STT.B..EEEE...EEEEEEEEEEEE.TTS.EEEEETTEEEEE..TTHHHHHHHHHHTT.EEEEE.S..STT.B..EEEE...EEEEE.EEEEEE.SSS.EEEEETTEEEEE..HHHHHHHHHHHHHT..EEEE.S..STT.B..EEEE...EEEEEEEEEEEE.TTS.EEEEETTEEEEE..HHHHHHHHHHHHTT.EEEEE.S..STT.B..EEEE...EEEEEEEEEEEE.TTS.EEEEETTEEEEE..TTHHHHHHHHHHTT.EEEEE.S..STT.B..EEEE...EEEEE.EEEEEE.TTS.EEEEETTB..EE..TTHHHHHHHHHHHT..EEEE.SS.STT.B..EEEE.....EEE.EEEEEE.TTS.EEEEETTEEEEE..THHHHHHHHHHHHT..EEEE.S..STT.B..EEEE...EEEEE.EEEEEE.SSS.EEEEETTEEEEE..TTHHHHHHHHHTTT..EEEE.S..STT.B..EEEE.'
    EXPECT_1RQ4 = '.EEEEE.SSHHHHHHHHHHHHHHHEEEEEEEE.SS.EEEEE..SS...EEEEEEE.SSTTT.....EEEEEESSS..EEEEEETTTTEEEE.GGGTT...TT.EEEE.SS.SSHHHHHHHHTS.STT.EE.HHHHHHHHHHHHT..SS...HHHHHHHHHHHIIIIIHHH.HHHHHHHHGGGT.TT...EE..HHHHHHHTTHHHHHHHGGG.SS.SEEEETTEEESSHHHHHTT..EE.......SS.SSSS..EEEETTEEEEHHHHHHH.....EEEEE.SSHHHHHHHHHHHHHHHEEEEEEEEETTEEEEEE...S...EEEEEEE.SSSSS.....EEEEEETTT..EEEEEETTTTEEEE.GGGTT...TT.EEEE.SS..SHHHHHHHS...TTT.EE.TTHHHHHHHHHHT..SS...HHHHHHHHHHHIIIIIHHH.HHHHHHHGGGSS.TT...EE..HHHHHHHHTHHHHHHHGGG.SS.SEEEETTEEE.SHHHHHTT..EE........S.STTSS.EEESSSEEEEHHHHHHH.......EEEEE.EEEEEE.TTS.EEEEESS.EEEE..HHHHHHHHHHHHHT..EEEE.S..STT.B..EEEE...EEEEE...EEEE.TTS.EEEEETTEEEEE..TTHHHHHHHHHHTT..EEEE.S..STT.B..EEEE...EEEEEEEEEEEE.TTS.EEEEETTEEEEE..TTHHHHHHHHHHHT.EEEEE.S..STT.B..EEEE...EEEEEEEEEEEE.TTS.EEEEETTEEEEE..TTHHHHHHHHHHTT.EEEEE.S..STT.B..EEEE...EEEEE.EEEEEE.SSS.EEEEETTEEEEE..HHHHHHHHHHHHHT..EEEE.S..STT.B..EEEE...EEEEEEEEEEEE.TTS.EEEEETTEEEEE..HHHHHHHHHHHHTT.EEEEE.S..STT.B..EEEE...EEEEEEEEEEEE.TTS.EEEEETTEEEEE..TTHHHHHHHHHHTT.EEEEE.S..STT.B..EEEE...EEEEE.EEEEEE.TTS.EEEEETTB..EE..TTHHHHHHHHHHHT..EEEE.SS.STT.B..EEEE.....EEE.EEEEEE.TTS.EEEEETTEEEEE..THHHHHHHHHHHHT..EEEE.S..STT.B..EEEE...EEEEE.EEEEEE.SSS.EEEEETTEEEEE..TTHHHHHHHHHTTT..EEEE.S..STT.B..EEEE.'

    def test_addSecondaryNonFiltered(self):
        from Biskit import PDBModel
        m = PDBModel('1R4Q')
        d = PDBDope(m)
        d.addSecondaryStructure()

        r = m.compress(m.maskProtein())['secondary']
        self.assertEqual(''.join(r), self.EXPECT_1RQ4)
Exemplo n.º 21
0
class OldTest( BT.BiskitTest ):

    TAGS = [ BT.EXE, BT.OLD ]

    def prepare(self):
        from Biskit import PDBModel
        self.f = T.testRoot() + '/com/1BGS.pdb'

        self.M = PDBModel( self.f )
        self.M = self.M.compress( self.M.maskProtein() )

        self.d = PDBDope( self.M )

    def _test_addAsa(self):
        """PDBDope.addAsa (Whatif, obsolete) test"""
        self.d.addASA()
Exemplo n.º 22
0
class OldTest(BT.BiskitTest):

    TAGS = [BT.EXE, BT.OLD]

    def prepare(self):
        from Biskit import PDBModel
        self.f = T.testRoot() + '/com/1BGS.pdb'

        self.M = PDBModel(self.f)
        self.M = self.M.compress(self.M.maskProtein())

        self.d = PDBDope(self.M)

    def _test_addAsa(self):
        """PDBDope.addAsa (Whatif, obsolete) test"""
        self.d.addASA()
Exemplo n.º 23
0
class LongTest( BT.BiskitTest ):

    TAGS = [ BT.EXE, BT.LONG ]


    def prepare(self):
        from Biskit import PDBModel
        self.f = T.testRoot() + '/com/1BGS.pdb'

        self.M = PDBModel( self.f )
        self.M = self.M.compress( self.M.maskProtein() )

        self.d = PDBDope( self.M )

    def test_conservation(self):
        """PDBDope.addConservation (Hmmer) test"""
        if self.local: print "Adding conservation data...",
        self.d.addConservation()
        if self.local: print 'Done.'

        ## display in Pymol
        if self.local:
            print "Starting PyMol..."
            from Biskit.Pymoler import Pymoler

            pm = Pymoler()
            pm.addPdb( self.M, 'm' )
            pm.colorAtoms( 'm', N.clip(self.M.profile('cons_ent'), 0.0, 100.0) )
            pm.show()

    def test_delphi(self):
        """PDBDope.addDelphi test"""
        if self.local:
            self.log.add( 'Calculating Delphi electrostatic potential' )
            self.log.add( '' )

        self.d.addDelphi( scale=1.2 )
        
        self.assertAlmostEqual( self.M['delphi']['scharge'], 0.95, 1 )
Exemplo n.º 24
0
class LongTest(BT.BiskitTest):

    TAGS = [BT.EXE, BT.LONG]

    def prepare(self):
        from Biskit import PDBModel
        self.f = T.testRoot() + '/com/1BGS.pdb'

        self.M = PDBModel(self.f)
        self.M = self.M.compress(self.M.maskProtein())

        self.d = PDBDope(self.M)

    def test_conservation(self):
        """PDBDope.addConservation (Hmmer) test"""
        if self.local: print "Adding conservation data...",
        self.d.addConservation()
        if self.local: print 'Done.'

        ## display in Pymol
        if self.local:
            print "Starting PyMol..."
            from Biskit.Pymoler import Pymoler

            pm = Pymoler()
            pm.addPdb(self.M, 'm')
            pm.colorAtoms('m', N0.clip(self.M.profile('cons_ent'), 0.0, 100.0))
            pm.show()

    def test_delphi(self):
        """PDBDope.addDelphi test"""
        if self.local:
            self.log.add('Calculating Delphi electrostatic potential')
            self.log.add('')

        self.d.addDelphi(scale=1.2)

        self.assertAlmostEqual(self.M['delphi']['scharge'], 0.95, 1)
Exemplo n.º 25
0
class Test(BT.BiskitTest):
    """Test class"""

    TAGS = [BT.EXE]

    def test_IcmCad(self):
        """IcmCad test"""
        from Biskit import PDBModel

        if self.local: print 'Loading PDB...'

        self.f = T.testRoot() + '/lig/1A19.pdb'
        self.m1 = PDBModel(self.f)
        self.m1 = self.m1.compress(self.m1.maskProtein())

        self.ms = []

        self.lig_traj = T.load(T.testRoot() + '/lig_pcr_00/traj.dat')
        for m in self.lig_traj[:3]:
            m = m.compress(m.maskProtein())
            self.ms.append(m)

        if self.local: print 'Starting ICM'
        self.x = IcmCad(self.m1, self.ms, debug=self.DEBUG, verbose=self.local)

        if self.local:
            print 'Running'

        self.r = self.x.run()

        if self.local:
            print "Result: ", self.r

        self.assertEqual(
            self.r,
            [8.8603529999999999, 9.0315890000000003, 8.5055429999999994])
Exemplo n.º 26
0
class Test(BT.BiskitTest):
    """Test class"""

    TAGS = [ BT.EXE ]

    def test_IcmCad( self ):
        """IcmCad test"""
        from Biskit import PDBModel

        if self.local: print 'Loading PDB...'

        self.f = T.testRoot() + '/lig/1A19.pdb'
        self.m1 = PDBModel(self.f)
        self.m1 = self.m1.compress( self.m1.maskProtein() )

        self.ms = []

        self.lig_traj = T.load( T.testRoot() + '/lig_pcr_00/traj.dat' )
        for m in self.lig_traj[:3]:
            m = m.compress( m.maskProtein() )
            self.ms.append(m)

        if self.local: print 'Starting ICM'
        self.x = IcmCad( self.m1, self.ms, debug=self.DEBUG,
                         verbose=self.local )

        if self.local:
            print 'Running'

        self.r = self.x.run()

        if self.local:
            print "Result: ", self.r

        self.assertEqual( self.r, [8.8603529999999999, 9.0315890000000003,
                                   8.5055429999999994] )
Exemplo n.º 27
0
class Test(BT.BiskitTest):
    """DSSP test"""

    TAGS = [BT.EXE]

    def prepare(self):
        self.f = T.testRoot()+"/com/1BGS.pdb"
        
    def generic_test(self, pdb, expected=None, proteinonly=False):
        """generic DSSP test"""

        from Biskit import PDBModel

        if self.local: print 'Loading PDB...'
        self.m = PDBModel(pdb)
        
        if proteinonly:
            self.m = self.m.compress( self.m.maskProtein() )

        if self.local:  print 'Starting DSSP'
        self.dssp = Dssp( self.m, verbose=self.local, debug=self.DEBUG )

        if self.local: print 'Running DSSP'

        self.result = self.dssp.run()  ## returns modified PDBModel
        self.result = self.result.compress( self.result.maskProtein() )
        self.result = ''.join(self.result['dssp'])

        if self.local:
            print "Sequence :", self.m.sequence()
            print "Secondary:", self.result            
        
        if expected:
            self.assertEquals( self.result, expected)        


    EXPECTED =  '.....SHHHHHHHHHHHSS..TTEE.HHHHHHHT..GGGT.HHHHSTT.EEEEEEE..TT..S...TT..EEEEE.S..SSS..S.EEEEETT..EEEESSSSSS.EE...EEEEETTT..SHHHHHHHHHHHHT..TT..SSHHHHHHHHHHT..SSEEEEEE.HHHHHHHTTTTHHHHHHHHHHHHHHT..EEEEE.'
    def test_DSSP( self ):
        """DSSP test"""
        self.generic_test(self.f, expected=self.EXPECTED, proteinonly=False)

    def test_DSSP_2W3A( self ):
        """DSSP test 2W3A"""
        self.generic_test('2W3A', proteinonly=False)

    def test_DSSP_3TGI( self ):
        """DSSP test 3TGI"""
        ## handling of residues with insertion code (184A, 186A, 221A)
        self.generic_test('3TGI', proteinonly=False)

    def test_DSSP_1R4Q( self ):
        """DSSP test"""
        self.generic_test('1R4Q', proteinonly=False)    

    def test_DSSP_1AM7(self):
        self.generic_test('1AM7')

    def test_DSSP_5FB8(self):
        self.generic_test('5fb8')
        
    def test_DSSP_3j4q(self):
        self.generic_test(T.testRoot('dssp') + '/3j4q.pdb')
Exemplo n.º 28
0
class Test(BT.BiskitTest):
    """Hmmer test"""

    TAGS = [BT.EXE]

    M = None

    def prepare(self):
        from Biskit import PDBModel
        import Biskit.tools as T

        if not self.M:
            if self.local: print "Loading PDB...",
            self.M = PDBModel(T.testRoot() + '/lig/1A19.pdb')
            self.M = self.M.compress(self.M.maskProtein())
            if self.local: print "Done"

    def test_HmmSearch(self):
        """HmmSearch test"""
        self.searcher = HmmerSearch(self.M, verbose=self.local, log=self.log)
        self.matches, self.hits = self.searcher.run()

    def test_HmmProfile(self):
        """HmmerProfile test"""
        profile = HmmerProfile('FH2', verbose=self.local, log=self.log)
        self.profileDic = profile.run()

    def test_HmmerFasta(self):
        """Hmmer test (search from fasta)"""
        h = Hmmer(hmmdb=settings.hmm_db)
        h.checkHmmdbIndex()

        self.searchMatches, self.searchHits = h.searchHmmdb(
            T.testRoot() + '/Mod/project/target.fasta')

        self.assertTrue(len(self.searchHits) > 3)

    def test_HmmerModel(self):
        """Hmmer test (search from model)"""

        ## initiate and check database status
        self.hmmer = Hmmer(hmmdb=settings.hmm_db,
                           verbose=self.local,
                           log=self.log)
        self.hmmer.checkHmmdbIndex()

        ## scoring methods to use
        method = ['emmScore', 'ent', 'maxAll', 'absSum', 'maxAllScale']

        ## search
        searchMatches, searchHits = self.hmmer.searchHmmdb(self.M)
        hmmNames = self.hmmer.selectMatches(searchMatches, searchHits)
        ##      hmmNames = {'Barstar': [[1, 89]]}

        self.cons = []
        self.result = None

        for name in hmmNames.keys():

            ## retrieve hmm model
            hmmDic = self.hmmer.getHmmProfile(name)

            ## align sequence with model
            fastaSeq, hmmSeq, repete, hmmGap = \
                  self.hmmer.align( self.M, hmmNames[ name ] )

            ## cast hmm model
            hmmDic_cast = \
                  self.hmmer.castHmmDic( hmmDic, repete, hmmGap, method[0] )

            ## Hmmer profile match scores for sequence
            self.cons = self.hmmer.matchScore(fastaSeq, hmmSeq, hmmDic_cast,
                                              method[0])

            ## If there are more than one profile in the model, merge to one.
            ## Note: this can be problematic as scores depend on family size
            if self.result:
                self.result = self.hmmer.mergeProfiles(self.result, self.cons)
            else:
                self.result = self.cons

        self.hmmer.cleanup()

        self.assertEqual(self.result, self.EXPECTED)

    #: Hmmer emission scores
    EXPECTED = [
        2581.0, 3583.0, 1804.0, 2596.0, 3474.0, 2699.0, 3650.0, 2087.0, 2729.0,
        2450.0, 2412.0, 2041.0, 3474.0, 1861.0, 2342.0, 2976.0, 5124.0, 2729.0,
        2202.0, 2976.0, 3583.0, 2202.0, 2103.0, 2976.0, 1922.0, 2132.0, 4122.0,
        2403.0, 4561.0, 4561.0, 3650.0, 2087.0, 4001.0, 2976.0, 3860.0, 3260.0,
        2976.0, 6081.0, 3860.0, 5611.0, 2976.0, 3609.0, 3650.0, 6081.0, 3343.0,
        2403.0, 3288.0, 4122.0, 2976.0, 2322.0, 2976.0, 1995.0, 4378.0, 2706.0,
        2665.0, 4186.0, 3539.0, 2692.0, 3270.0, 2302.0, 2604.0, 2132.0, 2118.0,
        2380.0, 2614.0, 2170.0, 3260.0, 2403.0, 1964.0, 3343.0, 2976.0, 2643.0,
        3343.0, 2714.0, 2591.0, 3539.0, 3260.0, 2410.0, 1809.0, 3539.0, 2111.0,
        -774.0, 3860.0, 2450.0, 2063.0, 3474.0, 3474.0, 2057.0, 1861.0
    ]
Exemplo n.º 29
0
class Test(BT.BiskitTest):
    """Hmmer test"""

    TAGS = [ BT.EXE ]
    
    M = None

    def prepare( self ):
        from Biskit import PDBModel
        import Biskit.tools as T

        if not self.M:
            if self.local: print "Loading PDB...",
            self.M = PDBModel( T.testRoot()+'/lig/1A19.pdb')
            self.M = self.M.compress( self.M.maskProtein() )
            if self.local: print "Done"
    
    def test_HmmSearch( self ):
        """HmmSearch test"""
        self.searcher = HmmerSearch( self.M, 
                                   verbose=self.local,
                                   log=self.log )
        self.matches, self.hits = self.searcher.run()

    def test_HmmProfile( self ):
        """HmmerProfile test"""
        profile = HmmerProfile( 'FH2', verbose=self.local, log=self.log)
        self.profileDic = profile.run()

    def test_HmmerFasta( self ):
        """Hmmer test (search from fasta)"""
        h = Hmmer(hmmdb=settings.hmm_db)
        h.checkHmmdbIndex()

        self.searchMatches, self.searchHits = h.searchHmmdb(
            T.testRoot()+'/Mod/project/target.fasta' )
        
        self.assertTrue( len( self.searchHits ) > 3 )

    def test_HmmerModel( self):
        """Hmmer test (search from model)"""
        
        ## initiate and check database status
        self.hmmer = Hmmer( hmmdb=settings.hmm_db, verbose=self.local,
                            log=self.log )
        self.hmmer.checkHmmdbIndex()

        ## scoring methods to use
        method = [ 'emmScore', 'ent', 'maxAll', 'absSum', 'maxAllScale' ]

        ## search
        searchMatches, searchHits = self.hmmer.searchHmmdb( self.M )
        hmmNames = self.hmmer.selectMatches( searchMatches, searchHits )
  ##      hmmNames = {'Barstar': [[1, 89]]}
        
        self.cons = []
        self.result = None

        for name in hmmNames.keys():

            ## retrieve hmm model
            hmmDic = self.hmmer.getHmmProfile( name )

            ## align sequence with model
            fastaSeq, hmmSeq, repete, hmmGap = \
                  self.hmmer.align( self.M, hmmNames[ name ] )

            ## cast hmm model
            hmmDic_cast = \
                  self.hmmer.castHmmDic( hmmDic, repete, hmmGap, method[0] )

            ## Hmmer profile match scores for sequence
            self.cons = self.hmmer.matchScore( fastaSeq, hmmSeq,
                                          hmmDic_cast, method[0] )

            ## If there are more than one profile in the model, merge to one.
            ## Note: this can be problematic as scores depend on family size
            if self.result:
                self.result = self.hmmer.mergeProfiles( self.result, self.cons )
            else:
                self.result = self.cons

        self.hmmer.cleanup()

        self.assertEqual( self.result, self.EXPECTED )


    #: Hmmer emission scores
    EXPECTED = [2581.0, 3583.0, 1804.0, 2596.0, 3474.0, 2699.0, 3650.0, 2087.0, 2729.0, 2450.0, 2412.0, 2041.0, 3474.0, 1861.0, 2342.0, 2976.0, 5124.0, 2729.0, 2202.0, 2976.0, 3583.0, 2202.0, 2103.0, 2976.0, 1922.0, 2132.0, 4122.0, 2403.0, 4561.0, 4561.0, 3650.0, 2087.0, 4001.0, 2976.0, 3860.0, 3260.0, 2976.0, 6081.0, 3860.0, 5611.0, 2976.0, 3609.0, 3650.0, 6081.0, 3343.0, 2403.0, 3288.0, 4122.0, 2976.0, 2322.0, 2976.0, 1995.0, 4378.0, 2706.0, 2665.0, 4186.0, 3539.0, 2692.0, 3270.0, 2302.0, 2604.0, 2132.0, 2118.0, 2380.0, 2614.0, 2170.0, 3260.0, 2403.0, 1964.0, 3343.0, 2976.0, 2643.0, 3343.0, 2714.0, 2591.0, 3539.0, 3260.0, 2410.0, 1809.0, 3539.0, 2111.0, -774.0, 3860.0, 2450.0, 2063.0, 3474.0, 3474.0, 2057.0, 1861.0]