1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/569f7d078010/ changeset: 569f7d078010 user: jgoecks date: 2012-10-04 15:11:04 summary: Refactor PhyloViz components to work in new visualization framework and add sniffers for datatypes. affected #: 6 files diff -r e8fc8e57dadc8a1254d994e4e05f40271d7e856b -r 569f7d07801074a4e5207493afe72354ccb8d3ad datatypes_conf.xml.sample --- a/datatypes_conf.xml.sample +++ b/datatypes_conf.xml.sample @@ -252,6 +252,7 @@ <sniffer type="galaxy.datatypes.binary:TwoBit"/><sniffer type="galaxy.datatypes.binary:Bam"/><sniffer type="galaxy.datatypes.binary:Sff"/> + <sniffer type="galaxy.datatypes.xml:Phyloxml"/><sniffer type="galaxy.datatypes.xml:GenericXml"/><sniffer type="galaxy.datatypes.sequence:Maf"/><sniffer type="galaxy.datatypes.sequence:Lav"/> @@ -272,6 +273,8 @@ <sniffer type="galaxy.datatypes.tabular:Pileup"/><sniffer type="galaxy.datatypes.interval:Interval"/><sniffer type="galaxy.datatypes.tabular:Sam"/> + <sniffer type="galaxy.datatypes.data:Newick"/> + <sniffer type="galaxy.datatypes.data:Nexus"/><sniffer type="galaxy.datatypes.images:Jpg"/><sniffer type="galaxy.datatypes.images:Png"/><sniffer type="galaxy.datatypes.images:Tiff"/> diff -r e8fc8e57dadc8a1254d994e4e05f40271d7e856b -r 569f7d07801074a4e5207493afe72354ccb8d3ad lib/galaxy/datatypes/data.py --- a/lib/galaxy/datatypes/data.py +++ b/lib/galaxy/datatypes/data.py @@ -734,38 +734,39 @@ """New Hampshire/Newick Format""" file_ext = "nhx" - MetadataElement( name="columns", default=3, desc="Number of columns", readonly=True ) - def __init__(self, **kwd): """Initialize foobar datatype""" - Text.__init__(self, **kwd) + Text.__init__( self, **kwd ) def init_meta( self, dataset, copy_from=None ): Text.init_meta( self, dataset, copy_from=copy_from ) - def sniff( self, filename ): """ Returning false as the newick format is too general and cannot be sniffed.""" return False + def get_visualizations( self, dataset ): + """ + Returns a list of visualizations for datatype. + """ + + return [ 'phyloviz' ] + class Nexus( Text ): """Nexus format as used By Paup, Mr Bayes, etc""" file_ext = "nex" - MetadataElement( name="columns", default=3, desc="Number of columns", readonly=True ) - def __init__(self, **kwd): """Initialize foobar datatype""" - Text.__init__(self, **kwd) + Text.__init__( self, **kwd ) def init_meta( self, dataset, copy_from=None ): Text.init_meta( self, dataset, copy_from=copy_from ) - def sniff( self, filename ): """All Nexus Files Simply puts a '#NEXUS' in its first line""" - f = open(filename, "r") + f = open( filename, "r" ) firstline = f.readline().upper() f.close() @@ -774,6 +775,13 @@ else: return False + def get_visualizations( self, dataset ): + """ + Returns a list of visualizations for datatype. + """ + + return [ 'phyloviz' ] + # ------------- Utility methods -------------- diff -r e8fc8e57dadc8a1254d994e4e05f40271d7e856b -r 569f7d07801074a4e5207493afe72354ccb8d3ad lib/galaxy/datatypes/xml.py --- a/lib/galaxy/datatypes/xml.py +++ b/lib/galaxy/datatypes/xml.py @@ -91,9 +91,18 @@ def sniff( self, filename ): """"Checking for keyword - 'phyloxml' always in lowercase in the first few lines""" - f = open(filename, "r") - firstlines = "".join(f.readlines(5)) + + f = open( filename, "r" ) + firstlines = "".join( f.readlines(5) ) f.close() + if "phyloxml" in firstlines: return True - return False \ No newline at end of file + return False + + def get_visualizations( self, dataset ): + """ + Returns a list of visualizations for datatype. + """ + + return [ 'phyloviz' ] \ No newline at end of file diff -r e8fc8e57dadc8a1254d994e4e05f40271d7e856b -r 569f7d07801074a4e5207493afe72354ccb8d3ad lib/galaxy/visualization/phyloviz/phyloviz_dataprovider.py --- a/lib/galaxy/visualization/phyloviz/phyloviz_dataprovider.py +++ b/lib/galaxy/visualization/phyloviz/phyloviz_dataprovider.py @@ -3,15 +3,12 @@ from phyloxmlparser import Phyloxml_Parser from galaxy.visualization.data_providers.basic import BaseDataProvider -# TODO: bring this class into line with BaseDataProvider by -# using BaseDataProvider.init() and providing original dataset -# and then reading from dataset rather than filepath. class Phyloviz_DataProvider( BaseDataProvider ): - def __init__( self ): - pass + def __init__( self, original_dataset=None ): + super( BaseDataProvider, self ).__init__( original_dataset=original_dataset ) - def get_data( self, filepath, fileExt ): + def get_data( self, **kwargs ): """returns [trees], meta Trees are actually an array of JsonDicts. It's usually one tree, except in the case of Nexus """ diff -r e8fc8e57dadc8a1254d994e4e05f40271d7e856b -r 569f7d07801074a4e5207493afe72354ccb8d3ad templates/root/history.mako --- a/templates/root/history.mako +++ b/templates/root/history.mako @@ -388,17 +388,6 @@ _.each( $(".visualize-icon"), function(icon) { init_viz_icon(icon); }); - - function init_phyloviz_links() { - // PhyloViz links - // Add to trackster browser functionality - $(".phyloviz-add").live("click", function() { - var dataset = this, - dataset_jquery = $(this); - window.parent.location = dataset_jquery.attr("new-url"); - }); - } - init_phyloviz_links(); // History rename functionality. async_save_text("history-name-container", "history-name", "${h.url_for( controller="/history", action="rename_async", id=trans.security.encode_id(history.id) )}", "new_name", 18); diff -r e8fc8e57dadc8a1254d994e4e05f40271d7e856b -r 569f7d07801074a4e5207493afe72354ccb8d3ad templates/root/history_common.mako --- a/templates/root/history_common.mako +++ b/templates/root/history_common.mako @@ -29,9 +29,6 @@ ## Render the dataset `data` as history item, using `hid` as the displayed id <%def name="render_dataset( data, hid, show_deleted_on_refresh = False, for_editing = True, display_structured = False )"><% - - from galaxy.datatypes.xml import Phyloxml - from galaxy.datatypes.data import Newick, Nexus dataset_id = trans.security.encode_id( data.id ) if data.state in ['no state','',None]: @@ -245,14 +242,6 @@ %endif visualizations="${','.join(visualizations)}"></a> %endif - <% - isPhylogenyData = isinstance(data.datatype, (Phyloxml, Nexus, Newick)) - %> - %if isPhylogenyData: - <a href="javascript:void(0)" class="icon-button chart_curve phyloviz-add" - action-url="${h.url_for( controller='phyloviz', action='-', dataset_id=dataset_id)}" - new-url="${h.url_for( controller='phyloviz', action='index', dataset_id=dataset_id)}" title="View in Phyloviz"></a> - %endif %if trans.user: %if not display_structured: <div style="float: right"> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.