Skip to content

Commit

Permalink
Merge branch 'release/4.3.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
ra11 committed Jul 6, 2020
2 parents 5ccde59 + a9546bd commit a5fc0d7
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 128 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changes

## 4.3.4

* Eliminated redundant logic from setup script
* Updated Dockerfile to use PCAP-core 5.2.1 as base (Ubuntu 20.04)

## 4.3.3

* Add Rprofile to fix issues with scientific notation
Expand Down
33 changes: 19 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
FROM quay.io/wtsicgp/dockstore-cgpmap:3.1.4 as builder
FROM quay.io/wtsicgp/pcap-core:5.2.1 as builder

USER root

# ALL tool versions used by opt-build.sh
ENV VER_CGPVCF="v2.2.1"
ENV VER_VCFTOOLS="0.1.16"
#ENV VER_BIODBHTS="2.10"
#ENV VER_HTSLIB="1.7"
ENV VER_ALLELECOUNT="v4.0.0"
ENV VER_ALLELECOUNT="4.1.0"

RUN apt-get -yq update

RUN apt-get install -qy --no-install-recommends lsb-release

RUN echo "deb http://cran.rstudio.com/bin/linux/ubuntu `lsb_release -cs`/" >> /etc/apt/sources.list
RUN apt-get install -qy --no-install-recommends gnupg
RUN echo "deb http://cran.rstudio.com/bin/linux/ubuntu `lsb_release -cs`-cran40/" >> /etc/apt/sources.list
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
RUN apt-get -yq update

ENV DEBIAN_FRONTEND "noninteractive"
# no benefit of combined in builder stage
RUN apt-get install -yq --no-install-recommends locales
RUN apt-get install -yq --no-install-recommends g++
Expand All @@ -27,7 +26,8 @@ RUN apt-get install -yq --no-install-recommends pkg-config
RUN apt-get install -yq --no-install-recommends zlib1g-dev
RUN apt-get install -yq --no-install-recommends libbz2-dev
RUN apt-get install -yq --no-install-recommends unzip
RUN apt-get install -yq --no-install-recommends libpng12-dev
RUN apt-get install -yq --no-install-recommends libpng-dev
RUN apt-get install -yq --no-install-recommends tzdata
RUN apt-get install -yq --no-install-recommends r-base
RUN apt-get install -yq --no-install-recommends libcurl4-openssl-dev
RUN apt-get install -yq --no-install-recommends libxml2-dev
Expand Down Expand Up @@ -63,9 +63,9 @@ COPY build/Rprofile $OPT/config/Rprofile
# don't work in the default location, it can cause problems
WORKDIR /tmp/builder

COPY build/rlib-build.R build/
COPY build/libInstall.R build/
RUN mkdir -p $R_LIBS_USER
RUN Rscript build/rlib-build.R $R_LIBS_USER 2>&1 | grep '^\*'
RUN Rscript build/libInstall.R $R_LIBS_USER 2>&1 | grep '^\*'

# build tools from other repos
ADD build/opt-build.sh build/
Expand All @@ -76,17 +76,19 @@ RUN bash build/opt-build.sh $OPT
COPY . .
RUN bash build/opt-build-local.sh $OPT

FROM ubuntu:16.04
FROM ubuntu:20.04

LABEL maintainer="[email protected]" \
uk.ac.sanger.cgp="Cancer, Ageing and Somatic Mutation, Wellcome Trust Sanger Institute" \
version="4.3.3" \
version="4.3.4" \
description="Ascat NGS docker"

RUN apt-get -yq update \
&& apt-get install -qy --no-install-recommends lsb-release
&& apt-get install -qy --no-install-recommends lsb-release \
gnupg

RUN echo "deb http://cran.rstudio.com/bin/linux/ubuntu `lsb_release -cs`/" >> /etc/apt/sources.list \
ENV DEBIAN_FRONTEND "noninteractive"
RUN echo "deb http://cran.rstudio.com/bin/linux/ubuntu `lsb_release -cs`-cran40/" >> /etc/apt/sources.list \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 \
&& apt-get -yq update \
&& apt-get install -yq --no-install-recommends \
Expand All @@ -101,11 +103,14 @@ zlib1g \
liblzma5 \
libncurses5 \
p11-kit \
libcurl3-gnutls \
libcurl4 \
moreutils \
google-perftools \
libcairo2 \
gfortran \
r-base \
time \
r-base \
unattended-upgrades && \
unattended-upgrade -d -v && \
apt-get remove -yq unattended-upgrades && \
Expand Down
55 changes: 55 additions & 0 deletions build/libInstall.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
instLib = commandArgs(T)[1]

