annotate corebio/ssearch_io/blastxml.py @ 5:b89bb51eba83

Uploaded
author davidmurphy
date Mon, 16 Jan 2012 06:59:52 -0500
parents c55bdc2fb9fa
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
2 # Copyright (c) 2006 John Gilman
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
3 #
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
4 # This software is distributed under the MIT Open Source License.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
5 # <http://www.opensource.org/licenses/mit-license.html>
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
6 #
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
7 # Permission is hereby granted, free of charge, to any person obtaining a
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
8 # copy of this software and associated documentation files (the "Software"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
9 # to deal in the Software without restriction, including without limitation
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
10 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
11 # and/or sell copies of the Software, and to permit persons to whom the
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
12 # Software is furnished to do so, subject to the following conditions:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
13 #
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
14 # The above copyright notice and this permission notice shall be included
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
15 # in all copies or substantial portions of the Software.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
16 #
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
20 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
21 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
22 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
23 # THE SOFTWARE.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
24
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
25
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
26 """Read BLAST XML output.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
27
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
28 The DTD is available at
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
29 http://www.ncbi.nlm.nih.gov/dtd/NCBI_BlastOutput.mod.dtd
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
30
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
31 """
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
32
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
33 # See also
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
34 #
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
35 # http://bugzilla.open-bio.org/show_bug.cgi?id=1933
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
36 #http://portal.open-bio.org/pipermail/biojava-dev/2004-December/002513.html
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
37
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
38
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
39 from corebio.ssearch_io import Report, Result, Hit, Annotation, Alignment
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
40
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
41 import xml.sax
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
42 from xml.sax.handler import ContentHandler
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
43
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
44 __all__ = 'read'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
45
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
46 def read(fin):
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
47 """Read BLAST xml output and return a list of Result objects.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
48 """
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
49 parser = xml.sax.make_parser()
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
50 handler = _BlastHandler()
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
51 parser.setContentHandler(handler)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
52
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
53 #To avoid ValueError: unknown url type: NCBI_BlastOutput.dtd
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
54 parser.setFeature(xml.sax.handler.feature_validation, 0)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
55 parser.setFeature(xml.sax.handler.feature_namespaces, 0)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
56 parser.setFeature(xml.sax.handler.feature_external_pes, 0)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
57 parser.setFeature(xml.sax.handler.feature_external_ges, 0)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
58
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
59 try :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
60 parser.parse(fin)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
61 except xml.sax.SAXParseException, e :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
62 raise ValueError( "Cannot parse file; "+str(e))
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
63 return handler.report
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
64
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
65 class _BlastHandler( ContentHandler) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
66 def __init__(self):
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
67 """
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
68 """
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
69 ContentHandler.__init__(self)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
70 self._content = []
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
71 self.report = None
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
72 self._result = None
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
73 self._hit = None
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
74 self._hsp = None
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
75
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
76
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
77 def characters(self, ch):
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
78 self._content.append(ch)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
79
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
80 def startDocument(self):
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
81 self.report = Report()
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
82
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
83 def endDocument(self) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
84 pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
85
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
86 def startElement(self, name, attr):
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
87 if name == 'BlastOutput' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
88 pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
89 elif name == 'Iteration' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
90 result = Result()
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
91 self._result = result
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
92 self.report.results.append(result)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
93 elif name == 'Parameters' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
94 pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
95 elif name == 'Statistics' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
96 pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
97 elif name == 'Hit' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
98 self._hit = Hit()
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
99 self._result.hits.append(self._hit)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
100 elif name == 'Hsp' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
101 self._hsp = Alignment()
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
102 self._hit.alignments.append(self._hsp)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
103 else :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
104 pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
105
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
106
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
107 def endElement(self, name):
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
108 content = ''.join(self._content).strip()
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
109 self._content = []
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
110
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
111 report = self.report
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
112 result = self._result
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
113 hsp = self._hsp
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
114 hit = self._hit
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
115
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
116 if name == 'BlastOutput' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
117 pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
118 elif name == 'BlastOutput_program' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
119 report.algorithm = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
120 elif name == 'BlastOutput_version' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
121 report.algorithm_version = content.split()[1]
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
122 elif name == 'BlastOutput_reference' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
123 report.algorithm_reference = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
124 elif name == 'BlastOutput_db' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
125 report.database_name = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
126 elif name == 'BlastOutput_query-ID' : pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
127 elif name == 'BlastOutput_query-def' : pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
128 elif name == 'BlastOutput_query-len' : pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
129 elif name == 'BlastOutput_query-seq' : pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
130 elif name == 'BlastOutput_param' : pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
131 elif name == 'BlastOutput_iterations' : pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
132 elif name == 'BlastOutput_mbstat' : pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
133
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
134 elif name == 'Iteration' : pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
135 elif name == 'Iteration_iter-num' : pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
136 elif name == 'Iteration_query-ID' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
137 result.query.name = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
138 elif name == 'Iteration_query-def' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
139 result.query.description = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
140 elif name == 'Iteration_query-len' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
141 result.query.length = int(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
142 elif name == 'Iteration_hits' : pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
143 elif name == 'Iteration_stat' : pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
144 elif name == 'Iteration_message' : pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
145
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
146 elif name == 'Parameters' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
147 pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
148 elif name == 'Parameters_matrix' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
149 report.parameters['matrix'] = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
150 elif name == 'Parameters_expect' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
151 report.parameters['expect'] = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
152 elif name == 'Parameters_include' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
153 report.parameters['include'] = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
154 elif name == 'Parameters_sc-match' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
155 report.parameters['sc-match'] = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
156 elif name == 'Parameters_sc-mismatch' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
157 report.parameters['sc-mismatch'] = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
158 elif name == 'Parameters_gap-open' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
159 report.parameters['gap-open'] = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
160 elif name == 'Parameters_gap-extend' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
161 report.parameters['gap-extend'] = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
162 elif name == 'Parameters_filter' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
163 report.parameters['filter'] = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
164 elif name == 'Parameters_pattern' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
165 report.parameters['pattern'] = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
166 elif name == 'Parameters_entrez-query' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
167 report.parameters['entrez-query'] = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
168
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
169 elif name == 'Statistics' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
170 pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
171 elif name == 'Statistics_db-num' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
172 result.statistics['db-num'] = int(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
173 elif name == 'Statistics_db-len' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
174 result.statistics['db-len'] = int(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
175 elif name == 'Statistics_hsp-len' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
176 result.statistics['hsp-len'] = int(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
177 elif name == 'Statistics_eff-space' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
178 result.statistics['eff-space'] = float(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
179 elif name == 'Statistics_kappa' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
180 result.statistics['kappa'] = float(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
181 elif name == 'Statistics_lambda' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
182 result.statistics['lambda'] = float(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
183 elif name == 'Statistics_entropy' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
184 result.statistics['entropy'] = float(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
185
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
186 elif name == 'Hit' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
187 self._hit = None
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
188 elif name == 'Hit_num' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
189 pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
190 elif name == 'Hit_id' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
191 hit.target.name = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
192 elif name == 'Hit_def' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
193 hit.target.description = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
194 elif name == 'Hit_accession' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
195 hit.target.accession = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
196 elif name == 'Hit_len' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
197 hit.target.length = int(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
198 elif name == 'Hit_hsps' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
199 pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
200
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
201 elif name == 'Hsp' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
202 self._hsp = None
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
203 elif name == 'Hsp_num' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
204 pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
205 elif name == 'Hsp_bit-score' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
206 hsp.bit_score = float(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
207 elif name == 'Hsp_score' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
208 hsp.raw_score = float(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
209 elif name == 'Hsp_evalue' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
210 hsp.significance = float(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
211 elif name == 'Hsp_query-from' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
212 hsp.query_start = int(content) -1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
213 elif name == 'Hsp_query-to' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
214 #hsp.query_end= int(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
215 pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
216 elif name == 'Hsp_hit-from' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
217 hsp.target_start = int(content) -1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
218 elif name == 'Hsp_hit-to' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
219 #hsp.target_end = int(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
220 pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
221 elif name == 'Hsp_pattern-from' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
222 pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
223 elif name == 'Hsp_pattern-to' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
224 pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
225 elif name == 'Hsp_query-frame' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
226 hsp.query_frame = int(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
227 elif name == 'Hsp_hit-frame' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
228 hsp.target_frame = int(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
229 elif name == 'Hsp_identity' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
230 hsp.identical = int(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
231 elif name == 'Hsp_positive' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
232 hsp.similar = int(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
233 elif name == 'Hsp_gaps' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
234 hsp.gaps = int(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
235 elif name == 'Hsp_align-len' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
236 hsp.length = int(content)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
237 elif name == 'Hsp_density' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
238 pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
239 elif name == 'Hsp_qseq' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
240 hsp.query_seq = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
241 elif name == 'Hsp_hseq' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
242 hsp.target_seq = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
243 elif name == 'Hsp_midline' :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
244 hsp.mid_seq = content
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
245 else :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
246 pass
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
247
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
248
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
249