5 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/66f388d6a822/ Changeset: 66f388d6a822 Branch: R_environment User: BjoernGruening Date: 2013-09-16 12:18:00 Summary: Add an advanced R_environment. Setup an R environment with a special R version: <action type="setup_r_environment"><r_base name="package_r_3_0_1" owner="bgruening" /></action> Allow downloading and installing an R package: <r_package>https://github.com/bgruening/download_store/raw/master/DESeq2-1_0_18/BiocGenerics_0.6.0.tar.gz</r_package> Affected #: 2 files diff -r 5b17d89780b381bfd53712f964e0b53137adc322 -r 66f388d6a822628aab96f012621940e921f17de8 lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py @@ -303,6 +303,37 @@ filename = url.split( '/' )[ -1 ] td_common_util.url_download( work_dir, filename, url ) dir = os.path.curdir + elif action_type == 'setup_r_environment': + # setup an R environment + # <action type="setup_r_environment"> + # <r_base name="package_r_3_0_1" owner="bgruening" /> + # </action> + # allow downloading and installing an R package + # <r_package>https://github.com/bgruening/download_store/raw/master/DESeq2-1_0_18/BiocGenerics_0.6.0.tar.gz</r_package> + if action_dict.get( 'env_shell_file_paths', False ): + install_environment.add_env_shell_file_paths( action_dict[ 'env_shell_file_paths' ] ) + else: + log.warning( 'Missing R environment. Please check your specified R installation exists.' ) + return + tarball_names = list() + for url in action_dict[ 'r_packages' ]: + filename = url.split( '/' )[ -1 ] + tarball_names.append( filename ) + common_util.url_download( work_dir, filename, url, extract=False ) + dir = os.path.curdir + current_dir = os.path.abspath( os.path.join( work_dir, dir ) ) + with lcd( current_dir ): + with settings( warn_only=True ): + for tarball_name in tarball_names: + cmd = '''export PATH=$PATH:$R_HOME/bin && export R_LIBS=$INSTALL_DIR && + Rscript -e "install.packages(c('%s'),lib='$INSTALL_DIR', repos=NULL, dependencies=FALSE)"''' % (tarball_name) + + cmd = install_environment.build_command( common_util.evaluate_template( cmd, install_dir ) ) + return_code = handle_command( app, tool_dependency, install_dir, cmd ) + if return_code: + return + + else: # We're handling a complex repository dependency where we only have a set_environment tag set. # <action type="set_environment"> diff -r 5b17d89780b381bfd53712f964e0b53137adc322 -r 66f388d6a822628aab96f012621940e921f17de8 lib/tool_shed/galaxy_install/tool_dependencies/install_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py @@ -602,6 +602,26 @@ # lxml==2.3.0</action> ## Manually specify contents of requirements.txt file to create dynamically. action_dict[ 'requirements' ] = td_common_util.evaluate_template( action_elem.text or 'requirements.txt', install_dir ) + elif action_type == 'setup_r_environment': + # setup an R environment + # <action type="setup_r_environment" name="package_r_3_0_1" owner="bgruening"> + # <r_package>https://github.com/bgruening/download_store/raw/master/DESeq2-1_0_18/BiocGenerics_0.6.0.tar.gz</r_package> + # </action> + + env_shell_file_paths = td_common_util.get_env_shell_file_paths( app, action_elem.find('repository') ) + + all_env_shell_file_paths.extend( env_shell_file_paths ) + if all_env_shell_file_paths: + action_dict[ 'env_shell_file_paths' ] = all_env_shell_file_paths + r_packages = list() + for env_elem in action_elem: + if env_elem.tag == 'r_package': + r_packages.append( env_elem.text.strip() ) + + if r_packages: + action_dict[ 'r_packages' ] = r_packages + else: + continue elif action_type == 'chmod': # Change the read, write, and execute bits on a file. # <action type="chmod"> https://bitbucket.org/galaxy/galaxy-central/commits/8fe3988b1811/ Changeset: 8fe3988b1811 Branch: R_environment User: BjoernGruening Date: 2013-09-16 15:36:45 Summary: merge Affected #: 1 file diff -r 66f388d6a822628aab96f012621940e921f17de8 -r 8fe3988b181190c151c30c014e25fc4211f77b18 lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py @@ -424,7 +424,7 @@ return elif action_type == 'shell_command': with settings( warn_only=True ): - install_environment.add_env_shell_file_paths( action_dict[ 'env_shell_file_paths' ] ) + cmd = install_environment.build_command( action_dict[ 'command' ] ) return_code = handle_command( app, tool_dependency, install_dir, cmd ) if return_code: return https://bitbucket.org/galaxy/galaxy-central/commits/6cc367d73045/ Changeset: 6cc367d73045 Branch: R_environment User: BjoernGruening Date: 2013-09-16 17:01:29 Summary: Change the <r_package> tag to <package>, because we are already in a special <setup_r_environment> environment. Affected #: 2 files diff -r 8fe3988b181190c151c30c014e25fc4211f77b18 -r 6cc367d730457c01cfdfc457f5e3d8ecfa8e9ea1 lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py @@ -309,7 +309,7 @@ # <r_base name="package_r_3_0_1" owner="bgruening" /> # </action> # allow downloading and installing an R package - # <r_package>https://github.com/bgruening/download_store/raw/master/DESeq2-1_0_18/BiocGenerics_0.6.0.tar.gz</r_package> + # <package>https://github.com/bgruening/download_store/raw/master/DESeq2-1_0_18/BiocGenerics_0.6.0.tar.gz</package> if action_dict.get( 'env_shell_file_paths', False ): install_environment.add_env_shell_file_paths( action_dict[ 'env_shell_file_paths' ] ) else: @@ -319,7 +319,7 @@ for url in action_dict[ 'r_packages' ]: filename = url.split( '/' )[ -1 ] tarball_names.append( filename ) - common_util.url_download( work_dir, filename, url, extract=False ) + td_common_util.url_download( work_dir, filename, url, extract=False ) dir = os.path.curdir current_dir = os.path.abspath( os.path.join( work_dir, dir ) ) with lcd( current_dir ): @@ -328,12 +328,10 @@ cmd = '''export PATH=$PATH:$R_HOME/bin && export R_LIBS=$INSTALL_DIR && Rscript -e "install.packages(c('%s'),lib='$INSTALL_DIR', repos=NULL, dependencies=FALSE)"''' % (tarball_name) - cmd = install_environment.build_command( common_util.evaluate_template( cmd, install_dir ) ) + cmd = install_environment.build_command( td_common_util.evaluate_template( cmd, install_dir ) ) return_code = handle_command( app, tool_dependency, install_dir, cmd ) if return_code: return - - else: # We're handling a complex repository dependency where we only have a set_environment tag set. # <action type="set_environment"> diff -r 8fe3988b181190c151c30c014e25fc4211f77b18 -r 6cc367d730457c01cfdfc457f5e3d8ecfa8e9ea1 lib/tool_shed/galaxy_install/tool_dependencies/install_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py @@ -605,7 +605,7 @@ elif action_type == 'setup_r_environment': # setup an R environment # <action type="setup_r_environment" name="package_r_3_0_1" owner="bgruening"> - # <r_package>https://github.com/bgruening/download_store/raw/master/DESeq2-1_0_18/BiocGenerics_0.6.0.tar.gz</r_package> + # <package>https://github.com/bgruening/download_store/raw/master/DESeq2-1_0_18/BiocGenerics_0.6.0.tar.gz</package> # </action> env_shell_file_paths = td_common_util.get_env_shell_file_paths( app, action_elem.find('repository') ) @@ -615,7 +615,7 @@ action_dict[ 'env_shell_file_paths' ] = all_env_shell_file_paths r_packages = list() for env_elem in action_elem: - if env_elem.tag == 'r_package': + if env_elem.tag == 'package': r_packages.append( env_elem.text.strip() ) if r_packages: https://bitbucket.org/galaxy/galaxy-central/commits/e19c7819ea3c/ Changeset: e19c7819ea3c Branch: R_environment User: BjoernGruening Date: 2013-09-17 17:21:10 Summary: set the R_LIBS env var automatically Affected #: 1 file diff -r 6cc367d730457c01cfdfc457f5e3d8ecfa8e9ea1 -r e19c7819ea3c0b9d2ae97fa8bb8cafc722240a04 lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py @@ -332,6 +332,14 @@ return_code = handle_command( app, tool_dependency, install_dir, cmd ) if return_code: return + + # R libraries are installed to $INSTALL_DIR (install_dir), we now set the R_LIBS path to that directory + # TODO: That code is used a lot for the different environments and should be refactored, once the environments are integrated + modify_env_command_dict = dict( name="R_LIBS", action="prepend_to", value=install_dir ) + modify_env_command = td_common_util.create_or_update_env_shell_file( install_dir, modify_env_command_dict ) + return_code = handle_command( app, tool_dependency, install_dir, modify_env_command ) + if return_code: + return else: # We're handling a complex repository dependency where we only have a set_environment tag set. # <action type="set_environment"> https://bitbucket.org/galaxy/galaxy-central/commits/8de5aa8e59ef/ Changeset: 8de5aa8e59ef User: inithello Date: 2013-10-15 17:24:21 Summary: Merged in BjoernGruening/galaxy-central-bgruening/R_environment (pull request #219) Implementation of the a r_environment to easily install R packages in a reproducible way. Affected #: 2 files diff -r 86573eb35eec9474ac4121875da321811f343994 -r 8de5aa8e59eff9acfccbdd961d4a8c6a3ff64e40 lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py @@ -338,6 +338,43 @@ filename = url.split( '/' )[ -1 ] td_common_util.url_download( work_dir, filename, url ) dir = os.path.curdir + elif action_type == 'setup_r_environment': + # setup an R environment + # <action type="setup_r_environment"> + # <r_base name="package_r_3_0_1" owner="bgruening" /> + # </action> + # allow downloading and installing an R package + # <package>https://github.com/bgruening/download_store/raw/master/DESeq2-1_0_18/BiocGenerics_0.6.0.tar.gz</package> + if action_dict.get( 'env_shell_file_paths', False ): + install_environment.add_env_shell_file_paths( action_dict[ 'env_shell_file_paths' ] ) + else: + log.warning( 'Missing R environment. Please check your specified R installation exists.' ) + return + tarball_names = list() + for url in action_dict[ 'r_packages' ]: + filename = url.split( '/' )[ -1 ] + tarball_names.append( filename ) + td_common_util.url_download( work_dir, filename, url, extract=False ) + dir = os.path.curdir + current_dir = os.path.abspath( os.path.join( work_dir, dir ) ) + with lcd( current_dir ): + with settings( warn_only=True ): + for tarball_name in tarball_names: + cmd = '''export PATH=$PATH:$R_HOME/bin && export R_LIBS=$INSTALL_DIR && + Rscript -e "install.packages(c('%s'),lib='$INSTALL_DIR', repos=NULL, dependencies=FALSE)"''' % (tarball_name) + + cmd = install_environment.build_command( td_common_util.evaluate_template( cmd, install_dir ) ) + return_code = handle_command( app, tool_dependency, install_dir, cmd ) + if return_code: + return + + # R libraries are installed to $INSTALL_DIR (install_dir), we now set the R_LIBS path to that directory + # TODO: That code is used a lot for the different environments and should be refactored, once the environments are integrated + modify_env_command_dict = dict( name="R_LIBS", action="prepend_to", value=install_dir ) + modify_env_command = td_common_util.create_or_update_env_shell_file( install_dir, modify_env_command_dict ) + return_code = handle_command( app, tool_dependency, install_dir, modify_env_command ) + if return_code: + return else: # We're handling a complex repository dependency where we only have a set_environment tag set. # <action type="set_environment"> diff -r 86573eb35eec9474ac4121875da321811f343994 -r 8de5aa8e59eff9acfccbdd961d4a8c6a3ff64e40 lib/tool_shed/galaxy_install/tool_dependencies/install_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py @@ -606,6 +606,26 @@ # lxml==2.3.0</action> ## Manually specify contents of requirements.txt file to create dynamically. action_dict[ 'requirements' ] = td_common_util.evaluate_template( action_elem.text or 'requirements.txt', install_dir ) + elif action_type == 'setup_r_environment': + # setup an R environment + # <action type="setup_r_environment" name="package_r_3_0_1" owner="bgruening"> + # <package>https://github.com/bgruening/download_store/raw/master/DESeq2-1_0_18/BiocGenerics_0.6.0.tar.gz</package> + # </action> + + env_shell_file_paths = td_common_util.get_env_shell_file_paths( app, action_elem.find('repository') ) + + all_env_shell_file_paths.extend( env_shell_file_paths ) + if all_env_shell_file_paths: + action_dict[ 'env_shell_file_paths' ] = all_env_shell_file_paths + r_packages = list() + for env_elem in action_elem: + if env_elem.tag == 'package': + r_packages.append( env_elem.text.strip() ) + + if r_packages: + action_dict[ 'r_packages' ] = r_packages + else: + continue elif action_type == 'chmod': # Change the read, write, and execute bits on a file. # <action type="chmod"> 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.