Hello Joe, I've enhanced the feature for defining sample form rows in change set 5716:6e1576c83456 (currently available only in our development repo, but will be available in the distribution shortly) to include 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... Let me know if you run into additional issues when using this new feature. Thanks for all of your patience on this. On Jun 10, 2011, at 3:40 PM, Joe Cruz wrote:
Hey Greg,
Sorry for not being clear. I'm trying to create a sample information form where users can import csv files which would contain DIFFERENT values for each field. So, while one sample may have value 'agctac' for the last field, another sample will have a different value, say '123. So, these can't be hardcoded in the sample form definition. Since these are form fields, of course the field NAMES should remain standard and field VALUES should will keep changing. From what I understand, the sample form definition will have the field NAMES and the csv file will have different field VALUES. Galaxy should map the field VALUES to the field NAMES.
My form has the following field names: (change this accordingly)
SampleName LibraryName LibraryFolder History Workflow Barcode
A user may submit a csv file such as:
Sample1,Library1,Folder1,History1,Workflow1,BarcodeAC Sample10,Library10,Folder10,History10,Workflow10,BarcodeDE
Galaxy should take this csv file, parse it, create two samples (Sample1 and Sample10) and assign the rest of the values to the corresponding fields for each sample.
Thanks, joe
On Thu, Jun 9, 2011 at 8:50 PM, Greg Von Kuster <greg@bx.psu.edu> wrote: Joe,
Try editing your Sample Form Definition, changing the "Field name" value from the default of "1_field_name" to be your desired "agctac". Then, your csv file with the line
Sample1,Library1,Lib1Folder1,History,Workflow,agctac
should work.
Greg
On Jun 9, 2011, at 6:03 PM, Joe Cruz wrote:
Hey Greg,
I got it to work by filling the field names with their default names, but I thought you could fill out the entire sample forms, including the field names, with the csv file. For example:
Sample1,Library1,Lib1Folder1,History,Workflow,1_field_name
The above works when imported, filling out the sample name, library, folder, history, and workflow fields but leaving 1_field_name (barcode field in this case) empty.
We wish this next example to work,which I currently get the '1_field_name' error:
Sample1,Library1,Lib1Folder1,History,Workflow,agctac
Currently we have clients fill out a spreadsheet for the samples they intend to submit, since many submit multiple samples and most of the time have the same parameters for all of them. We wish to convert their completed spreadsheet into a csv file and then import it into galaxy so they dont' have to fill out all the fields repetitively.
joe
On Thu, Jun 9, 2011 at 3:20 PM, Greg Von Kuster <greg@bx.psu.edu> wrote: Hello Joe,
Sorry you've bumped into problems - we know we're lacking on documentation for the sample tracking stuff currently. I believe this new issue is due to a field named differently in your Sample FormDefinition vs your csf file. In looking at this, I found a slightly incorrect description of the csv file layout on our Add Samples page, which I've corrected.
In the Sample FormDefinition, the default name for a field is 1_field_name, 2_field_name, etc. Below is a screen capture that show this. However, the csv file you sent me previously includes the following:
SampleName1,library1,library1_folder1,history1,workflow1,sampleType1,conc,runType,readLength
The csv layout is as follows ( I've correct the incorrect FieldValue1, etc to be Field1Name, etc.
The csv file must be in the following format: SampleName,DataLibraryName,DataLibraryFolderName,HistoryName,WorkflowName,Field1Name,Field2name..
The Field1Name, Field2Name values in your csv file must match the value in the Field name form field in the screen shot below.
After making this change, let me know if you bump into any other problems.
Thanks for you patience on this,
Greg
<sample_form.tiff> On Jun 9, 2011, at 12:32 PM, Joe Cruz wrote:
Hey Greg,
Unfortunately after pulling your changeset I got a new error related to '1_field_name'. Here is the error traceback:
URL: http://localhost:8080/requests_common/add_samples?cntrller=requests&id=f2db41e1fa331b3e File '/home/jcruz/galaxy-central/eggs/WebError-0.8a-py2.6.egg/weberror/evalexception/middleware.py', line 364 in respond app_iter = self.application(environ, detect_start_response) File '/home/jcruz/galaxy-central/eggs/Paste-1.6-py2.6.egg/paste/debug/prints.py', line 98 in __call__ environ, self.app) File '/home/jcruz/galaxy-central/eggs/Paste-1.6-py2.6.egg/paste/wsgilib.py', line 539 in intercept_output app_iter = application(environ, replacement_start_response) File '/home/jcruz/galaxy-central/eggs/Paste-1.6-py2.6.egg/paste/recursive.py', line 80 in __call__ return self.application(environ, start_response) File '/home/jcruz/galaxy-central/eggs/Paste-1.6-py2.6.egg/paste/httpexceptions.py', line 632 in __call__ return self.application(environ, start_response) File '/home/jcruz/galaxy-central/lib/galaxy/web/framework/base.py', line 145 in __call__ body = method( trans, **kwargs ) File '/home/jcruz/galaxy-central/lib/galaxy/web/framework/__init__.py', line 84 in decorator return func( self, trans, *args, **kwargs ) File '/home/jcruz/galaxy-central/lib/galaxy/web/controllers/requests_common.py', line 831 in add_samples return self.__import_samples( trans, cntrller, request, displayable_sample_widgets, libraries, workflows, **kwd ) File '/home/jcruz/galaxy-central/lib/galaxy/web/controllers/requests_common.py', line 1163 in __import_samples sample_copy_select_field=sample_copy_select_field ) File '/home/jcruz/galaxy-central/lib/galaxy/web/framework/__init__.py', line 661 in fill_template return self.fill_template_mako( filename, **kwargs ) File '/home/jcruz/galaxy-central/lib/galaxy/web/framework/__init__.py', line 672 in fill_template_mako return template.render( **data ) File '/home/jcruz/galaxy-central/eggs/Mako-0.2.5-py2.6.egg/mako/template.py', line 133 in render return runtime._render(self, self.callable_, args, data) File '/home/jcruz/galaxy-central/eggs/Mako-0.2.5-py2.6.egg/mako/runtime.py', line 364 in _render _render_context(template, callable_, context, *args, **_kwargs_for_callable(callable_, data)) File '/home/jcruz/galaxy-central/eggs/Mako-0.2.5-py2.6.egg/mako/runtime.py', line 381 in _render_context _exec_template(inherit, lclcontext, args=args, kwargs=kwargs) File '/home/jcruz/galaxy-central/eggs/Mako-0.2.5-py2.6.egg/mako/runtime.py', line 414 in _exec_template callable_(context, *args, **kwargs) File '/home/jcruz/galaxy-central/database/compiled_templates/base.mako.py', line 40 in render_body __M_writer(unicode(next.body())) File '/home/jcruz/galaxy-central/eggs/Mako-0.2.5-py2.6.egg/mako/runtime.py', line 255 in <lambda> return lambda *args, **kwargs:callable_(self.context, *args, **kwargs) File '/home/jcruz/galaxy-central/database/compiled_templates/requests/common/add_samples.mako.py', line 176 in render_body __M_writer(unicode(render_request_type_sample_form_grids( grid_index, grid_name, request.type.sample_form.grid_fields( grid_index ), displayable_sample_widgets=displayable_sample_widgets, show_saved_samples_read_only=True ))) File '/home/jcruz/galaxy-central/eggs/Mako-0.2.5-py2.6.egg/mako/runtime.py', line 255 in <lambda> return lambda *args, **kwargs:callable_(self.context, *args, **kwargs) File '/home/jcruz/galaxy-central/database/compiled_templates/requests/common/common.mako.py', line 120 in render_render_request_type_sample_form_grids __M_writer(unicode(render_sample_form( sample_index, sample['name'], sample['field_values'], fields_dict, display_only ))) File '/home/jcruz/galaxy-central/database/compiled_templates/requests/common/common.mako.py', line 73 in render_sample_form return render_render_sample_form(context,index,sample_name,sample_values,fields_dict,display_only) File '/home/jcruz/galaxy-central/database/compiled_templates/requests/common/common.mako.py', line 186 in render_render_sample_form field_value = sample_values[ field_name ] KeyError: '1_field_name'
Let me know if you need anything else. Thanks again!
joe
On Wed, Jun 8, 2011 at 2:49 PM, Greg Von Kuster <greg@bx.psu.edu> wrote: Joe,
Thanks very much for the example csv file. I've fixed this issue in change set 5668:81a5c317d909, which should be available in the distribution within the next few weeks. If you don't want to wait, you can update from our development repo at https://bitbucket.org/galaxy/galaxy-central/wiki/Home.
Greg Von Kuster
On Jun 7, 2011, at 6:21 PM, Joe Cruz wrote:
For my sample forms I have fields for Sample type, concentration, run type, and read length.
I greatly appreciate your help Greg. If you have any other questions let me know.
Thanks,
Joe
On Tue, Jun 7, 2011 at 2:56 PM, Greg Von Kuster <greg@bx.psu.edu> wrote: Hello Joe,
Can you send me your csv file?
Thanks!
On Jun 7, 2011, at 10:45 AM, Joe Cruz wrote:
Hello Everyone,
I wanted to ask if anyone has experience successfully importing sample information through a csv file.
I know there is an issue already created for csv file import, which I left a comment earlier:
but my bug doesn't seem to deal with an 'Invalid Request ID' as the issue above states.
This is the error I get:
URL: http://localhost/requests_common/add_samples?cntrller=requests&id=a65cf3ca8eb85be3 File '/home/galaxy1/galaxy-dist/eggs/Paste-1.6-py2.6.egg/paste/exceptions/errormiddleware.py', line 143 in __call__ app_iter = self.application(environ, start_response) File '/home/galaxy1/galaxy-dist/eggs/Paste-1.6-py2.6.egg/paste/debug/prints.py', line 98 in __call__ environ, self.app) File '/home/galaxy1/galaxy-dist/eggs/Paste-1.6-py2.6.egg/paste/wsgilib.py', line 539 in intercept_output app_iter = application(environ, replacement_start_response) File '/home/galaxy1/galaxy-dist/eggs/Paste-1.6-py2.6.egg/paste/recursive.py', line 80 in __call__ return self.application(environ, start_response) File '/home/galaxy1/galaxy-dist/eggs/Paste-1.6-py2.6.egg/paste/httpexceptions.py', line 632 in __call__ return self.application(environ, start_response) File '/home/galaxy1/galaxy-dist/lib/galaxy/web/framework/base.py', line 145 in __call__ body = method( trans, **kwargs ) File '/home/galaxy1/galaxy-dist/lib/galaxy/web/framework/__init__.py', line 84 in decorator return func( self, trans, *args, **kwargs ) File '/home/galaxy1/galaxy-dist/lib/galaxy/web/controllers/requests_common.py', line 829 in add_samples return self.__import_samples( trans, cntrller, request, displayable_sample_widgets, libraries, **kwd ) File '/home/galaxy1/galaxy-dist/lib/galaxy/web/controllers/requests_common.py', line 1109 in __import_samples sample_copy_select_field=sample_copy_select_field ) File '/home/galaxy1/galaxy-dist/lib/galaxy/web/framework/__init__.py', line 650 in fill_template return self.fill_template_mako( filename, **kwargs ) File '/home/galaxy1/galaxy-dist/lib/galaxy/web/framework/__init__.py', line 661 in fill_template_mako return template.render( **data ) File '/home/galaxy1/galaxy-dist/eggs/Mako-0.2.5-py2.6.egg/mako/template.py', line 133 in render return runtime._render(self, self.callable_, args, data) File '/home/galaxy1/galaxy-dist/eggs/Mako-0.2.5-py2.6.egg/mako/runtime.py', line 364 in _render _render_context(template, callable_, context, *args, **_kwargs_for_callable(callable_, data)) File '/home/galaxy1/galaxy-dist/eggs/Mako-0.2.5-py2.6.egg/mako/runtime.py', line 381 in _render_context _exec_template(inherit, lclcontext, args=args, kwargs=kwargs) File '/home/galaxy1/galaxy-dist/eggs/Mako-0.2.5-py2.6.egg/mako/runtime.py', line 414 in _exec_template callable_(context, *args, **kwargs) File '/home/galaxy1/galaxy-dist/database/compiled_templates/base.mako.py', line 40 in render_body __M_writer(unicode(next.body())) File '/home/galaxy1/galaxy-dist/eggs/Mako-0.2.5-py2.6.egg/mako/runtime.py', line 255 in <lambda> return lambda *args, **kwargs:callable_(self.context, *args, **kwargs) File '/home/galaxy1/galaxy-dist/database/compiled_templates/requests/common/add_samples.mako.py', line 164 in render_body __M_writer(unicode(render_samples_grid( cntrller, request, displayable_sample_widgets, action='edit_samples', adding_new_samples=True, encoded_selected_sample_ids=[], render_buttons=False, grid_header=grid_header ))) File '/home/galaxy1/galaxy-dist/eggs/Mako-0.2.5-py2.6.egg/mako/runtime.py', line 255 in <lambda> return lambda *args, **kwargs:callable_(self.context, *args, **kwargs) File '/home/galaxy1/galaxy-dist/database/compiled_templates/requests/common/common.mako.py', line 749 in render_render_samples_grid sample_widget_history = sample_widget[ 'history' ] KeyError: 'history'
I greatly appreciate your help and patience.
Thanks,
joe ___________________________________________________________ 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:
Greg Von Kuster Galaxy Development Team greg@bx.psu.edu
<importSample.csv>
Greg Von Kuster Galaxy Development Team greg@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:
Greg Von Kuster Galaxy Development Team greg@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:
Greg Von Kuster Galaxy Development Team greg@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:
Greg Von Kuster Galaxy Development Team greg@bx.psu.edu