I was successful getting library dataset selection and form submission to 
happen within tool form tool form input <param type="library_data" ...> - Yay!  
But it appears one last fix (besides the "url: 
"/visualization/list_libraries",' bug) is needed to enable history tool item to 
be RERUN.

So if a galaxy dev can tackle this, great!  Otherwise I'll have to drop this 
approach :<( 

*****************
For others who may need...

tool form's param:

        <param name="library_datasets" type="library_data" label="Reference Bin 
file" help="Select one reference bin at a time from the popup window's 
Reference Bin library."/>

<command> tag contents....

        #if $library_datasets
        -B "
        #for $i, $dataset in enumerate($library_datasets)
                #$dataset.get_file_name()
                $dataset.id
        #end for
        "
        #end if

Successfully submits either the full file path of selected dataset, or its id.

*****************
However trying to rerun this history tool item gets us an error (not related to 
the above <command> contents):

        Error Traceback:
        View as:   Interactive  |  Text  |  XML (full)
        ⇝ AttributeError: 'int' object has no attribute 'id'
        ....
        Module galaxy.tools.parameters.basic:146 in value_to_basic          view
        >>  return self.to_string( value, app )
        Module galaxy.tools.parameters.basic:2406 in to_string         
        app     <galaxy.app.UniverseApplication object at 0x59a0710>
        ldda    331
        self    <galaxy.tools.parameters.basic.LibraryDatasetToolParameter 
object at 0x7fced01d2090>
        value   [331]
        >>  return [ldda.id for ldda in value]
        AttributeError: 'int' object has no attribute 'id'

which is in /lib/galaxy/tools/parameters/basic.py:

        class LibraryDatasetToolParameter( ToolParameter ):
            """
            Parameter that lets users select a LDDA from a modal window, then 
use it within the wrapper.
            """

        ...
            def to_string( self, value, app ):
                if not value:
                    return value
                return [ldda.id for ldda in value]

"Value" is getting an array of dataset ids, whereas this method is expecting 
value to be a list of dataset objects.  I tried changing ldda.id to just "id" 
but found other parts of  LibraryDatasetTool code were broken as they too were 
expecting an object.  Maybe this is related to the tool job's history detail 
link showing "Reference Bin file" as a string label of an object?:

        Input Parameter Value   Note for rerun
        BLAST results as XML    240: megablast Pasted Entry vs 
16SMicrobial.fasta       
        Reference Bin file      [<galaxy.model.LibraryDatasetDatasetAssociation 
object at 0x7fcee04d4350>]      
        Tabular Report Column Labels    Short name      
        HTML Report template    templates.html_report



********************************
The other bug:

2) Tool_form.mako has a hardcoded url that doesn't work for galaxy installs 
that have a prefix so that needs adjustment:

  $(".add-librarydataset").click(function() {
                var link = $(this);
                $.ajax({
                    url: "/visualization/list_libraries",
___________________________________________________________
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:
  https://lists.galaxyproject.org/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/

Reply via email to