Mercurial > repos > geert-vandeweyer > cuffquant_datatype
view cuffquant.py @ 2:c686547890fe draft
Uploaded
author | geert-vandeweyer |
---|---|
date | Mon, 04 Aug 2014 08:51:34 -0400 |
parents | e12a09256097 |
children | 6e8401ee1949 |
line wrap: on
line source
""" Cuffquant format class """ import logging import re import binascii from galaxy.datatypes.sniff import * from galaxy.datatypes import data from galaxy.datatypes.data import Binary #from galaxy.datatypes.binary import Binary #from galaxy.datatypes.tabular import Tabular #from galaxy.datatypes.interval import Gff log = logging.getLogger(__name__) class Cuffquant( Binary ): """Class describing a CuffQuant output file""" file_ext = "cxb" def sniff(self,filename): # cuffquant cxb file is not documented. the file seems to start with 'serialization::' try: header = open(filename).read(23) if header == 'serialization::': return True return False except: return False def set_peek( self, dataset, is_multi_byte=False): if not dataset.dataset.purged: dataset.peek = 'Cuffquant cxb file' dataset.blurb = data.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: return "Cuffquant output file (%s)" % ( data.nice_size( dataset.get_size() ) ) if hasattr(Binary, 'register_sniffable_binary_format'): Binary.register_sniffable_binary_format('cxb', 'cxb', Cuffquant)