From 5c296b2a43a0b6d061aa321d7460cf4af81f0f79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20K=C3=BChnl?= Date: Tue, 2 Oct 2018 17:47:15 +0200 Subject: [PATCH] Added recipe for kinSimRiboswitch (#10838) Added recipe for kinSimRiboswitch, a pipeline for simulating the folding kinetics of RNA switches. --- recipes/kinsimriboswitch/activate.sh | 27 +++++++++ recipes/kinsimriboswitch/build.sh | 79 ++++++++++++++++++++++++ recipes/kinsimriboswitch/deactivate.sh | 21 +++++++ recipes/kinsimriboswitch/meta.yaml | 84 ++++++++++++++++++++++++++ 4 files changed, 211 insertions(+) create mode 100755 recipes/kinsimriboswitch/activate.sh create mode 100644 recipes/kinsimriboswitch/build.sh create mode 100755 recipes/kinsimriboswitch/deactivate.sh create mode 100644 recipes/kinsimriboswitch/meta.yaml diff --git a/recipes/kinsimriboswitch/activate.sh b/recipes/kinsimriboswitch/activate.sh new file mode 100755 index 0000000000000..64036b684b552 --- /dev/null +++ b/recipes/kinsimriboswitch/activate.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# Unset the passed env var , backing up its value in BAK_. +backup_env_var() { + local var_name + var_name="$1" + + # Var defined and value given, or defined and NO value given + if [ -n "${!var_name}" ] || [ -z "${!var_name-foo}" ]; then + export BAK_$var_name="${!var_name}" + unset $var_name + fi +} + +backup_env_var PERL5LIB +# backup_env_var PERL_MM_OPT +# backup_env_var PERL_MB_OPT + +export PERL5LIB="$PREFIX/lib/perl5_custom:$PERL5LIB" + + + + + +# Set env vars, cf. +# https://conda.io/docs/user-guide/tasks/manage-environments.html#saving-environment-variables + diff --git a/recipes/kinsimriboswitch/build.sh b/recipes/kinsimriboswitch/build.sh new file mode 100644 index 0000000000000..23aeb0fb7c43a --- /dev/null +++ b/recipes/kinsimriboswitch/build.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +############################################################################## +## Function definitions ## +############################################################################## + +# Install a Perl distribution from a local source tarball. +# Copied from conda skeleton cpan's build.sh + tar calls. +install_perl_dist_tarball () { + local dist_tarball="$1" + if [ ! -s "$dist_tarball" ]; then + echo "Distribution tarball '$dist_tarball' empty or non-existent." + exit 1 + fi + + tar -xzf "$dist_tarball" + cd "${dist_tarball%.tar.gz}" + + if [ -f Build.PL ]; then + perl Build.PL + perl ./Build + perl ./Build test + perl ./Build install --installdirs site + elif [ -f Makefile.PL ]; then + perl Makefile.PL INSTALLDIRS=site + make + make test + make install + else + echo 'Unable to find Build.PL or Makefile.PL. You need to modify build.sh.' + exit 1 + fi + + cd .. +} + +install_bins () { + cp "$@" "$PREFIX/bin/" +} + +############################################################################## +## Main ## +############################################################################## + +mkdir -p "$PREFIX/bin" +mkdir -p "$PREFIX/lib" + +# Install binaries +install_bins "$SRC_DIR"/bin/* + +# Install patched barriers +tar -xzf 'Barriers-1.5.2.tar.gz' +cd 'Barriers-1.5.2' +./configure +make +make check +install_bins 'barriers-RNA2' +cd .. + +# Install patched Heap::Priority from local file +install_perl_dist_tarball 'Heap-Priority-0.11-mod.tar.gz' + +# Install distribution-less Perl module RNAhelper.pm +mkdir -p "$PREFIX/lib/perl5_custom" +# Make sure this path is added to PERL5LIB in activate script! +cp "$SRC_DIR"/lib/perl5/* "$PREFIX/lib/perl5_custom/" + +# Deploy activation / deactivation scripts +mkdir -p "$PREFIX/etc/conda/activate.d" +cp "$RECIPE_DIR/activate.sh" "$PREFIX/etc/conda/activate.d/$PKG_NAME-setenv.sh" +mkdir -p "$PREFIX/etc/conda/deactivate.d" +cp "$RECIPE_DIR/deactivate.sh" "$PREFIX/etc/conda/deactivate.d/$PKG_NAME-restoreenv.sh" + +# Run tests +source "$RECIPE_DIR/activate.sh" # make sure custom Perl modules are found +# make test # TODO enable +source "$RECIPE_DIR/deactivate.sh" # make sure custom Perl modules are found + +# EOF diff --git a/recipes/kinsimriboswitch/deactivate.sh b/recipes/kinsimriboswitch/deactivate.sh new file mode 100755 index 0000000000000..8ef1bb84b25bd --- /dev/null +++ b/recipes/kinsimriboswitch/deactivate.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# Restore the value of passed env var from a backup variable +# BAK_ and unset the backup variable. +restore_env_var() { + local var_name + local bak_var_name + var_name="${1}" + bak_var_name="BAK_$var_name" + + # Var defined and value given, or defined and NO value given + if [ -n "${!bak_var_name}" ] || [ -z "${!bak_var_name-foo}" ]; then + export $var_name="${!bak_var_name}" + unset $bak_var_name + fi +} + +restore_env_var PERL5LIB +# restore_env_var PERL_MM_OPT +# restore_env_var PERL_MB_OPT + diff --git a/recipes/kinsimriboswitch/meta.yaml b/recipes/kinsimriboswitch/meta.yaml new file mode 100644 index 0000000000000..a7594a8ac6096 --- /dev/null +++ b/recipes/kinsimriboswitch/meta.yaml @@ -0,0 +1,84 @@ +{% set version = '0.3' %} +{% set hash = '51ade0550b2163d4766ccaa12a361f05b910b38b373ccb2ff08df0aac2193c1b' %} + +package: + name: kinsimriboswitch + version: {{ version }} + +source: + url: http://www.bioinf.uni-leipzig.de/~felix/downloads/software/kinSimRiboswitch-{{version}}.tar.gz + sha256: {{ hash }} + +build: + number: 0 + skip: true # [win] + +requirements: + build: + - {{ compiler('c') }} + - {{ compiler('cxx') }} + - make + host: + - check + - perl + - perl-sys-info + - perl-parallel-loops + - perl-file-slurp + - perl-math-random-mt-auto + - perl-math-round + - perl-devel-assert + - perl-inline + - perl-inline-c + - perl-ipc-system-simple + - perl-list-moreutils + - perl-clone + - perl-parse-recdescent + - perl-heap + - r + - r-argparser + - r-rcolorbrewer + - viennarna + - treekin + - coreutils # need an up-to-date GNU sort + - gmp # fixes strange segfault of coreutils' expr (missing libgmp) + - tar + - perl-extutils-makemaker + run: + - perl + - perl-sys-info + - perl-parallel-loops + - perl-file-slurp + - perl-math-random-mt-auto + - perl-math-round + - perl-devel-assert + - perl-inline + - perl-inline-c + - perl-ipc-system-simple + - perl-list-moreutils + - perl-clone + - perl-parse-recdescent + - perl-heap + - r + - r-argparser + - r-rcolorbrewer + - viennarna + - treekin + - coreutils +# - gmp # Fix strange crash of conda build + +test: + commands: + - kinSimRiboswitch -h 1>/dev/null +# imports: +# - RNAhelper # perl module, TODO + + +about: + home: http://www.bioinf.uni-leipzig.de/~felix/ + license: GPLv3 + license_file: COPYING + summary: | + Pipeline for the simulation of RNA--ligand interaction kinetics as + outlined in Kuehnl et al. 2017, https://doi.org/10.1186/s12859-017-1823-5 + +