comparison homer.py @ 55:e9cd105a8856

Uploaded
author bgruening
date Mon, 12 Aug 2013 09:06:47 -0400
parents 675d25a0b9d4
children 07a5042bbe90
comparison
equal deleted inserted replaced
54:675d25a0b9d4 55:e9cd105a8856
6 from galaxy.datatypes.data import Text, Data 6 from galaxy.datatypes.data import Text, Data
7 from galaxy.datatypes.metadata import MetadataElement 7 from galaxy.datatypes.metadata import MetadataElement
8 from galaxy.datatypes.images import Html 8 from galaxy.datatypes.images import Html
9 9
10 10
11 class TagDirectory(object): 11 class TagDirectory( Text ):
12 """Base class for HOMER's Tag Directory datatype.""" 12 """Base class for HOMER's Tag Directory datatype."""
13 13
14 file_ext = 'homer_tagdir' 14 file_ext = 'homer_tagdir'
15 composite_type = 'auto_primary_file' 15 composite_type = 'auto_primary_file'
16 allow_datatype_change = False 16 allow_datatype_change = False
23 self.add_composite_file('tagAutocorrelation.txt', description = 'distribution of distances between adjacent reads in the genome', mimetype = 'text/html') # The autocorrelation routine creates a distribution of distances between adjacent reads in the genome. 23 self.add_composite_file('tagAutocorrelation.txt', description = 'distribution of distances between adjacent reads in the genome', mimetype = 'text/html') # The autocorrelation routine creates a distribution of distances between adjacent reads in the genome.
24 self.add_composite_file('tagFreq.txt', description = "nucleotide and dinucleotide frequencies as a function of distance from the 5' end of all reads", mimetype = 'text/html', optional=True) # Calculates the nucleotide and dinucleotide frequencies as a function of distance from the 5' end of all reads. 24 self.add_composite_file('tagFreq.txt', description = "nucleotide and dinucleotide frequencies as a function of distance from the 5' end of all reads", mimetype = 'text/html', optional=True) # Calculates the nucleotide and dinucleotide frequencies as a function of distance from the 5' end of all reads.
25 self.add_composite_file('tagFreqUniq.txt', description = "nucleotide and dinucleotide frequencies as a function of distance from the 5' end of all reads (counted only once)", mimetype = 'text/html', optional=True) # Same as tagFreq.txt, however individual genomic positions are only counted once. 25 self.add_composite_file('tagFreqUniq.txt', description = "nucleotide and dinucleotide frequencies as a function of distance from the 5' end of all reads (counted only once)", mimetype = 'text/html', optional=True) # Same as tagFreq.txt, however individual genomic positions are only counted once.
26 self.add_composite_file('tagGCcontent.txt', description = 'Distribution of fragment GC%-content', mimetype = 'text/html', optional=True) # Distribution of fragment GC%-content. 26 self.add_composite_file('tagGCcontent.txt', description = 'Distribution of fragment GC%-content', mimetype = 'text/html', optional=True) # Distribution of fragment GC%-content.
27 self.add_composite_file('genomeGCcontent.txt', description = 'Distribution of fragment GC%-content at each location in the genome', mimetype = 'text/html', optional=True) # Distribution of fragment GC%-content at each location in the genome. 27 self.add_composite_file('genomeGCcontent.txt', description = 'Distribution of fragment GC%-content at each location in the genome', mimetype = 'text/html', optional=True) # Distribution of fragment GC%-content at each location in the genome.
28
29
30 def regenerate_primary_file(self,dataset):
31 """
32 cannot do this until we are setting metadata
33 """
34 flist = os.listdir(dataset.extra_files_path)
35 rval = ['<html><head><title>CuffDiff Output</title></head>']
36 rval.append('<body>')
37 rval.append('<p/>CuffDiff Outputs:<p/><ul>')
38 for i,fname in enumerate(flist):
39 sfname = os.path.split(fname)[-1]
40 rval.append( '<li><a href="%s" type="text/html">%s</a>' % ( sfname, sfname ) )
41 rval.append( '</ul></body></html>' )
42 f = file(dataset.file_name,'w')
43 f.write("\n".join( rval ))
44 f.write('\n')
45 f.close()
46
47 def set_meta( self, dataset, **kwd ):
48 Text.set_meta( self, dataset, **kwd )
49 self.regenerate_primary_file(dataset)
50
28 51
29 def generate_primary_file( self, dataset = None ): 52 def generate_primary_file( self, dataset = None ):
30 rval = ['<html><head><title>HOMER database files</title></head><ul>'] 53 rval = ['<html><head><title>HOMER database files</title></head><ul>']
31 for composite_name, composite_file in self.get_composite_files( dataset = dataset ).iteritems(): 54 for composite_name, composite_file in self.get_composite_files( dataset = dataset ).iteritems():
32 opt_text = '' 55 opt_text = ''