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