Mercurial > repos > devteam > blast_datatypes
comparison blast.py @ 5:b3a3ba0c1d47
Uploaded v0.0.15 which updates the BLAST database definitions.
Fixes a MetadataElement bug and includes more of the optional
BLAST database files (contribution from Nicola Soranzo).
author | peterjc |
---|---|
date | Wed, 20 Mar 2013 10:39:27 -0400 |
parents | f9a7783ed7b6 |
children | a44a7a5456e1 |
comparison
equal
deleted
inserted
replaced
4:f9a7783ed7b6 | 5:b3a3ba0c1d47 |
---|---|
4 | 4 |
5 from galaxy.datatypes.data import get_file_peek | 5 from galaxy.datatypes.data import get_file_peek |
6 from galaxy.datatypes.data import Text, Data | 6 from galaxy.datatypes.data import Text, Data |
7 from galaxy.datatypes.xml import GenericXml | 7 from galaxy.datatypes.xml import GenericXml |
8 from galaxy.datatypes.metadata import MetadataElement | 8 from galaxy.datatypes.metadata import MetadataElement |
9 | |
9 | 10 |
10 class BlastXml( GenericXml ): | 11 class BlastXml( GenericXml ): |
11 """NCBI Blast XML Output data""" | 12 """NCBI Blast XML Output data""" |
12 file_ext = "blastxml" | 13 file_ext = "blastxml" |
13 | 14 |
172 | 173 |
173 class BlastNucDb( _BlastDb, Data ): | 174 class BlastNucDb( _BlastDb, Data ): |
174 """Class for nucleotide BLAST database files.""" | 175 """Class for nucleotide BLAST database files.""" |
175 file_ext = 'blastdbn' | 176 file_ext = 'blastdbn' |
176 composite_type ='basic' | 177 composite_type ='basic' |
177 MetadataElement( readonly=True, optional=True, visible=False, no_value=0 ) | 178 |
178 | 179 def __init__(self, **kwd): |
179 def __init__(self,**kwd): | |
180 Data.__init__(self, **kwd) | 180 Data.__init__(self, **kwd) |
181 self.add_composite_file('blastdb.nhr') | 181 self.add_composite_file('blastdb.nhr', is_binary=True) # sequence headers |
182 self.add_composite_file('blastdb.nin') | 182 self.add_composite_file('blastdb.nin', is_binary=True) # index file |
183 self.add_composite_file('blastdb.nsq') | 183 self.add_composite_file('blastdb.nsq', is_binary=True) # nucleotide sequences |
184 self.add_composite_file('blastdb.nhd', optional=True) | 184 self.add_composite_file('blastdb.nal', is_binary=False, optional=True) # alias ( -gi_mask option of makeblastdb) |
185 self.add_composite_file('blastdb.nsi', optional=True) | 185 self.add_composite_file('blastdb.nhd', is_binary=True, optional=True) # sorted sequence hash values ( -hash_index option of makeblastdb) |
186 self.add_composite_file('blastdb.nhi', optional=True) | 186 self.add_composite_file('blastdb.nhi', is_binary=True, optional=True) # index of sequence hash values ( -hash_index option of makeblastdb) |
187 self.add_composite_file('blastdb.nog', optional=True) | 187 self.add_composite_file('blastdb.nnd', is_binary=True, optional=True) # sorted GI values ( -parse_seqids option of makeblastdb and gi present in the description lines) |
188 self.add_composite_file('blastdb.nsd', optional=True) | 188 self.add_composite_file('blastdb.nni', is_binary=True, optional=True) # index of GI values ( -parse_seqids option of makeblastdb and gi present in the description lines) |
189 self.add_composite_file('blastdb.nog', is_binary=True, optional=True) # OID->GI lookup file ( -hash_index or -parse_seqids option of makeblastdb) | |
190 self.add_composite_file('blastdb.nsd', is_binary=True, optional=True) # sorted sequence accession values ( -hash_index or -parse_seqids option of makeblastdb) | |
191 self.add_composite_file('blastdb.nsi', is_binary=True, optional=True) # index of sequence accession values ( -hash_index or -parse_seqids option of makeblastdb) | |
192 # self.add_composite_file('blastdb.naa', is_binary=True, optional=True) # index of a WriteDB column for e.g. mask data | |
193 # self.add_composite_file('blastdb.nab', is_binary=True, optional=True) # data of a WriteDB column | |
194 # self.add_composite_file('blastdb.nac', is_binary=True, optional=True) # multiple byte order for a WriteDB column | |
195 # The last 3 lines should be repeated for each WriteDB column, with filename extensions like ('.nba', '.nbb', '.nbc'), ('.nca', '.ncb', '.ncc'), etc. | |
189 | 196 |
190 def display_data(self, trans, data, preview=False, filename=None, | 197 def display_data(self, trans, data, preview=False, filename=None, |
191 to_ext=None, size=None, offset=None, **kwd): | 198 to_ext=None, size=None, offset=None, **kwd): |
192 """Apparently an old display method, but still gets called. | 199 """Apparently an old display method, but still gets called. |
193 | 200 |
194 This allows us to format the data shown in the central pane via the "eye" icon. | 201 This allows us to format the data shown in the central pane via the "eye" icon. |
195 """ | 202 """ |
196 return "This is a BLAST nucleotide database." | 203 return "This is a BLAST nucleotide database." |
204 | |
197 | 205 |
198 class BlastProtDb( _BlastDb, Data ): | 206 class BlastProtDb( _BlastDb, Data ): |
199 """Class for protein BLAST database files.""" | 207 """Class for protein BLAST database files.""" |
200 file_ext = 'blastdbp' | 208 file_ext = 'blastdbp' |
201 composite_type ='basic' | 209 composite_type ='basic' |
202 MetadataElement( readonly=True, optional=True, visible=False, no_value=0 ) | 210 |
203 | 211 def __init__(self, **kwd): |
204 def __init__(self,**kwd): | |
205 Data.__init__(self, **kwd) | 212 Data.__init__(self, **kwd) |
206 self.add_composite_file('blastdb.phr') | 213 # Component file comments are as in BlastNucDb except where noted |
207 self.add_composite_file('blastdb.pin') | 214 self.add_composite_file('blastdb.phr', is_binary=True) |
208 self.add_composite_file('blastdb.psq') | 215 self.add_composite_file('blastdb.pin', is_binary=True) |
209 self.add_composite_file('blastdb.pnd', optional=True) | 216 self.add_composite_file('blastdb.psq', is_binary=True) # protein sequences |
210 self.add_composite_file('blastdb.pni', optional=True) | 217 self.add_composite_file('blastdb.phd', is_binary=True, optional=True) |
211 self.add_composite_file('blastdb.psd', optional=True) | 218 self.add_composite_file('blastdb.phi', is_binary=True, optional=True) |
212 self.add_composite_file('blastdb.psi', optional=True) | 219 self.add_composite_file('blastdb.pnd', is_binary=True, optional=True) |
213 self.add_composite_file('blastdb.psq', optional=True) | 220 self.add_composite_file('blastdb.pni', is_binary=True, optional=True) |
214 self.add_composite_file('blastdb.phd', optional=True) | 221 self.add_composite_file('blastdb.pog', is_binary=True, optional=True) |
215 self.add_composite_file('blastdb.phi', optional=True) | 222 self.add_composite_file('blastdb.psd', is_binary=True, optional=True) |
216 self.add_composite_file('blastdb.pog', optional=True) | 223 self.add_composite_file('blastdb.psi', is_binary=True, optional=True) |
224 # self.add_composite_file('blastdb.paa', is_binary=True, optional=True) | |
225 # self.add_composite_file('blastdb.pab', is_binary=True, optional=True) | |
226 # self.add_composite_file('blastdb.pac', is_binary=True, optional=True) | |
227 # The last 3 lines should be repeated for each WriteDB column, with filename extensions like ('.pba', '.pbb', '.pbc'), ('.pca', '.pcb', '.pcc'), etc. | |
217 | 228 |
218 def display_data(self, trans, data, preview=False, filename=None, | 229 def display_data(self, trans, data, preview=False, filename=None, |
219 to_ext=None, size=None, offset=None, **kwd): | 230 to_ext=None, size=None, offset=None, **kwd): |
220 """Apparently an old display method, but still gets called. | 231 """Apparently an old display method, but still gets called. |
221 | 232 |