Skip to content

Commit

Permalink
Merge pull request #9939 from abretaud/blastdbv5
Browse files Browse the repository at this point in the history
Add BLASTDBv5 datatype (for blast >=2.8.1)
  • Loading branch information
jmchilton authored Sep 8, 2020
2 parents 195f333 + 74aa97f commit 511c3e6
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/galaxy/config/sample/datatypes_conf.xml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,9 @@
<datatype extension="blastdbn" type="galaxy.datatypes.blast:BlastNucDb" mimetype="text/html" display_in_upload="false"/>
<datatype extension="blastdbp" type="galaxy.datatypes.blast:BlastProtDb" mimetype="text/html" display_in_upload="false"/>
<datatype extension="blastdbd" type="galaxy.datatypes.blast:BlastDomainDb" mimetype="text/html" display_in_upload="false"/>
<datatype extension="blastdbn5" type="galaxy.datatypes.blast:BlastNucDb5" mimetype="text/html" display_in_upload="false"/>
<datatype extension="blastdbp5" type="galaxy.datatypes.blast:BlastProtDb5" mimetype="text/html" display_in_upload="false"/>
<datatype extension="blastdbd5" type="galaxy.datatypes.blast:BlastDomainDb5" mimetype="text/html" display_in_upload="false"/>
<datatype extension="maskinfo-asn1" type="galaxy.datatypes.data:GenericAsn1" mimetype="text/plain" subclass="true" display_in_upload="true"/>
<datatype extension="maskinfo-asn1-binary" type="galaxy.datatypes.binary:GenericAsn1Binary" mimetype="application/octet-stream" subclass="true" display_in_upload="true"/>
<datatype extension="pssm-asn1" type="galaxy.datatypes.data:GenericAsn1" mimetype="text/plain" subclass="true" display_in_upload="true"/>
Expand Down
72 changes: 72 additions & 0 deletions lib/galaxy/datatypes/blast.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,3 +306,75 @@ def __init__(self, **kwd):
self.add_composite_file('blastdb.psi', is_binary=True, optional=True)
self.add_composite_file('blastdb.rps', is_binary=True, optional=True)
self.add_composite_file('blastdb.aux', is_binary=True, optional=True)


class BlastNucDb5(_BlastDb, Data):
"""Class for nucleotide BLAST database files."""
file_ext = 'blastdbn5'
allow_datatype_change = False
composite_type = 'basic'

def __init__(self, **kwd):
Data.__init__(self, **kwd)
self.add_composite_file('blastdb.nhr', is_binary=True) # sequence headers
self.add_composite_file('blastdb.nin', is_binary=True) # index file
self.add_composite_file('blastdb.nsq', is_binary=True) # nucleotide sequences
self.add_composite_file('blastdb.nal', is_binary=False, optional=True) # alias ( -gi_mask option of makeblastdb)
self.add_composite_file('blastdb.nhd', is_binary=True, optional=True) # sorted sequence hash values ( -hash_index option of makeblastdb)
self.add_composite_file('blastdb.nhi', is_binary=True, optional=True) # index of sequence hash values ( -hash_index option of makeblastdb)
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)
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)
self.add_composite_file('blastdb.nog', is_binary=True, optional=True) # OID->GI lookup file ( -hash_index or -parse_seqids option of makeblastdb)
self.add_composite_file('blastdb.nsd', is_binary=True, optional=True) # sorted sequence accession values ( -hash_index or -parse_seqids option of makeblastdb)
self.add_composite_file('blastdb.nsi', is_binary=True, optional=True) # index of sequence accession values ( -hash_index or -parse_seqids option of makeblastdb)
# self.add_composite_file('blastdb.00.idx', is_binary=True, optional=True) # first volume of the MegaBLAST index generated by makembindex
# The previous line should be repeated for each index volume, with filename extensions like '.01.idx', '.02.idx', etc.
self.add_composite_file('blastdb.shd', is_binary=True, optional=True) # MegaBLAST index superheader (-old_style_index false option of makembindex)
# self.add_composite_file('blastdb.naa', is_binary=True, optional=True) # index of a WriteDB column for e.g. mask data
# self.add_composite_file('blastdb.nab', is_binary=True, optional=True) # data of a WriteDB column
# self.add_composite_file('blastdb.nac', is_binary=True, optional=True) # multiple byte order for a WriteDB column
# The previous 3 lines should be repeated for each WriteDB column, with filename extensions like ('.nba', '.nbb', '.nbc'), ('.nca', '.ncb', '.ncc'), etc.


class BlastProtDb5(_BlastDb, Data):
"""Class for protein BLAST database files."""
file_ext = 'blastdbp5'
allow_datatype_change = False
composite_type = 'basic'

def __init__(self, **kwd):
Data.__init__(self, **kwd)
# Component file comments are as in BlastNucDb except where noted
self.add_composite_file('blastdb.phr', is_binary=True)
self.add_composite_file('blastdb.pin', is_binary=True)
self.add_composite_file('blastdb.psq', is_binary=True) # protein sequences
self.add_composite_file('blastdb.phd', is_binary=True, optional=True)
self.add_composite_file('blastdb.phi', is_binary=True, optional=True)
self.add_composite_file('blastdb.pnd', is_binary=True, optional=True)
self.add_composite_file('blastdb.pni', is_binary=True, optional=True)
self.add_composite_file('blastdb.pog', is_binary=True, optional=True)
self.add_composite_file('blastdb.psd', is_binary=True, optional=True)
self.add_composite_file('blastdb.psi', is_binary=True, optional=True)
# self.add_composite_file('blastdb.paa', is_binary=True, optional=True)
# self.add_composite_file('blastdb.pab', is_binary=True, optional=True)
# self.add_composite_file('blastdb.pac', is_binary=True, optional=True)
# The last 3 lines should be repeated for each WriteDB column, with filename extensions like ('.pba', '.pbb', '.pbc'), ('.pca', '.pcb', '.pcc'), etc.


class BlastDomainDb5(_BlastDb, Data):
"""Class for domain BLAST database files."""
file_ext = 'blastdbd5'
allow_datatype_change = False
composite_type = 'basic'

def __init__(self, **kwd):
Data.__init__(self, **kwd)
self.add_composite_file('blastdb.phr', is_binary=True)
self.add_composite_file('blastdb.pin', is_binary=True)
self.add_composite_file('blastdb.psq', is_binary=True)
self.add_composite_file('blastdb.freq', is_binary=True, optional=True)
self.add_composite_file('blastdb.loo', is_binary=True, optional=True)
self.add_composite_file('blastdb.psd', is_binary=True, optional=True)
self.add_composite_file('blastdb.psi', is_binary=True, optional=True)
self.add_composite_file('blastdb.rps', is_binary=True, optional=True)
self.add_composite_file('blastdb.aux', is_binary=True, optional=True)

0 comments on commit 511c3e6

Please sign in to comment.