Mercurial > repos > jjohnson > cummerbund
comparison cuffdata.py @ 1:6a9bc26ab8d9
Added cuffdata and cuffdatadb datatypes, cuffdiff multiselect outputs
| author | Jim Johnson <jj@umn.edu> |
|---|---|
| date | Mon, 08 Oct 2012 15:26:47 -0500 |
| parents | |
| children | 9d25b0fd882b |
comparison
equal
deleted
inserted
replaced
| 0:8ba5f0460b1e | 1:6a9bc26ab8d9 |
|---|---|
| 1 """ | |
| 2 CuffData | |
| 3 """ | |
| 4 import logging | |
| 5 import os,os.path,re | |
| 6 import galaxy.datatypes.data | |
| 7 from galaxy.datatypes.images import Html | |
| 8 from galaxy import util | |
| 9 from galaxy.datatypes.metadata import MetadataElement | |
| 10 | |
| 11 log = logging.getLogger(__name__) | |
| 12 | |
| 13 class CuffDiffData( Html ): | |
| 14 """ | |
| 15 CuffDiff output files: | |
| 16 run.info | |
| 17 read_groups.info | |
| 18 cds.count_tracking | |
| 19 cds.diff | |
| 20 cds.fpkm_tracking | |
| 21 cds.read_group_tracking | |
| 22 cds_exp.diff | |
| 23 gene_exp.diff | |
| 24 genes.count_tracking | |
| 25 genes.fpkm_tracking | |
| 26 genes.read_group_tracking | |
| 27 isoform_exp.diff | |
| 28 isoforms.count_tracking | |
| 29 isoforms.fpkm_tracking | |
| 30 isoforms.read_group_tracking | |
| 31 promoters.diff | |
| 32 splicing.diff | |
| 33 tss_group_exp.diff | |
| 34 tss_groups.count_tracking | |
| 35 tss_groups.fpkm_tracking | |
| 36 tss_groups.read_group_tracking | |
| 37 """ | |
| 38 file_ext = 'cuffdata' | |
| 39 is_binary = True | |
| 40 composite_type = 'auto_primary_file' | |
| 41 allow_datatype_change = False | |
| 42 | |
| 43 def generate_primary_file( self, dataset = None ): | |
| 44 """ | |
| 45 This is called only at upload to write the html file | |
| 46 cannot rename the datasets here - they come with the default unfortunately | |
| 47 """ | |
| 48 return '<html><head></head><body>AutoGenerated Primary File for Composite Dataset</body></html>' | |
| 49 | |
| 50 def regenerate_primary_file(self,dataset): | |
| 51 """ | |
| 52 cannot do this until we are setting metadata | |
| 53 """ | |
| 54 flist = os.listdir(dataset.extra_files_path) | |
| 55 rval = ['<html><head><title>CuffDiff Output</title></head>'] | |
| 56 rval.append('<body>') | |
| 57 rval.append('<p/>CuffDiff Outputs:<p/><ul>') | |
| 58 for i,fname in enumerate(flist): | |
| 59 sfname = os.path.split(fname)[-1] | |
| 60 rval.append( '<li><a href="%s" type="text/html">%s</a>' % ( sfname, sfname ) ) | |
| 61 rval.append( '</ul></body></html>' ) | |
| 62 f = file(dataset.file_name,'w') | |
| 63 f.write("\n".join( rval )) | |
| 64 f.write('\n') | |
| 65 f.close() | |
| 66 | |
| 67 def set_meta( self, dataset, **kwd ): | |
| 68 Html.set_meta( self, dataset, **kwd ) | |
| 69 self.regenerate_primary_file(dataset) | |
| 70 | |
| 71 def sniff( self, filename ): | |
| 72 return False | |
| 73 |
