for v in values: r+= T.clipStr( '\n - %s' % str(v), 75) return r ############# ## TESTING ############# import biskit.test as BT class Test(BT.BiskitTest): """Test""" def test_SettingsParser(self): """SettingsManager test""" p = SettingsParser( T.dataRoot() + '/defaults/settings.cfg') p.parse() t = p.result.get('testparam', Setting()) self.assertEqual( (t.name, t.value), ('testparam', 42) ) return t.name, t.value if __name__ == '__main__': BT.localTest()
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 ) if __name__ == '__main__': BT.localTest() ## pushes test PDBDope instance as 'd' into namespace
class Test(BT.BiskitTest): """Test case""" def test_hexParser(self): """Dock.hexParser test""" rec_dic = t.load(t.testRoot() + "/dock/rec/1A2P_model.dic") lig_dic = t.load(t.testRoot() + "/dock/lig/1A19_model.dic") self.h = HexParser(t.testRoot() + "/dock/hex/1A2P-1A19_hex8.out", rec_dic, lig_dic) c_lst = self.h.parseHex() if self.local: print(c_lst[1].info) globals().update(locals()) self.assertSetEqual( set(c_lst[1].info.keys()), set([ 'soln', 'rms', 'hex_clst', 'hex_eshape', 'model2', 'model1', 'hex_etotal', 'hex_eair', 'date' ])) if __name__ == '__main__': BT.localTest()
self.assertEqual(self.d.hexFailed, 0, 'Hex exited with error') self.assertTrue(len(self.d.result) > 1, 'no results collected') ## dock receptor 1 vs. ligand one on remote host # fmac2, fout2= d.createHexInp( 1, 1 ) # d.runHex( fmac2, log=0, ncpu=2, host='remote_host_name' ) class TestLong(TestCore): """Test case running a complete hex docking (ca. 30 min/CPU)""" TAGS = [ BT.EXE, BT.LONG ] def test_DockerLong(self): """Dock.Docker real test (20-30min/CPU)""" self.dry_or_wet_run( run=True ) class TestShort(TestCore): TAGS = [ BT.EXE ] def test_DockerShort(self): """Dock.Docker dry run test""" self.dry_or_wet_run( run=False ) if __name__ == '__main__': BT.localTest(debug=False)
self.assertEqual(self.d.hexFailed, 0, 'Hex exited with error') self.assertTrue(len(self.d.result) > 1, 'no results collected') ## dock receptor 1 vs. ligand one on remote host # fmac2, fout2= d.createHexInp( 1, 1 ) # d.runHex( fmac2, log=0, ncpu=2, host='remote_host_name' ) class TestLong(TestCore): """Test case running a complete hex docking (ca. 30 min/CPU)""" TAGS = [BT.EXE, BT.LONG] def test_DockerLong(self): """Dock.Docker real test (20-30min/CPU)""" self.dry_or_wet_run(run=True) class TestShort(TestCore): TAGS = [BT.EXE] def test_DockerShort(self): """Dock.Docker dry run test""" self.dry_or_wet_run(run=False) if __name__ == '__main__': BT.localTest(debug=False)
self.assertEqual( self.ref.lenChains(), self.m3.lenChains() ) self.assertEqual( refprot.atomNames(), m3prot.atomNames() ) class TestNoLeap( BT.BiskitTest ): """Test AmberParmBuilder (no dependency on tleap)""" def test_capIrregular( self ): """AmberParmBuilder.capNME & capACE test""" gfp = PDBModel('1GFL') normal = gfp.takeResidues([10,11]) chromo = gfp.takeResidues([64,65]) self.a = AmberParmBuilder( normal, verbose=self.local) self.m4 = self.a.capACE( normal, 0 ) self.assertEqual( len(self.m4), 17 ) ## del chromo.residues['biomol'] self.m5 = self.a.capACE( chromo, 0 ) self.m5 = self.a.capNME( self.m5, 0 ) self.assertEqual( self.m5.sequence(), 'XSYX' ) if __name__ == '__main__': BT.localTest(debug=True)
class Test(BT.BiskitTest): """ErrorHandler test""" def prepare(self): import tempfile self.f_out = tempfile.mktemp( '_test_ErrorHandler' ) def cleanUp(self): T.tryRemove( self.f_out ) def test_ErrorHandler( self ): """ErrorHandler test""" from biskit import LogFile self.err_log = LogFile( self.f_out ) self.e = ErrorHandler( log=self.err_log ) self.e.warning( 'A warning' ) if self.local: print('An error log file was written to %s'%self.f_out) lines = open(self.err_log.fname).readlines() self.assertEqual(lines[-1],'Warning (ignored): A warning\n') if __name__ == '__main__': BT.localTest(debug=0)
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) if __name__ == '__main__': BT.localTest() ## pushes test PDBDope instance as 'd' into namespace