commit/galaxy-central: greg: Add the ability to include field values (in addition to field names ) when defining sample form rows by importing from a csv file. The csv file must be in the following format: the [:FieldValue] is optional, the named form field will contain the value after the ':' if included.
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/6e1576c83456/ changeset: 6e1576c83456 user: greg date: 2011-06-16 16:54:29 summary: Add the ability to include field values (in addition to field names ) when defining sample form rows by importing from a csv file. The csv file must be in the following format: the [:FieldValue] is optional, the named form field will contain the value after the ':' if included. SampleName,DataLibraryName,FolderName,HistoryName,WorkflowName,Field1Name:Field1Value,Field2Name:Field2Value... affected #: 2 files (596 bytes) --- a/lib/galaxy/web/controllers/requests_common.py Thu Jun 16 10:22:31 2011 -0400 +++ b/lib/galaxy/web/controllers/requests_common.py Thu Jun 16 10:54:29 2011 -0400 @@ -1049,8 +1049,9 @@ status=status ) def __import_samples( self, trans, cntrller, request, displayable_sample_widgets, libraries, workflows, **kwd ): """ - Reads the samples csv file and imports all the samples. The format of the csv file is: - SampleName,DataLibraryName,DataLibraryFolderName,HistoryName,WorkflowName,Field1Name,Field2Name... + Reads the samples csv file and imports all the samples. The csv file must be in the following format. The [:FieldValue] + is optional, the form field will contain the value after the ':' if included. + SampleName,DataLibraryName,DataLibraryFolderName,HistoryName,WorkflowName,Field1Name:Field1Value,Field2Name:Field2Value... """ params = util.Params( kwd ) current_user_roles = trans.get_current_user_roles() @@ -1123,7 +1124,13 @@ field_values = {} field_names = row[5:] for field_name in field_names: - field_values[ field_name ] = '' + if field_name.find( ':' ) >= 0: + field_list = field_name.split( ':' ) + field_name = field_list[0] + field_value = field_list[1] + else: + field_value = '' + field_values[ field_name ] = field_value displayable_sample_widgets.append( dict( id=None, name=row[0], bar_code='', --- a/templates/requests/common/add_samples.mako Thu Jun 16 10:22:31 2011 -0400 +++ b/templates/requests/common/add_samples.mako Thu Jun 16 10:54:29 2011 -0400 @@ -117,8 +117,9 @@ <input type="file" name="file_data" /><input type="submit" name="import_samples_button" value="Import samples"/><div class="toolParamHelp" style="clear: both;"> - The csv file must be in the following format:<br/> - SampleName,DataLibraryName,DataLibraryFolderName,HistoryName,WorkflowName,Field1Name,Field2Name... + The csv file must be in the following format.<br/> + The [:FieldValue] is optional, the named form field will contain the value after the ':' if included.<br/> + SampleName,DataLibraryName,FolderName,HistoryName,WorkflowName,Field1Name:Field1Value,Field2Name:Field2Value... </div></div></form> 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