Re: [galaxy-dev] Display column headers in data_column parameter
Hi Peter, I defined an additional metadata element for the column names analogously to the "column_types" element in the module "<galaxy_basedir>/lib/galaxy/tools/datatypes/tabular.py": MetadataElement( name="column_names", default=[], desc="Column names", param=metadata.ColumnTypesParameter, readonly=True, visible=False, no_value=[] ) Then I read the column names in the function "set.meta" and saved them in the new metadata element: dataset.metadata.column_names = column_names Finally, I changed a line of code in the function "get.column.list" in "<galaxy_basedir>/lib/galaxy/tools/parameters/basic.py", such that Galaxy displays the column names in the data_column parameter: original line: column_list.append( str( i + 1 ) ) changed line: column_list.append( str( i + 1 ) + ": " + dataset.metadata.column_names[i]) ) Kind regards, Johannes Dipl.-Inf. (Bioinf.) Johannes Eichner Univ. Tuebingen, WSI-RA, Sand 1, D-72076 Tuebingen, Germany Phone: (+49/0) 7071 / 29 70436 Fax: (+49/0) 7071 / 29 5091 Am 26.05.2011 15:27, schrieb Peter Cock:
Hi Johannes,
Did you mean to send this to just me? Could you resent it CC'ing the mailing list?
I'd like to see your hack - it could be the basis for extending Galaxy itself.
Peter
On Thu, May 26, 2011 at 2:24 PM, Johannes Eichner <johannes.eichner@uni-tuebingen.de> wrote:
Hello Peter,
thanks for your comments. I managed to display the column headers by defining a new datatype (inherited from tabular) with additional metadata for the column headers and by changing the python code in <galaxy_basedir>/lib/galaxy/tools/parameters/basic.py, such that the headers are displayed in the data_column parameter.
This hack works for the present, but I am looking forward to seeing one of your ideas realized in a new version of Galaxy, which will hopefully supersede this preliminary hack.
Kind regards, Johannes
Dipl.-Inf. (Bioinf.) Johannes Eichner Univ. Tuebingen, WSI-RA, Sand 1, D-72076 Tuebingen, Germany Phone: (+49/0) 7071 / 29 70436 Fax: (+49/0) 7071 / 29 5091
Am 24.05.2011 16:54, schrieb Peter Cock:
On Tue, May 24, 2011 at 3:12 PM, Johannes Eichner <johannes.eichner@uni-tuebingen.de> wrote:
Dear Galaxy-Dev Team,
is it possible to display the headers of the columns which can be selected in a data_column parameter? Currently, only the column index (e.g., c1, c2, etc.) is displayed in Galaxy. If it would be possible to additionally display the column headers, the selection of the desired columns would be easier for the user. Is there a way to do this using the current version of Galaxy?
Kind regards, Johannes
I completely agree that in general the UI for column parameter isn't as user friendly as it could be. The filter data UI is even worse for non-programmers, but due to its complexity and flexibility, that is harder to improve too.
This was one of the things I wanted to bring up with the Galaxy team at the conference (starting tonight). Unfortunately due to the Grimsvotn Volcano's cloud of ash I won't be there.
In some cases yes, Galaxy knows the column meaning. In many of my data files there is a # header line with tab separated column names, which could be detected and shown.
Given there may or not be suitable column meta data, what I was picturing was an expanded column picking dialogue that could show the first few rows of data in each column (not using a simple HTML widget anymore), or simply the first value (less drastic change).
So, rather than having as now something like: Pick column(s): [ ] c1 [ ] c2 [ ] c3 [ ] c4 [ ] c5
If Galaxy has names in the column meta data you might have Pick columns(s): [ ] c1 - Identifier [ ] c2 - Start [ ] c3 - End [ ] c4 - Strand [ ] c5 - Sequence
Or, showing the first data entry: Pick columns(s): [ ] c1, e.g. "gi|12345678" [ ] c2, e.g. "123" [ ] c3, e.g. "456" [ ] c4, e.g. "+" [ ] c4, e.g. "ACGTACTGT..."
In the final example I envision truncating very long values with an ellipsis.
Both the above proposals don't require drastic changes to the HTML widget and layout.
I guess we should file an enhancement issue on bitbucket: https://bitbucket.org/galaxy/galaxy-central/issues/new
Peter
On Thu, May 26, 2011 at 3:45 PM, Johannes Eichner <johannes.eichner@uni-tuebingen.de> wrote:
Hi Peter,
I defined an additional metadata element for the column names analogously to the "column_types" element in the module "<galaxy_basedir>/lib/galaxy/tools/datatypes/tabular.py": MetadataElement( name="column_names", default=[], desc="Column names", param=metadata.ColumnTypesParameter, readonly=True, visible=False, no_value=[] )
Then I read the column names in the function "set.meta" and saved them in the new metadata element: dataset.metadata.column_names = column_names
Do you look for a tab separated # header line at the start of the file for these names?
Finally, I changed a line of code in the function "get.column.list" in "<galaxy_basedir>/lib/galaxy/tools/parameters/basic.py", such that Galaxy displays the column names in the data_column parameter: original line: column_list.append( str( i + 1 ) ) changed line: column_list.append( str( i + 1 ) + ": " + dataset.metadata.column_names[i]) )
Kind regards, Johannes
From a Python style point of view, I'd use string formatting here:
column_list.append("%i: %s" % (i+1, dataset.metadata.column_names[i])) Do you have a branch on bitbucket for this, or a patch? I'd like to try it. You could attach a patch to issue 554: https://bitbucket.org/galaxy/galaxy-central/issue/554 Thanks, Peter
participants (2)
-
Johannes Eichner
-
Peter Cock