mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #2348 from remimarenco/huba_datatype
Add the trackhub composite datatype
This commit is contained in:
@@ -533,6 +533,9 @@
|
||||
<datatype extension="mothur.axes" type="galaxy.datatypes.mothur:Axes" display_in_upload="true"/>
|
||||
<datatype extension="mothur.sff.flow" type="galaxy.datatypes.mothur:SffFlow" display_in_upload="true"/>
|
||||
<datatype extension="mothur.count_table" type="galaxy.datatypes.mothur:CountTable" display_in_upload="true"/>
|
||||
<datatype extension="trackhub" type="galaxy.datatypes.tracks:UCSCTrackHub" display_in_upload="true">
|
||||
<display file="ucsc/trackhub.xml" />
|
||||
</datatype>
|
||||
</registration>
|
||||
<sniffers>
|
||||
<!--
|
||||
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
<display id="ucsc_trackhub" version="1.0.0" name="display at Track Hub UCSC">
|
||||
<link id="main" name="main">
|
||||
<url>https://genome.ucsc.edu/cgi-bin/hgHubConnect?hubUrl=${qp($hub_file.url + '/myHub/hub.txt')}&hgHub_do_firstDb=on&hgHub_do_redirect=on&hgHubConnect.remakeTrackHub=on</url>
|
||||
<param type="data" name="hub_file" url="galaxy_${DATASET_HASH}" allow_extra_files_access="True" />
|
||||
</link>
|
||||
</display>
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
"""
|
||||
HubAssembly datatype
|
||||
"""
|
||||
import logging
|
||||
import galaxy.version as version
|
||||
|
||||
# Support for Galaxy <= 16.01
|
||||
if version.VERSION_MAJOR <= "16.01":
|
||||
from galaxy.datatypes.images import Html
|
||||
else:
|
||||
from galaxy.datatypes.text import Html
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class HubAssembly( Html ):
|
||||
"""
|
||||
derived class for BioC data structures in Galaxy
|
||||
"""
|
||||
|
||||
file_ext = 'huba'
|
||||
composite_type = 'auto_primary_file'
|
||||
|
||||
def __init__(self, **kwd):
|
||||
Html.__init__(self, **kwd)
|
||||
|
||||
def generate_primary_file( self, dataset=None ):
|
||||
"""
|
||||
This is called only at upload to write the html file
|
||||
cannot rename the datasets here - they come with the default unfortunately
|
||||
"""
|
||||
rval = [
|
||||
'<html><head><title>Files for Composite Dataset (%s)</title></head><p/>\
|
||||
This composite dataset is composed of the following files:<p/><ul>' % (
|
||||
self.file_ext)]
|
||||
for composite_name, composite_file in self.get_composite_files( dataset=dataset ).iteritems():
|
||||
opt_text = ''
|
||||
if composite_file.optional:
|
||||
opt_text = ' (optional)'
|
||||
rval.append('<li><a href="%s">%s</a>%s' % ( composite_name, composite_name, opt_text) )
|
||||
rval.append('</ul></html>')
|
||||
return "\n".join(rval)
|
||||
|
||||
def set_peek( self, dataset, is_multi_byte=False ):
|
||||
if not dataset.dataset.purged:
|
||||
dataset.peek = "Track Hub structure: Visualization in UCSC Track Hub"
|
||||
else:
|
||||
dataset.peek = 'file does not exist'
|
||||
dataset.blurb = 'file purged from disk'
|
||||
|
||||
def display_peek( self, dataset ):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
return "Track Hub structure: Visualization in UCSC Track Hub"
|
||||
|
||||
def sniff( self, filename ):
|
||||
return False
|
||||
@@ -5,6 +5,8 @@ Datatype classes for tracks/track views within galaxy.
|
||||
import binary
|
||||
import logging
|
||||
|
||||
from galaxy.datatypes.text import Html
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
# GeneTrack is no longer supported but leaving the datatype since
|
||||
@@ -37,3 +39,48 @@ class GeneTrack( binary.Binary ):
|
||||
# link = "%s?filename=%s&hashkey=%s&input=%s&GALAXY_URL=%s" % ( url, encoded, hashkey, data_id, galaxy_url )
|
||||
# ret_val.append( ( name, link ) )
|
||||
# return ret_val
|
||||
|
||||
|
||||
class UCSCTrackHub( Html ):
|
||||
"""
|
||||
Datatype for UCSC TrackHub
|
||||
"""
|
||||
|
||||
file_ext = 'trackhub'
|
||||
composite_type = 'auto_primary_file'
|
||||
|
||||
def __init__(self, **kwd):
|
||||
Html.__init__(self, **kwd)
|
||||
|
||||
def generate_primary_file( self, dataset=None ):
|
||||
"""
|
||||
This is called only at upload to write the html file
|
||||
cannot rename the datasets here - they come with the default unfortunately
|
||||
"""
|
||||
rval = [
|
||||
'<html><head><title>Files for Composite Dataset (%s)</title></head><p/>\
|
||||
This composite dataset is composed of the following files:<p/><ul>' % (
|
||||
self.file_ext)]
|
||||
for composite_name, composite_file in self.get_composite_files( dataset=dataset ).items():
|
||||
opt_text = ''
|
||||
if composite_file.optional:
|
||||
opt_text = ' (optional)'
|
||||
rval.append('<li><a href="%s">%s</a>%s' % ( composite_name, composite_name, opt_text) )
|
||||
rval.append('</ul></html>')
|
||||
return "\n".join(rval)
|
||||
|
||||
def set_peek( self, dataset, is_multi_byte=False ):
|
||||
if not dataset.dataset.purged:
|
||||
dataset.peek = "Track Hub structure: Visualization in UCSC Track Hub"
|
||||
else:
|
||||
dataset.peek = 'file does not exist'
|
||||
dataset.blurb = 'file purged from disk'
|
||||
|
||||
def display_peek( self, dataset ):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
return "Track Hub structure: Visualization in UCSC Track Hub"
|
||||
|
||||
def sniff( self, filename ):
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user