Skip to content

Commit

Permalink
Merge branch 'hotfix/v3.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranmraine committed Jul 22, 2017
2 parents cbd05d6 + 53d2670 commit 2be0f57
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 32 deletions.
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
### 3.2.2
* Add bedtools2 to `setup.sh`
* Added bedtools2 to `README.md`
* Changes `Bio::DB::HTS`, `samtools` and `HTSlib` install methods.
* Corrected condition indicating sort is required.
* Fixes #23 Changed from vcf-sort to normal linux sort to ensure multiple indels with
same start coord are sorted in a stable way.

### 3.2.0
* Allows use of ensemblgenomes.org as a datasource
* Handle genes without names, and give more useful error message
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ as well as Sequence Ontology terms to classify its consequences.

---

###Dependencies/Install
### Dependencies/Install
Some of the code included in this package has dependencies on several packages:

* [Samtools v1.3+](https://github.com/samtools/samtools)
* [vcftools](https://vcftools.github.io/)
* [Bio::DB::HTS](http://search.cpan.org/~rishidev/Bio-DB-HTS/)
* [bedtools2](http://bedtools.readthedocs.io/en/latest/index.html)
* Not >=2.24.0, no upgrades until [this ticket](https://github.com/arq5x/bedtools2/issues/319) is resolved (which may involve code changes)

And various perl modules.

Expand All @@ -30,12 +32,12 @@ Please be aware that this expects basic C compilation libraries and tools to be

---

##Creating a release
####Preparation
## Creating a release
#### Preparation
* Commit/push all relevant changes.
* Pull a clean version of the repo and use this for the following steps.

####Cutting the release
#### Cutting the release
1. Update `lib/Sanger/CGP/Vagrent.pm` to the correct version.
2. Update `CHANGES.md` to show major items.
3. Run `./prerelease.sh`
Expand All @@ -47,7 +49,7 @@ Please be aware that this expects basic C compilation libraries and tools to be
LICENCE
=======

Copyright (c) 2014-2016 Genome Research Ltd.
Copyright (c) 2014-2017 Genome Research Ltd.

Author: Cancer Genome Project <[email protected]>

Expand Down
14 changes: 9 additions & 5 deletions bin/AnnotateVcf.pl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/perl

##########LICENCE##########
# Copyright (c) 2014 Genome Research Ltd.
# Copyright (c) 2014-2017 Genome Research Ltd.
#
# Author: Cancer Genome Project [email protected]
#
Expand Down Expand Up @@ -34,6 +34,7 @@

use List::Util qw(first);
use File::Temp qw(tempfile);
use File::Copy qw(copy);
use Try::Tiny qw(try catch);

use FindBin qw($Bin);
Expand Down Expand Up @@ -78,7 +79,7 @@
const my $REPRE_BM => Sanger::CGP::Vagrent::Bookmarkers::RepresentativeTranscriptBookmarker->new();
const my $WORST_BM => Sanger::CGP::Vagrent::Bookmarkers::MostDeleteriousBookmarker->new();

const my $SORT_CMD => 'cat %s | vcf-sort > %s';
const my $SORT_CMD => q{(grep -B 100000000 -m 1 '^#CHROM' %s ; grep -v '^#' %s | sort -k1,1 -k2,2n -k4,4 -k5,5) > %s};
const my $BGZIP_CMD => 'bgzip %s';
const my $TABIX_CMB => 'tabix -p vcf %s';

Expand Down Expand Up @@ -119,14 +120,17 @@
sub compressAndIndex {
my ($options, $tmpfile) = @_;

my $sort_cmd = sprintf $SORT_CMD, $tmpfile, $options->{'output'};
my $sort_cmd = sprintf $SORT_CMD, $tmpfile, $tmpfile, $options->{'output'};
my $bgzip_cmd = sprintf $BGZIP_CMD, $options->{'output'};
my $totabix = $options->{'output'} .'.gz';
my $tabix_cmd = sprintf $TABIX_CMB, $totabix;

try {
my $tabix_in = $options->{'input'}.'.tbx';
unless(-e $tabix_in){
my $tabix_in = $options->{'input'}.'.tbi';
if(-e $tabix_in) {
copy($tmpfile, $options->{'output'});
}
else {
# If the input has a tabix index it must have already been sorted,
# we haven't changed the order of the file so we can skip this sort
system($sort_cmd);
Expand Down
4 changes: 2 additions & 2 deletions lib/Sanger/CGP/Vagrent.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package Sanger::CGP::Vagrent;

##########LICENCE##########
# Copyright (c) 2014-2016 Genome Research Ltd.
# Copyright (c) 2014-2017 Genome Research Ltd.
#
# Author: Cancer Genome Project [email protected]
#
Expand All @@ -26,7 +26,7 @@ use strict;
use Const::Fast qw(const);

use base 'Exporter';
our $VERSION = '3.2.1';
our $VERSION = '3.2.2';
our @EXPORT = qw($VERSION);

1;
102 changes: 82 additions & 20 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

##########LICENCE##########
# Copyright (c) 2014-2016 Genome Research Ltd.
# Copyright (c) 2014-2017 Genome Research Ltd.
#
# Author: Cancer Genome Project [email protected]
#
Expand All @@ -21,10 +21,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
##########LICENCE##########


SOURCE_SAMTOOLS="https://github.com/samtools/samtools/releases/download/1.3.1/samtools-1.3.1.tar.bz2"
BIODBHTS_INSTALL="https://raw.githubusercontent.com/Ensembl/Bio-HTS/master/INSTALL.pl"
SOURCE_HTSLIB="https://github.com/samtools/htslib/releases/download/1.3.2/htslib-1.3.2.tar.bz2"
SOURCE_BIOBDHTS="https://github.com/Ensembl/Bio-HTS/archive/2.3.tar.gz"
SOURCE_VCFTOOLS="https://github.com/vcftools/vcftools/releases/download/v0.1.14/vcftools-0.1.14.tar.gz"
# Warning bedtools 2.24.0 and 2.25.0 have a swapped usage in coverageBed
# No upgrades until [this ticket](https://github.com/arq5x/bedtools2/issues/319) is resolved
SOURCE_BEDTOOLS="https://github.com/arq5x/bedtools2/releases/download/v2.21.0/bedtools-2.21.0.tar.gz"

get_distro () {
EXT=""
Expand Down Expand Up @@ -62,7 +65,7 @@ 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"
echo " ./setup.sh /opt/myBundle /opt/cgpVcf-X.X.X/lib/perl5:/opt/PCAP-X.X.X/lib/perl5"
exit 0
fi

Expand Down Expand Up @@ -120,18 +123,35 @@ perl $SETUP_DIR/cpanm -l $INST_PATH App::cpanminus
CPANM=`which cpanm`
echo $CPANM

perlmods=( "File::ShareDir" "File::ShareDir::Install" "Bio::Root::[email protected]")
perlmods=( "File::ShareDir" "File::ShareDir::Install" "Module::Build" "Bio::Root::[email protected]")

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

echo -n "Building bedtools2 ..."
if [ -e $SETUP_DIR/bedtools.success ]; then
echo -n " previously installed (resumed)...";
elif [ -e $INST_PATH/bin/bedtools ]; then
echo -n " previously installed ...";
else
cd $SETUP_DIR
get_distro "bedtools2" $SOURCE_BEDTOOLS
mkdir -p bedtools2
tar --strip-components 1 -C bedtools2 -zxf bedtools2.tar.gz
make -C bedtools2 -j$CPU
cp bedtools2/bin/* $INST_PATH/bin/.
touch $SETUP_DIR/bedtools.success
fi

CURR_TOOL="vcftools"
CURR_SOURCE=$SOURCE_VCFTOOLS
echo -n "Building $CURR_TOOL ..."
if [ -e $SETUP_DIR/$CURR_TOOL.success ]; then
echo -n " previously installed ..."
echo -n " previously installed (resumed) ..."
elif [ -e $INST_PATH/bin/$CURR_TOOL ]; then
echo -n " previously installed ...";
else
get_distro $CURR_TOOL $CURR_SOURCE
cd $SETUP_DIR/$CURR_TOOL
Expand All @@ -142,29 +162,71 @@ else
touch $SETUP_DIR/$CURR_TOOL.success
fi

echo -n "Building samtools ..."
if [ -e "$SETUP_DIR/samtools.success" ]; then
echo -n " previously installed ...";
if [ -e $SETUP_DIR/htslibGet.success ]; then
echo " already staged ...";
else
echo
cd $SETUP_DIR
get_distro "samtools" $SOURCE_SAMTOOLS
cd samtools
get_distro "htslib" $SOURCE_HTSLIB
touch $SETUP_DIR/htslibGet.success
fi

echo -n "Building htslib ..."
if [ -e $SETUP_DIR/htslib.success ]; then
echo " previously installed ...";
else
echo
mkdir -p htslib
tar --strip-components 1 -C htslib -jxf htslib.tar.bz2
cd htslib
./configure --enable-plugins --enable-libcurl --prefix=$INST_PATH
make all all-htslib
make install install-htslib
touch $SETUP_DIR/samtools.success
make -j$CPU
make install
cd $SETUP_DIR
touch $SETUP_DIR/htslib.success
fi

export HTSLIB=$INST_PATH

CHK=`perl -le 'eval "require $ARGV[0]" and print $ARGV[0]->VERSION' Bio::DB::HTS`
if [[ "x$CHK" == "x" ]] ; then
echo -n "Building Bio::DB::HTS ..."
cd $SETUP_DIR
# now Bio::DB::HTS
get_file "INSTALL.pl" $BIODBHTS_INSTALL
perl -I $PERL5LIB INSTALL.pl --prefix $INST_PATH --static
rm -f BioDbHTS_INSTALL.pl
if [ -e $SETUP_DIR/biohts.success ]; then
echo " previously installed ...";
else
echo
cd $SETUP_DIR
rm -rf bioDbHts
get_distro "bioDbHts" $SOURCE_BIOBDHTS
tar --strip-components 1 -C bioDbHts -zxf bioDbHts.tar.gz
cd bioDbHts
perl Build.PL --install_base=$INST_PATH --htslib=$INST_PATH
./Build test
./Build install
cd $SETUP_DIR
rm -f bioDbHts.tar.gz
touch $SETUP_DIR/biohts.success
fi
else
echo "Bio::DB::HTS already installed ..."
fi

if [ -e $SETUP_DIR/samtools.success ]; then
echo " previously installed ...";
else
echo "Bio::DB::HTS already installed"
echo
cd $SETUP_DIR
rm -rf samtools
get_distro "samtools" $SOURCE_SAMTOOLS
mkdir -p samtools
tar --strip-components 1 -C samtools -xjf samtools.tar.bz2
cd samtools
./configure --enable-plugins --enable-libcurl --with-htslib=$HTSLIB --prefix=$INST_PATH
make -j$CPU all
make install
cd $SETUP_DIR
rm -f samtools.tar.bz2
touch $SETUP_DIR/samtools.success
fi

cd $INIT_DIR
Expand Down

0 comments on commit 2be0f57

Please sign in to comment.