Skip to content

Commit

Permalink
Merge branch 'master' of github.com:BIMSBbioinfo/pigx_bsseq
Browse files Browse the repository at this point in the history
  • Loading branch information
Blosberg committed Jun 27, 2018
2 parents 15f7049 + 3b8680e commit 5627d8b
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*~

# autoconf generated files
qsub-template.sh
configure
config.status
pigx-bsseq
Expand Down
3 changes: 2 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ nodist_bin_SCRIPTS = \
pigx-bsseq

dist_pkglibexec_SCRIPTS = \
BSseq_pipeline.py
BSseq_pipeline.py \
qsub-template.sh

pkglibexec_scriptsdir = $(pkglibexecdir)/scripts
dist_pkglibexec_scripts_SCRIPTS = \
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.8
0.0.9
14 changes: 13 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,22 @@ AX_COMPARE_VERSION([$SAMTOOLS_VERSION], [lt], [$SAMTOOLS_VERSION_MIN],
[AC_MSG_ERROR([Please install Samtools $SAMTOOLS_VERSION_MIN.])])
])

AC_ARG_ENABLE([environment-capture],
AS_HELP_STRING([--disable-environment-capture], [Do not capture environment variables.]),
[AC_MSG_NOTICE([Environment variables will not be captured.])],
[dnl
AC_MSG_NOTICE([Environment variables will be captured.])
capture_environment=yes
AC_ARG_VAR(R_LIBS_SITE, The search path for all R packages)
AC_ARG_VAR(PYTHONPATH, The search path for all Python packages)
])

AC_SUBST([capture_environment])
AC_CONFIG_FILES([etc/settings.yaml
report_templates/index.Rmd
report_templates/diffmeth.Rmd
Makefile])
Makefile
qsub-template.sh])
AC_CONFIG_FILES([test.sh], [chmod +x test.sh])
AC_CONFIG_FILES([pigx-bsseq], [chmod +x pigx-bsseq])

Expand Down
2 changes: 1 addition & 1 deletion m4/ax_r_package.m4
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ AC_DEFUN([AX_R_PACKAGE], [
if test -n "VERSION"
then
TEST=$( $R --silent --vanilla -e 'if(!(packageDescription("PKG")$Version >= "VERSION")) stop("not found")' 2>/dev/null )
TEST=$( $R --silent --vanilla -e 'if(compareVersion(packageDescription("PKG")$Version, "VERSION") < 0) { stop("not found") }' 2>/dev/null )
AS_IF([test $? -eq 0], [], [
AC_MSG_RESULT([no])
AC_MSG_ERROR([You need at least version VERSION of the R package PKG.])
Expand Down
17 changes: 14 additions & 3 deletions pigx-bsseq.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,17 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.


if 'yes' == '@capture_environment@':
import os, sys
os.environ["R_LIBS_SITE"] = "@R_LIBS_SITE@"
os.environ["PYTHONPATH"] = "@PYTHONPATH@"
# Setting PYTHONPATH does not help with dependencies needed for
# this script.
for directory in "@PYTHONPATH@".split(":"):
try:
sys.path.index(directory)
except ValueError:
sys.path.insert(1, directory)


import argparse
Expand Down Expand Up @@ -325,7 +335,7 @@ def prepare_links():
contents = path.join(where, 'etc/CONTENTS.txt')
else:
contents = path.join(config['locations']['pkgdatadir'], 'CONTENTS.txt')
shutil.copy(contents, path.join(config['locations']['output-dir'], 'pigx_work/'))
shutil.copyfile(contents, path.join(config['locations']['output-dir'], 'pigx_work/CONTENTS.txt'))

# Link the reference genome
try:
Expand Down Expand Up @@ -491,12 +501,13 @@ if config['execution']['submit-to-cluster']:
exit(1)
else:
raise
qsub = "qsub -V %s -l h_stack={cluster.h_stack} -l h_vmem={cluster.MEM} %s -b y -pe smp {cluster.nthreads} -cwd" % ( queue_selection_string, contact_email_string)
qsub = "qsub -v R_LIBS_USER -v PATH -v GUIX_LOCPATH %s -l h_stack={cluster.h_stack} -l h_vmem={cluster.MEM} %s -b y -pe smp {cluster.nthreads} -cwd" % ( queue_selection_string, contact_email_string)
if config['execution']['cluster']['args']:
qsub += " " + config['execution']['cluster']['args']
command += [
"--cluster-config={}".format(cluster_config_file),
"--cluster={}".format(qsub),
"--jobscript={}/qsub-template.sh".format(config['locations']['pkglibexecdir']),
"--latency-wait={}".format(config['execution']['cluster']['missing-file-timeout'])
]
else:
Expand Down
11 changes: 11 additions & 0 deletions qsub-template.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!@GNUBASH@
# properties = {properties}

if [ 'yes' = '@capture_environment@' ]; then
export R_LIBS_SITE="@R_LIBS_SITE@"
export PYTHONPATH="@PYTHONPATH@"
fi

env

{exec_job}

0 comments on commit 5627d8b

Please sign in to comment.