Mercurial > repos > yufei-luo > s_mart
comparison commons/pyRepetUnit/hmmer/check/OldDetectFeatureConfigChecker.py @ 31:0ab839023fe4
Uploaded
author | m-zytnicki |
---|---|
date | Tue, 30 Apr 2013 14:33:21 -0400 |
parents | 94ab73e8a190 |
children |
comparison
equal
deleted
inserted
replaced
30:5677346472b5 | 31:0ab839023fe4 |
---|---|
1 ''' | |
2 Created on 14 avr. 2009 | |
3 | |
4 @author: oinizan | |
5 ''' | |
6 import re | |
7 from commons.core.checker.IChecker import IChecker | |
8 from commons.core.checker.OldConfigChecker import ConfigChecker | |
9 from commons.core.checker.ConfigException import ConfigException | |
10 from commons.core.checker.CheckerException import CheckerException | |
11 | |
12 class DetectFeatureConfigChecker (IChecker): | |
13 ''' | |
14 classdocs | |
15 ''' | |
16 def __init__(self): | |
17 ''' | |
18 Constructor | |
19 ''' | |
20 self._dict = {"te_hmmer" : "", | |
21 "te_blrn" : "" | |
22 } | |
23 self._specifiqueDict = {"te_hmmer_evalue" : "", | |
24 "te_hmm_profiles" : "" | |
25 } | |
26 | |
27 def _appendMessageToConfigExceptionMessage(self, messages): | |
28 appendedMessages = [] | |
29 for msg in messages: | |
30 if (re.match("\[detect_features\] - No option 'te_hmm_profiles' in section: 'detect_features'", msg)): | |
31 appendedMessages.append(msg + " whereas te_hmmer is set") | |
32 | |
33 if (re.match("\[detect_features\] - No option 'te_hmmer_evalue' in section: 'detect_features'", msg)): | |
34 appendedMessages.append(msg + " whereas te_hmmer is set - Default value will be set") | |
35 | |
36 return appendedMessages | |
37 | |
38 | |
39 def check(self, configFile): | |
40 chk = ConfigChecker("detect_features", self._dict) | |
41 try : | |
42 chk.check(configFile) | |
43 except ConfigException, e : | |
44 raise e | |
45 | |
46 if self._dict["te_hmmer"] == "yes": | |
47 isErrorOccured = False | |
48 try: | |
49 chk = ConfigChecker("detect_features", self._specifiqueDict) | |
50 chk.check(configFile) | |
51 except ConfigException, e: | |
52 appendedMessages = self._appendMessageToConfigExceptionMessage(e.messages) | |
53 raise ConfigException("", appendedMessages) | |
54 | |
55 | |
56 if __name__ == "__main__": | |
57 pass |