Mercurial > repos > sauria > hifive
comparison galaxy.datatypes.mrh.py @ 1:cb4f92e6fd4e draft
planemo upload for repository https://github.com/bxlab/galaxy_tools/suites/suite_hifive commit ded5555ebf85f4807cbe4f1bf1945a757bdc724d
| author | sauria |
|---|---|
| date | Wed, 26 Aug 2015 16:53:42 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:0a9c76d80e33 | 1:cb4f92e6fd4e |
|---|---|
| 1 from galaxy import eggs | |
| 2 | |
| 3 import pkg_resources | |
| 4 pkg_resources.require( "bx-python" ) | |
| 5 | |
| 6 import logging, os, sys, time, sets, tempfile, shutil | |
| 7 import data | |
| 8 from galaxy import util | |
| 9 from galaxy.datatypes.sniff import * | |
| 10 from cgi import escape | |
| 11 import urllib | |
| 12 from bx.intervals.io import * | |
| 13 from galaxy.datatypes import metadata | |
| 14 from galaxy.datatypes.metadata import MetadataElement | |
| 15 from galaxy.datatypes.binary import Binary | |
| 16 | |
| 17 | |
| 18 class Mrh( Binary ): | |
| 19 """Class describing a MRH file""" | |
| 20 file_ext = "mrh" | |
| 21 | |
| 22 def sniff( self, filename ): | |
| 23 # MRH is a binary file type. | |
| 24 # The first 8 bytes of any mrh file is '42054205'. | |
| 25 try: | |
| 26 header = open( filename, 'rb' ).read(8) | |
| 27 if binascii.b2a_hex( header ) == binascii.hexlify( '42054205' ): | |
| 28 return True | |
| 29 return False | |
| 30 except: | |
| 31 return False | |
| 32 | |
| 33 Binary.register_sniffable_binary_format("mrh", "mrh", Mrh) |
