Add customtrack datatype. This is a skeleton class for now, allows viewing at ucsc and formatted

peeking.
This commit is contained in:
Daniel Blankenberg
2007-03-09 21:28:09 +00:00
parent 496ba08a30
commit 5f67a58a9b
6 changed files with 24 additions and 7 deletions
+2 -1
View File
@@ -23,7 +23,8 @@ datatypes_by_extension = {
'gmaj.zip' : images.Gmaj(),
'laj' : images.Laj(),
'lav' : sequence.Lav(),
'html' : images.Html()
'html' : images.Html(),
'customtrack' : interval.CustomTrack()
}
def get_datatype_by_extension( ext ):
+16
View File
@@ -236,6 +236,22 @@ class Gff( Tabular ):
def make_html_table(self, data):
return Tabular.make_html_table(self, data, skipchar='#')
#Extend Tabular type, since interval tools will fail on track def line (we should fix this)
#This is a skeleton class for now, allows viewing at ucsc and formatted peeking.
class CustomTrack ( Tabular ):
"""UCSC CustomTrack"""
def __init__(self, id=None):
data.Text.__init__(self, id=id)
def make_html_table(self, dataset):
return Tabular.make_html_table(self, dataset, skipchar='track')
def bed_viewport( self, dataset ):
return "." #Not ideal solution, will cause genome browser to give warning
def as_bedfile( self, dataset ):
return dataset.file_name
if __name__ == '__main__':
import doctest, sys
doctest.testmod(sys.modules[__name__])
+1 -1
View File
@@ -117,7 +117,7 @@ class Universe(common.Root):
"""Returns a bed file"""
data = self.app.model.Dataset.get( id )
if data:
if isinstance(data.datatype, datatypes.interval.Interval):
if isinstance(data.datatype, datatypes.interval.Interval) or isinstance(data.datatype, datatypes.interval.CustomTrack):
mime = data.get_mime()
trans.response.set_content_type(mime)
file_name = data.as_bedfile()
+1 -1
View File
@@ -74,7 +74,7 @@ text_types = sets.Set([
'regions', 'simple', 'score', 'text', 'msf', 'selex', 'tagseq', 'embl', 'srspair', 'staden',
'strider', 'xbed', 'markx10', 'pair', 'markx1', 'markx0', 'markx3', 'markx2', 'jackknifer',
'ncbi', 'mega', 'fa', 'feattable', 'phylip', 'diffseq', 'bed', 'srs', 'jackknifernon', 'swiss',
'phylipnon', 'nexusnon', 'nametable', 'xml', 'interval', 'tabular', 'maf','axt', 'lav', 'laj'
'phylipnon', 'nexusnon', 'nametable', 'xml', 'interval', 'tabular', 'maf','axt', 'lav', 'laj', 'customtrack'
])
def parse_xml(fname):
+1 -1
View File
@@ -203,7 +203,7 @@ main();">
#if $data.ext in [ "bed", "interval", "tabular", "txt", "text", "axt", "maf", "fasta", "gff", "gmaj.zip" ]:
<a href="display?id=$data.id&tofile=yes&toext=$data.ext" target="_blank">save</a>
#end if
#if $data.ext in ["bed", "interval" ]:
#if $data.ext in ["bed", "interval", "customtrack" ]:
#set $value = $data.bed_viewport()
#if $value
| display at UCSC
+3 -3
View File
@@ -3,9 +3,9 @@ from galaxy import datatypes
def exec_before_job( trans, inp_data, out_data, param_dict, tool=None):
"""Sets the name of the data"""
outputType = param_dict.get( 'hgta_outputType', "interval" ) #assume all data is interval, we will fix later if not the case
#list for converting ucsc to galaxy exts, if not in here, use raw reported value
outputType_to_ext = {'wigData':'wig','tab':'interval','hyperlinks':'html','sequence':'fasta'}
outputType = param_dict.get( 'hgta_outputType', "interval" ).lower() #assume all data is interval, we will fix later if not the case
#list for converting ucsc to galaxy exts, if not in following dictionary, use provided datatype
outputType_to_ext = {'wigdata':'wig','tab':'interval','hyperlinks':'html','sequence':'fasta'}
items = out_data.items()
description = param_dict.get('hgta_regionType',"")
organism = param_dict.get('org',"unkown species")