r = getOption("repos") # hard code the UK repo for CRAN
r["CRAN"] = "http://cran.uk.r-project.org"
options(repos = r)
rm(r)

ipak <- function(pkg){
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
if (length(new.pkg))
biocLite(new.pkg, ask=FALSE, lib=instLib, lib.loc=instLib)
sapply(pkg, library, character.only = TRUE)
}

ipak_bioc <- function(pkg){
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
if (length(new.pkg))
BiocManager::install(new.pkg, ask=FALSE, lib=instLib, lib.loc=instLib)
sapply(pkg, library, character.only = TRUE)
}

if( (version$major == 3 && version$minor >=5) || version$major > 3) {
# biocmanager versions of R
if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager")
BiocManager::install(ask=FALSE, lib=instLib, lib.loc=instLib)
ipak_bioc(c("data.table"))
ipak_bioc(c("gam"))
ipak_bioc(c("VGAM"))
ipak_bioc(c("stringr"))
ipak_bioc(c("mgcv"))
ipak_bioc(c("poweRlaw"))
ipak_bioc(c("zlibbioc"))
ipak_bioc(c("RColorBrewer"))
} else {
# OLD versions of R
source("http://bioconductor.org/biocLite.R")
ipak(c("data.table"))
ipak(c("gam"))
if ( version$major == 3 && version$minor < 2 ) {
install.packages("VGAM_1.0-3.tar.gz", type="source", lib=instLib, lib.loc=instLib)
} else {
ipak(c("VGAM"))
}
ipak(c("stringr"))
ipak(c("mgcv"))
ipak(c("poweRlaw"))
ipak(c("zlibbioc"))
ipak(c("RColorBrewer"))
}

# works on old and new
if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools", lib=instLib)
library(devtools)
options(download.file.method = "auto")
install_github("Irrationone/copynumber", ref="87d2663fe6b11c03cf6006b4ee9ed70450eacb5a")
31 changes: 0 additions & 31 deletions build/rlib-build.R

This file was deleted.

1 change: 0 additions & 1 deletion perl/bin/ascat.pl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ BEGIN
my $options = setup();
Sanger::CGP::Ascat::Implement::prepare($options);
my $threads = PCAP::Threaded->new($options->{'threads'});
&PCAP::Threaded::disable_out_err if(exists $options->{'index'});

# register any process that can run in parallel here
$threads->add_function('allele_count', \&Sanger::CGP::Ascat::Implement::allele_count);
Expand Down
112 changes: 30 additions & 82 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

########## LICENCE ##########
# Copyright (c) 2014-2019 Genome Research Ltd.
########## LICENSE ##########
# Copyright (c) 2014-2020 Genome Research Ltd.
#
# Author: CASM/Cancer IT <[email protected]>
#
Expand All @@ -19,15 +19,24 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
########## LICENCE ##########

# Update info in README.md if changed
ASCAT_SRC="https://raw.githubusercontent.com/Crick-CancerGenomics/ascat/v2.5.1/ASCAT/R/ascat.R"
EXP_ACV="3.3.0"
#
# 1. The usage of a range of years within a copyright statement contained within
# this distribution should be interpreted as being equivalent to a list of years
# including the first and last year specified and all consecutive years between
# them. For example, a copyright statement that reads ‘Copyright (c) 2005, 2007-
# 2009, 2011-2012’ should be interpreted as being identical to a statement that
# reads ‘Copyright (c) 2005, 2007, 2008, 2009, 2011, 2012’ and a copyright
# statement that reads ‘Copyright (c) 2005-2012’ should be interpreted as being
# identical to a statement that reads ‘Copyright (c) 2005, 2006, 2007, 2008,
# 2009, 2010, 2011, 2012’."
#
###########################

version_gt () {
test $(printf '%s\n' $@ | sort -V | head -n 1) == "$EXP_ACV";
}
# ALL tool versions used by opt-build.sh
# need to keep in sync with Dockerfile
export VER_CGPVCF="v2.2.1"
export VER_VCFTOOLS="0.1.16"
export VER_ALLELECOUNT="4.1.0"

get_file () {
# output, source
Expand All @@ -38,12 +47,13 @@ get_file () {
fi
}


if [[ ($# -ne 1 && $# -ne 2) ]] ; then
echo "Please provide an installation path and optionally perl lib paths to allow, e.g."
echo " ./setup.sh /opt/myBundle"
echo "OR all elements versioned:"
echo " ./setup.sh /opt/cgpVcf-X.X.X /opt/PCAP-X.X.X/lib/perl:/some/other/lib/perl..."
exit 0
exit 1
fi

INST_PATH=$1
Expand All @@ -55,7 +65,7 @@ fi
# get current directory
INIT_DIR=`pwd`

set -eu
set -e

# cleanup inst_path
mkdir -p $INST_PATH/bin
Expand All @@ -82,84 +92,22 @@ export PATH=$INST_PATH/bin:$PATH
SETUP_DIR=$INIT_DIR/install_tmp
mkdir -p $SETUP_DIR

cd $SETUP_DIR

## grab cpanm and stick in workspace, then do a self upgrade into bin:
#install cpanm
get_file $SETUP_DIR/cpanm https://cpanmin.us/
perl $SETUP_DIR/cpanm -l $INST_PATH App::cpanminus
CPANM=`which cpanm`
echo $CPANM

PCAP=`perl -le 'eval "require $ARGV[0]" and print $ARGV[0]->VERSION' PCAP`
if [[ "x$PCAP" == "x" ]] ; then
echo "PREREQUISITE: Please install PCAP-core before proceeding:"
echo " https://github.com/ICGC-TCGA-PanCancer/PCAP-core/releases"
exit 1;
fi

AC=`perl -le 'eval "require $ARGV[0]" and print $ARGV[0]->VERSION' Sanger::CGP::AlleleCount`
if [[ "x$AC" == "x" ]] ; then
echo "PREREQUISITE: Please install alleleCount version >= $EXP_ACV before proceeding:"
echo " https://github.com/cancerit/alleleCount/releases"
exit 1;
else
if version_gt $AC $EXP_ACV; then
echo " alleleCounter version is good ($AC)"
else
echo "PREREQUISITE: Please install alleleCount version >= $EXP_ACV before proceeding (Found version $AC):"
echo " https://github.com/cancerit/alleleCount/releases"
exit 1;
fi
fi

VCF=`perl -le 'eval "require $ARGV[0]" and print $ARGV[0]->VERSION' Sanger::CGP::Vcf`
if [[ "x$VCF" == "x" ]] ; then
echo "PREREQUISITE: Please install cgpVcf before proceeding:"
echo " https://github.com/cancerit/cgpVcf/releases"
exit 1;
fi

HTS=`perl -le 'eval "require $ARGV[0]" and print $ARGV[0]->VERSION' Bio::DB::HTS`
if [[ "x$HTS" == "x" ]] ; then
echo "PREREQUISITE: Please install Bio::DB::HTS before proceeding:"
echo " https://github.com/Ensembl/Bio-HTS/releases"
exit 1;
fi

perlmods=( "File::ShareDir" "File::ShareDir::Install" )

for i in "${perlmods[@]}" ; do
echo "Installing build prerequisite $i..."
$CPANM -v --mirror http://cpan.metacpan.org -l $INST_PATH $i
done

cd $INIT_DIR/perl

echo -n "Installing Perl prerequisites ..."
if ! ( perl -MExtUtils::MakeMaker -e 1 >/dev/null 2>&1); then
echo
echo "WARNING: Your Perl installation does not seem to include a complete set of core modules. Attempting to cope with this, but if installation fails please make sure that at least ExtUtils::MakeMaker is installed. For most users, the best way to do this is to use your system's package manager: apt, yum, fink, homebrew, or similar."
fi

$CPANM -v --mirror http://cpan.metacpan.org --notest -l $INST_PATH/ --installdeps . < /dev/null

echo -n "Installing ascatNgs ..."
get_file share/ascat/ascat.R $ASCAT_SRC
perl Makefile.PL INSTALL_BASE=$INST_PATH
make
make test
make install
rm share/ascat/ascat.R

# cleanup all junk
rm -rf $SETUP_DIR
#install R stuff
export R_LIBS=$INST_PATH/R-libs
export R_LIBS_USER=$INST_PATH/R-libs
mkdir -p $R_LIBS_USER
Rscript build/libInstall.R $R_LIBS_USER 2>&1 | grep '^\*'
bash build/opt-build.sh $INST_PATH
bash build/opt-build-local.sh $INST_PATH

echo
echo
echo "Please add the following to beginning of path:"
echo " $INST_PATH/bin"
echo "Please add the following to beginning of PERL5LIB:"
echo " $PERLROOT"
echo

exit 0

0 comments on commit a5fc0d7

Please sign in to comment.