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