1
2
3
4
5 """
6 Classes for parsing AlignAce and CompareACE files.
7
8 This module is DEPRECATED; please use Bio.Motif.Parsers.AlignAce instead.
9 """
10
11 import warnings
12 warnings.warn('Bio.AlignAce is deprecated. Please use Bio.Motif instead.',
13 DeprecationWarning)
14
15
16 from Bio.ParserSupport import *
17 from Scanner import AlignAceScanner,CompareAceScanner
18 from Motif import Motif
19 from Bio.Alphabet import IUPAC
20 from Bio.Seq import Seq
21
22
24 """
25 The general purpose consumer for the AlignAceScanner.
26
27 Should be passed as the consumer to the feed method of the AlignAceScanner. After 'consuming' the file, it has the list of motifs in the motifs property.
28 """
30 self.motifs=[]
31 self.current_motif=None
32 self.param_dict = None
33
36
38 par_name = line.split("=")[0].strip()
39 par_value = line.split("=")[1].strip()
40 self.param_dict[par_name]=par_value
41
44
46 seq_name = line.split("\t")[1]
47 self.seq_dict.append(seq_name)
48
53
57
59 self.current_motif.score = float(line.split()[-1])
60
63
66
69
72
74 """Parses AlignAce data into a sequence of Motifs.
75 """
80
82 """parse(self, handle)"""
83 self._scanner.feed(handle, self._consumer)
84 return self._consumer.motifs
85
86
88 """
89 The general purpose consumer for the CompareAceScanner.
90
91 Should be passed as the consumer to the feed method of the CompareAceScanner. After 'consuming' the file, it has the list of motifs in the motifs property.
92 """
97
99 """Parses CompareAce output to usable form
100
101 ### so far only in a very limited way
102 """
107
108 - def parse(self, handle):
109 """parse(self, handle)"""
110 self._scanner.feed(handle, self._consumer)
111 return self._consumer.data
112