1
2
3
4
5 """
6 Classes for parsing AlignAce and CompareACE files.
7
8 This module is OBSOLETE; please use Bio.Motif.Parsers.AlignAce instead.
9 """
10
11 from Bio.ParserSupport import *
12 from Scanner import AlignAceScanner,CompareAceScanner
13 from Motif import Motif
14 from Bio.Alphabet import IUPAC
15 from Bio.Seq import Seq
16
17
19 """
20 The general purpose consumer for the AlignAceScanner.
21
22 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.
23 """
25 self.motifs=[]
26 self.current_motif=None
27 self.param_dict = None
28
31
33 par_name = line.split("=")[0].strip()
34 par_value = line.split("=")[1].strip()
35 self.param_dict[par_name]=par_value
36
39
41 seq_name = line.split("\t")[1]
42 self.seq_dict.append(seq_name)
43
48
52
54 self.current_motif.score = float(line.split()[-1])
55
58
61
64
67
69 """Parses AlignAce data into a sequence of Motifs.
70 """
75
77 """parse(self, handle)"""
78 self._scanner.feed(handle, self._consumer)
79 return self._consumer.motifs
80
81
83 """
84 The general purpose consumer for the CompareAceScanner.
85
86 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.
87 """
92
94 """Parses CompareAce output to usable form
95
96 ### so far only in a very limited way
97 """
102
103 - def parse(self, handle):
104 """parse(self, handle)"""
105 self._scanner.feed(handle, self._consumer)
106 return self._consumer.data
107