add vel datatype,register and example

This commit is contained in:
Chris Barnett
2018-08-20 15:42:51 +02:00
parent 3fc40c16a3
commit 33794fa318
3 changed files with 54 additions and 0 deletions
+2
View File
@@ -575,6 +575,7 @@
<datatype extension="pdbqt" type="galaxy.datatypes.molecules:PDBQT" display_in_upload="true"/>
<datatype extension="trr" type="galaxy.datatypes.binary:Trr" display_in_upload="true"/>
<datatype extension="dcd" type="galaxy.datatypes.binary:Dcd" display_in_upload="true"/>
<datatype extension="vel" type="galaxy.datatypes.binary:Vel" display_in_upload="true"/>
<datatype extension="grd" type="galaxy.datatypes.molecules:grd" display_in_upload="true"/>
<datatype extension="grd.tgz" type="galaxy.datatypes.molecules:grdtgz" display_in_upload="true"/>
<!-- mothur formats -->
@@ -727,6 +728,7 @@
<sniffer type="galaxy.datatypes.binary:Idat"/>
<sniffer type="galaxy.datatypes.binary:Trr"/>
<sniffer type="galaxy.datatypes.binary:Dcd"/>
<sniffer type="galaxy.datatypes.binary:Vel"/>
<sniffer type="galaxy.datatypes.annotation:Augustus"/>
<sniffer type="galaxy.datatypes.triples:Rdf"/>
<sniffer type="galaxy.datatypes.blast:BlastXml"/>
+52
View File
@@ -1959,6 +1959,58 @@ class Dcd(Binary):
return "Binary CHARMM/NAMD dcd file (%s)" % (nice_size(dataset.get_size()))
class Vel(Binary):
"""
Class describing a velocity file from the CHARMM molecular simulation program
>>> from galaxy.datatypes.sniff import get_test_fname
>>> fname = get_test_fname('test_charmm.vel')
>>> Vel().sniff(fname)
True
>>> fname = get_test_fname('interval.interval')
>>> Vel().sniff(fname)
False
"""
file_ext = "vel"
edam_format = "format_3842" # molecular simulation data
def __init__(self, **kwd):
Binary.__init__(self, **kwd)
self._magic_number = b'VELD'
def sniff(self, filename):
# Match the keyword 'VELD' at position 4 or 8 - intsize dependent
# Not checking for endianness
try:
with open(filename, 'rb') as header:
intsize = 4
header.seek(intsize)
if header.read(intsize) == self._magic_number:
return True
else:
intsize = 8
header.seek(intsize)
if header.read(intsize) == self._magic_number:
return True
return False
except Exception:
return False
def set_peek(self, dataset, is_multi_byte=False):
if not dataset.dataset.purged:
dataset.peek = "Binary CHARMM velocity file"
dataset.blurb = nice_size(dataset.get_size())
else:
dataset.peek = 'file does not exist'
dataset.blurb = 'file purged from disk'
def display_peek(self, dataset):
try:
return dataset.peek
except Exception:
return "Binary CHARMM velocity file (%s)" % (nice_size(dataset.get_size()))
class DAA(Binary):
"""
Class describing an DAA (diamond alignment archive) file
Binary file not shown.