commit/galaxy-central: greg: Copy required sample files before attempting to load a tool included in a tool shed repository that is being installed into a local Galaxy instance.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/802413bc137b/ changeset: 802413bc137b user: greg date: 2012-09-13 22:41:03 summary: Copy required sample files before attempting to load a tool included in a tool shed repository that is being installed into a local Galaxy instance. affected #: 3 files diff -r 563ab1b6b311af66818ca7031746ba7201b2d7db -r 802413bc137b5701699b90ce97a2c4c8c6072679 lib/galaxy/tool_shed/install_manager.py --- a/lib/galaxy/tool_shed/install_manager.py +++ b/lib/galaxy/tool_shed/install_manager.py @@ -147,13 +147,20 @@ else: tool_dependencies = None if 'tools' in metadata_dict: + sample_files = metadata_dict.get( 'sample_files', [] ) + tool_index_sample_files = get_tool_index_sample_files( sample_files ) + copy_sample_files( self.app, tool_index_sample_files ) + sample_files_copied = [ s for s in tool_index_sample_files ] repository_tools_tups = get_repository_tools_tups( self.app, metadata_dict ) if repository_tools_tups: - sample_files = metadata_dict.get( 'sample_files', [] ) # Handle missing data table entries for tool parameters that are dynamically generated select lists. repository_tools_tups = handle_missing_data_table_entry( self.app, relative_install_dir, self.tool_path, repository_tools_tups ) # Handle missing index files for tool parameters that are dynamically generated select lists. - repository_tools_tups, sample_files_copied = handle_missing_index_file( self.app, self.tool_path, sample_files, repository_tools_tups ) + repository_tools_tups, sample_files_copied = handle_missing_index_file( self.app, + self.tool_path, + sample_files, + repository_tools_tups, + sample_files_copied ) # Copy remaining sample files included in the repository to the ~/tool-data directory of the local Galaxy instance. copy_sample_files( self.app, sample_files, sample_files_copied=sample_files_copied ) if install_dependencies and tool_dependencies and 'tool_dependencies' in metadata_dict: diff -r 563ab1b6b311af66818ca7031746ba7201b2d7db -r 802413bc137b5701699b90ce97a2c4c8c6072679 lib/galaxy/util/shed_util.py --- a/lib/galaxy/util/shed_util.py +++ b/lib/galaxy/util/shed_util.py @@ -1170,6 +1170,12 @@ file_name = strip_path( shed_tool_conf_dict[ 'config_filename' ] ) if shed_tool_conf == file_name: return index, shed_tool_conf_dict +def get_tool_index_sample_files( sample_files ): + tool_index_sample_files = [] + for s in sample_files: + if s.endswith( '.loc.sample' ): + tool_index_sample_files.append( s ) + return tool_index_sample_files def get_tool_dependency( trans, id ): """Get a tool_dependency from the database via id""" return trans.sa_session.query( trans.model.ToolDependency ).get( trans.security.decode_id( id ) ) @@ -1341,12 +1347,11 @@ # Reset the tool_data_tables by loading the empty tool_data_table_conf.xml file. reset_tool_data_tables( app ) return repository_tools_tups -def handle_missing_index_file( app, tool_path, sample_files, repository_tools_tups ): +def handle_missing_index_file( app, tool_path, sample_files, repository_tools_tups, sample_files_copied ): """ Inspect each tool to see if it has any input parameters that are dynamically generated select lists that depend on a .loc file. This method is not called from the tool shed, but from Galaxy when a repository is being installed. """ - sample_files_copied = [] for index, repository_tools_tup in enumerate( repository_tools_tups ): tup_path, guid, repository_tool = repository_tools_tup params_with_missing_index_file = repository_tool.params_with_missing_index_file diff -r 563ab1b6b311af66818ca7031746ba7201b2d7db -r 802413bc137b5701699b90ce97a2c4c8c6072679 lib/galaxy/web/controllers/admin_toolshed.py --- a/lib/galaxy/web/controllers/admin_toolshed.py +++ b/lib/galaxy/web/controllers/admin_toolshed.py @@ -720,13 +720,20 @@ tool_dependencies = create_tool_dependency_objects( trans.app, tool_shed_repository, relative_install_dir, set_status=True ) if 'tools' in metadata_dict: tool_panel_dict = generate_tool_panel_dict_for_new_install( metadata_dict[ 'tools' ], tool_section ) + sample_files = metadata_dict.get( 'sample_files', [] ) + tool_index_sample_files = get_tool_index_sample_files( sample_files ) + copy_sample_files( self.app, tool_index_sample_files ) + sample_files_copied = [ s for s in tool_index_sample_files ] repository_tools_tups = get_repository_tools_tups( trans.app, metadata_dict ) if repository_tools_tups: # Handle missing data table entries for tool parameters that are dynamically generated select lists. repository_tools_tups = handle_missing_data_table_entry( trans.app, relative_install_dir, tool_path, repository_tools_tups ) # Handle missing index files for tool parameters that are dynamically generated select lists. - sample_files = metadata_dict.get( 'sample_files', [] ) - repository_tools_tups, sample_files_copied = handle_missing_index_file( trans.app, tool_path, sample_files, repository_tools_tups ) + repository_tools_tups, sample_files_copied = handle_missing_index_file( trans.app, + tool_path, + sample_files, + repository_tools_tups, + sample_files_copied ) # Copy remaining sample files included in the repository to the ~/tool-data directory of the local Galaxy instance. copy_sample_files( trans.app, sample_files, sample_files_copied=sample_files_copied ) add_to_tool_panel( app=trans.app, 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