Column alignment in tabular display
Hello all, I'm curious about the logic used for column alignment when displaying tabular files (which for me was the headline feature of the last Galaxy Release - I'm very pleased to have this added at last). https://bitbucket.org/galaxy/galaxy-central/issue/553 Quoting from templates/dataset/tabular_chunked.mako function renderCell(cell_contents, index, colspan){ if (colspan !== undefined){ return $('<td>').attr('colspan', colspan).addClass('stringalign').text(cell_contents); } else if (DATASET_TYPES[index] == 'str'){ /* Left align all str columns, right align the rest */ return $('<td>').addClass('stringalign').text(cell_contents);; } else{ return $('<td>').text(cell_contents); } } It seems to me that the logic should be right align all numeric columns, left align the rest. At very least, columns of type 'list' should also be left aligned. Otherwise you can easily have a situation where on clicking the "eye" you get an apparently empty dataset (unless you scroll right or down). This can easily happen with FASTA to tabular (default settings), where the descriptions have commas in them (common with annotation) thus the first column is considered to be a list (and the second column type str for the sequence). If some of the later sequences in the file have very long descriptions, right aligning the description column makes the dataset appear empty. I can provide a screen shot if it would help to explain, but here is my proposed patch. Regards, Peter -- $ hg diff templates/dataset/tabular_chunked.mako diff -r 8657ada96fca templates/dataset/tabular_chunked.mako --- a/templates/dataset/tabular_chunked.mako Fri Jun 15 16:05:48 2012 +0100 +++ b/templates/dataset/tabular_chunked.mako Mon Jun 18 16:23:44 2012 +0100 @@ -17,8 +17,8 @@ if (colspan !== undefined){ return $('<td>').attr('colspan', colspan).addClass('stringalign').text(cell_contents); } - else if (DATASET_TYPES[index] == 'str'){ - /* Left align all str columns, right align the rest */ + else if (DATASET_TYPES[index] == 'str' || DATASET_TYPES[index] == 'list'){ + /* Left align all str and list columns, right align the rest */ return $('<td>').addClass('stringalign').text(cell_contents);; } else{
Hi all, The issue I raised below about column alignment in the display of tabular files still affects the current latest release - would you like me to turn my little proposed patch into a bitbucket pull request? Thanks, Peter ---------- Forwarded message ---------- From: Peter Cock <p.j.a.cock@googlemail.com> Date: Mon, Jun 18, 2012 at 4:25 PM Subject: Column alignment in tabular display To: galaxy-dev@lists.bx.psu.edu Hello all, I'm curious about the logic used for column alignment when displaying tabular files (which for me was the headline feature of the last Galaxy Release - I'm very pleased to have this added at last). https://bitbucket.org/galaxy/galaxy-central/issue/553 Quoting from templates/dataset/tabular_chunked.mako function renderCell(cell_contents, index, colspan){ if (colspan !== undefined){ return $('<td>').attr('colspan', colspan).addClass('stringalign').text(cell_contents); } else if (DATASET_TYPES[index] == 'str'){ /* Left align all str columns, right align the rest */ return $('<td>').addClass('stringalign').text(cell_contents);; } else{ return $('<td>').text(cell_contents); } } It seems to me that the logic should be right align all numeric columns, left align the rest. At very least, columns of type 'list' should also be left aligned. Otherwise you can easily have a situation where on clicking the "eye" you get an apparently empty dataset (unless you scroll right or down). This can easily happen with FASTA to tabular (default settings), where the descriptions have commas in them (common with annotation) thus the first column is considered to be a list (and the second column type str for the sequence). If some of the later sequences in the file have very long descriptions, right aligning the description column makes the dataset appear empty. I can provide a screen shot if it would help to explain, but here is my proposed patch. Regards, Peter -- $ hg diff templates/dataset/tabular_chunked.mako diff -r 8657ada96fca templates/dataset/tabular_chunked.mako --- a/templates/dataset/tabular_chunked.mako Fri Jun 15 16:05:48 2012 +0100 +++ b/templates/dataset/tabular_chunked.mako Mon Jun 18 16:23:44 2012 +0100 @@ -17,8 +17,8 @@ if (colspan !== undefined){ return $('<td>').attr('colspan', colspan).addClass('stringalign').text(cell_contents); } - else if (DATASET_TYPES[index] == 'str'){ - /* Left align all str columns, right align the rest */ + else if (DATASET_TYPES[index] == 'str' || DATASET_TYPES[index] == 'list'){ + /* Left align all str and list columns, right align the rest */ return $('<td>').addClass('stringalign').text(cell_contents);; } else{
On Tue, Oct 30, 2012 at 2:17 PM, Dannon Baker <dannonbaker@me.com> wrote:
I see that's gone in, thanks: https://bitbucket.org/galaxy/galaxy-central/changeset/c0d8a9c916a5 Peter
participants (2)
-
Dannon Baker
-
Peter Cock