Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added recipe for kinSimRiboswitch #10838

Merged
merged 14 commits into from
Oct 2, 2018
27 changes: 27 additions & 0 deletions recipes/kinsimriboswitch/activate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

# Unset the passed env var <myvar>, backing up its value in BAK_<myvar>.
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

79 changes: 79 additions & 0 deletions recipes/kinsimriboswitch/build.sh
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions recipes/kinsimriboswitch/deactivate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

# Restore the value of passed env var <myvar> from a backup variable
# BAK_<myvar> 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

84 changes: 84 additions & 0 deletions recipes/kinsimriboswitch/meta.yaml
Original file line number Diff line number Diff line change
@@ -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