commit/galaxy-central: jgoecks: Enhancements for finding available visualizations: (a) use dataset rather than datatype and (b) only show scatterplot for tabular datasets with >=2 numerical columns.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/aa0469dd0078/ changeset: aa0469dd0078 user: jgoecks date: 2012-09-18 19:10:04 summary: Enhancements for finding available visualizations: (a) use dataset rather than datatype and (b) only show scatterplot for tabular datasets with >=2 numerical columns. affected #: 4 files diff -r 5cdb0038c89d1396755b2c7e371bde63b221b8df -r aa0469dd0078fd792ff34db8cd8ee36ae0e9c9be lib/galaxy/datatypes/data.py --- a/lib/galaxy/datatypes/data.py +++ b/lib/galaxy/datatypes/data.py @@ -545,7 +545,7 @@ raise Exception('Result %s from %s' % (result, cmd)) merge = staticmethod(merge) - def get_visualizations( self ): + def get_visualizations( self, dataset ): """ Returns a list of visualizations for datatype. """ diff -r 5cdb0038c89d1396755b2c7e371bde63b221b8df -r aa0469dd0078fd792ff34db8cd8ee36ae0e9c9be lib/galaxy/datatypes/tabular.py --- a/lib/galaxy/datatypes/tabular.py +++ b/lib/galaxy/datatypes/tabular.py @@ -301,11 +301,25 @@ def as_ucsc_display_file( self, dataset, **kwd ): return open( dataset.file_name ) - def get_visualizations( self ): + def get_visualizations( self, dataset ): """ Returns a list of visualizations for datatype. """ - return super( Tabular, self ).get_visualizations() + [ 'scatterplot' ] + + # Can visualize tabular data as scatterplot if there are 2+ numerical + # columns. + num_numerical_cols = 0 + for col_type in dataset.metadata.column_types: + if col_type in [ 'int', 'float' ]: + num_numerical_cols += 1 + + print dataset.name, num_numerical_cols + + vizs = super( Tabular, self ).get_visualizations( dataset ) + if num_numerical_cols >= 2: + vizs.append( 'scatterplot' ) + + return vizs class Taxonomy( Tabular ): def __init__(self, **kwd): diff -r 5cdb0038c89d1396755b2c7e371bde63b221b8df -r aa0469dd0078fd792ff34db8cd8ee36ae0e9c9be lib/galaxy/model/__init__.py --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -1245,6 +1245,9 @@ def get_display_applications( self, trans ): return self.datatype.get_display_applications_by_dataset( self, trans ) + def get_visualizations( self ): + return self.datatype.get_visualizations( self ) + class HistoryDatasetAssociation( DatasetInstance ): def __init__( self, hid = None, diff -r 5cdb0038c89d1396755b2c7e371bde63b221b8df -r aa0469dd0078fd792ff34db8cd8ee36ae0e9c9be templates/root/history_common.mako --- a/templates/root/history_common.mako +++ b/templates/root/history_common.mako @@ -229,7 +229,7 @@ ## Visualization icon + visualizations. Using anchor attributes is a HACK to encode needed ## information--URL base, dataset id, dbkey, visualizations--in anchor. <% - visualizations = data.datatype.get_visualizations() + visualizations = data.get_visualizations() ## HACK: if there are visualizations, only provide trackster for now since others ## are not ready. if visualizations: 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.
participants (1)
-
Bitbucket