Re: [galaxy-dev] Column alignment in tabular display

2012-10-30 Thread Peter Cock
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.c...@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.makoFri Jun 15 16:05:48 2012 +0100
+++ b/templates/dataset/tabular_chunked.makoMon 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{
___
Please keep all replies on the list by using reply all
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:

  http://lists.bx.psu.edu/


Re: [galaxy-dev] Column alignment in tabular display

2012-10-30 Thread Dannon Baker
Hey Peter,

I must have missed this the first time through, I like the change below and can 
apply it.

-Dannon

On Oct 30, 2012, at 8:26 AM, Peter Cock p.j.a.c...@googlemail.com wrote:

 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.c...@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.makoFri Jun 15 16:05:48 2012 +0100
 +++ b/templates/dataset/tabular_chunked.makoMon 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{
 ___
 Please keep all replies on the list by using reply all
 in your mail client.  To manage your subscriptions to this
 and other Galaxy lists, please use the interface at:
 
  http://lists.bx.psu.edu/

___
Please keep all replies on the list by using reply all
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:

  http://lists.bx.psu.edu/


Re: [galaxy-dev] Column alignment in tabular display

2012-10-30 Thread Peter Cock
On Tue, Oct 30, 2012 at 2:17 PM, Dannon Baker dannonba...@me.com wrote:
 Hey Peter,

 I must have missed this the first time through, I like the change below and 
 can apply it.

 -Dannon

I see that's gone in, thanks:
https://bitbucket.org/galaxy/galaxy-central/changeset/c0d8a9c916a5

Peter
___
Please keep all replies on the list by using reply all
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:

  http://lists.bx.psu.edu/


[galaxy-dev] Column alignment in tabular display

2012-06-18 Thread Peter Cock
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.makoFri Jun 15 16:05:48 2012 +0100
+++ b/templates/dataset/tabular_chunked.makoMon 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{
___
Please keep all replies on the list by using reply all
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:

  http://lists.bx.psu.edu/