comparison cuffquant.py @ 7:27ec5b7e46aa draft default tip

Deleted selected files
author geert-vandeweyer
date Mon, 04 Aug 2014 09:50:39 -0400
parents 6eefa441d9c7
children
comparison
equal deleted inserted replaced
6:6eefa441d9c7 7:27ec5b7e46aa
1 """
2 Cuffquant format class
3 """
4 import logging
5 import re
6 import binascii
7
8 from galaxy.datatypes.sniff import *
9 from galaxy.datatypes import data
10 from galaxy.datatypes.binary import Binary
11
12 log = logging.getLogger(__name__)
13
14 class Cuffquant( Binary ):
15 """Class describing a CuffQuant output file"""
16 file_ext = "cxb"
17 def sniff(self,filename):
18 # cuffquant cxb file is not documented. the file seems to start with 'serialization::'
19 try:
20 header = open(filename).read(23)
21 if header == 'serialization::':
22 return True
23 return False
24 except:
25 return False
26
27 def set_peek( self, dataset, is_multi_byte=False):
28 if not dataset.dataset.purged:
29 dataset.peek = 'Cuffquant cxb file'
30 dataset.blurb = data.nice_size( dataset.get_size())
31 else:
32 dataset.peek = 'file does not exist'
33 dataset.blurb = 'file purged from disk'
34 def display_peek (self,dataset):
35 try:
36 return dataset.peek
37 except:
38 return "Cuffquant output file (%s)" % ( data.nice_size( dataset.get_size() ) )
39
40 if hasattr(Binary, 'register_sniffable_binary_format'):
41 Binary.register_sniffable_binary_format('cxb', 'cxb', Cuffquant)