Last active
December 7, 2015 13:21
-
-
Save CS76/5afd1d3c9689b5b0f397 to your computer and use it in GitHub Desktop.
cdf Datatype Extension - IPO - Galaxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" ipo-galaxy/lib/galaxy/datatypes/binary.py """ | |
class Cdf( Binary ): | |
"""Generic CDF file datatype implementation""" | |
file_ext = 'cdf' | |
def __init__( self, **kwd ): | |
Binary.__init__( self, **kwd ) | |
def sniff( self, filename ): | |
cdf_header = binascii.hexlify('CDF') | |
try: | |
header = open(filename).read(3) | |
if binascii.b2a_hex(header) == cdf_header: | |
return True | |
header = gzip.open( filename ).read(3) | |
if binascii.b2a_hex(header) == cdf_header: | |
return True | |
except: | |
return False | |
Binary.register_sniffable_binary_format('cdf', 'cdf', Cdf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- ipo-galaxy/config/datatypes_conf.xml --> | |
// sniffer | |
<sniffer type="galaxy.datatypes.binary:Cdf" /> | |
// registration | |
<!-- Metabolomics Data types --> | |
<datatype extension="cdf" type="galaxy.datatypes.binary:Cdf" display_in_upload="true" description="Metabolights study formats"/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment