|
0
|
1 """
|
|
|
2 Cuffquant format class
|
|
|
3 """
|
|
|
4 import logging
|
|
|
5 import re
|
|
|
6 import binascii
|
|
|
7
|
|
1
|
8 from galaxy.datatypes.sniff import *
|
|
0
|
9 from galaxy.datatypes import data
|
|
2
|
10 from galaxy.datatypes.data import Binary
|
|
|
11 #from galaxy.datatypes.binary import Binary
|
|
|
12 #from galaxy.datatypes.tabular import Tabular
|
|
|
13 #from galaxy.datatypes.interval import Gff
|
|
0
|
14
|
|
|
15 log = logging.getLogger(__name__)
|
|
|
16
|
|
|
17 class Cuffquant( Binary ):
|
|
|
18 """Class describing a CuffQuant output file"""
|
|
|
19 file_ext = "cxb"
|
|
|
20 def sniff(self,filename):
|
|
|
21 # cuffquant cxb file is not documented. the file seems to start with 'serialization::'
|
|
|
22 try:
|
|
|
23 header = open(filename).read(23)
|
|
|
24 if header == 'serialization::':
|
|
|
25 return True
|
|
|
26 return False
|
|
|
27 except:
|
|
|
28 return False
|
|
|
29
|
|
|
30 def set_peek( self, dataset, is_multi_byte=False):
|
|
|
31 if not dataset.dataset.purged:
|
|
|
32 dataset.peek = 'Cuffquant cxb file'
|
|
|
33 dataset.blurb = data.nice_size( dataset.get_size())
|
|
|
34 else:
|
|
|
35 dataset.peek = 'file does not exist'
|
|
|
36 dataset.blurb = 'file purged from disk'
|
|
|
37 def display_peek (self,dataset):
|
|
|
38 try:
|
|
|
39 return dataset.peek
|
|
|
40 except:
|
|
|
41 return "Cuffquant output file (%s)" % ( data.nice_size( dataset.get_size() ) )
|
|
|
42
|
|
|
43 if hasattr(Binary, 'register_sniffable_binary_format'):
|
|
|
44 Binary.register_sniffable_binary_format('cxb', 'cxb', Cuffquant)
|