18
|
1 '''
|
|
2 Created on 18 mai 2009
|
|
3
|
|
4 @author: choede
|
|
5 '''
|
|
6 import unittest
|
|
7 import commons.pyRepetUnit.profilesDB.CompleteAProfilesDBFromAFileWithProfilesNamesOrAccNumber
|
|
8
|
|
9
|
|
10 class TestCompleteProfilesDBFromProfilesNameListOrAccNumber(unittest.TestCase):
|
|
11
|
|
12
|
|
13 def setUp(self):
|
|
14 self._fileProfilesList = "./datas/ListPfamProfilsInRepbase.txt"
|
|
15 self._filePfamList = "./datas/ListpfamAccNumber.txt"
|
|
16 self._profilesDB = "./datas/profilesDBTest.hmm"
|
|
17 self.CompleteProfilesDB = commons.pyRepetUnit.profilesDB.CompleteAProfilesDBFromAFileWithProfilesNamesOrAccNumber.CompleteAProfilesDBFromAFileWithProfilesNamesOrAccNumber()
|
|
18 self.CompleteProfilesDB.setProfilesDBFile ( self._profilesDB )
|
|
19 self._expectedList = ["zf-CCHC", "InvE", "Chromo", "TLV_coat"]
|
|
20 self._expectedList2 = ["PF00075", "PF00424", "PF00469"]
|
|
21 self._expectedGetzCmd = "getz -e \'[pfamhmm-Id:\"zf-CCHC*\"] | [pfamhmm-Id:\"InvE*\"] | [pfamhmm-Id:\"Chromo*\"] | [pfamhmm-Id:\"TLV_coat*\"]\'"
|
|
22 self._expectedGetzCmd2 = "getz -e \'[pfamhmm-AccNumber:\"PF00075\"] | [pfamhmm-AccNumber:\"PF00424\"] | [pfamhmm-AccNumber:\"PF00469\"]\'"
|
|
23
|
|
24
|
|
25 def tearDown(self):
|
|
26 pass
|
|
27
|
|
28
|
|
29 def testListNotExistingProfiles(self):
|
|
30 #with name
|
|
31 self.CompleteProfilesDB.setProfilesToAdd ( self._fileProfilesList )
|
|
32 profilesNotInDBList = self.CompleteProfilesDB.generateNotExistingProfilesList( )
|
|
33 i = 0
|
|
34 if profilesNotInDBList != []:
|
|
35 for profil in profilesNotInDBList:
|
|
36 self.assertEquals(profil, self._expectedList[i])
|
|
37 i = i + 1
|
|
38 #with pfam accession number
|
|
39 self.CompleteProfilesDB.setProfilesToAdd ( self._filePfamList )
|
|
40 self.CompleteProfilesDB.setPfamAccNumberKeys ()
|
|
41 profilesNotInDBList = self.CompleteProfilesDB.generateNotExistingProfilesList( )
|
|
42 i = 0
|
|
43 if profilesNotInDBList != []:
|
|
44 for profil in profilesNotInDBList:
|
|
45 self.assertEquals(profil, self._expectedList2[i])
|
|
46 i = i + 1
|
|
47
|
|
48 def testCreateGetzCommand(self):
|
|
49 getzCmd = self.CompleteProfilesDB.generateGetzCmdProfilesList( self._expectedList )
|
|
50 # pour le moment je cherche dans les fs ou les ls si je ne veux que les fs specifier type = fs ce sera surement le cas a terme
|
|
51 self.assertEqual (getzCmd, self._expectedGetzCmd)
|
|
52
|
|
53 def testCmdToCompleteProfileDBFromList(self):
|
|
54 #names list
|
|
55 self.CompleteProfilesDB.setProfilesToAdd ( self._fileProfilesList )
|
|
56 getzCmd = self.CompleteProfilesDB.CmdToCompleteProfileDB()
|
|
57 self.assertEqual (getzCmd, self._expectedGetzCmd)
|
|
58 #pfam accession Number list
|
|
59 self.CompleteProfilesDB.setPfamAccNumberKeys ()
|
|
60 self.CompleteProfilesDB.setProfilesToAdd ( self._filePfamList )
|
|
61 getzCmd = self.CompleteProfilesDB.CmdToCompleteProfileDB()
|
|
62 self.assertEqual (getzCmd, self._expectedGetzCmd2)
|
|
63
|
|
64
|
|
65
|
|
66 if __name__ == "__main__":
|
|
67 unittest.main() |