Skip to content

Commit

Permalink
Added automated tests. Bugfixing.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewels committed May 11, 2017
1 parent 7309594 commit 7bab7d0
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
work/
data/
results/
tests/test_data
.DS_Store
21 changes: 21 additions & 0 deletions .travis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
sudo: required

language: java

jdk: openjdk8

services:
- docker
install:
- mkdir /tmp/nextflow
- cd /tmp/nextflow
- wget -qO- get.nextflow.io | bash
- sudo ln -s /tmp/nextflow/nextflow /usr/local/bin/nextflow
- cd ${TRAVIS_BUILD_DIR}/tests/
- mkdir results

env:
- TEST_SUITE=docker_test
- TEST_SUITE=docker_test_bwameth

script: "./${TEST_SUITE}.sh"
21 changes: 11 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ RUN apt-get update && \
libpcre3-dev \
libreadline-dev \
libssl-dev \
libtbb-dev \
make \
python-dev \
zlib1g-dev \
Expand Down Expand Up @@ -57,20 +58,20 @@ RUN curl -fsSL https://github.com/broadinstitute/picard/releases/download/2.0.1/
rm /opt/picard-tools-2.0.1.zip
ENV PICARD_HOME /opt/picard-tools-2.0.1

# Install Bowtie2
RUN mkdir /opt/bowtie2 && \
curl -fsSL https://downloads.sourceforge.net/project/bowtie-bio/bowtie2/2.3.2/bowtie2-2.3.2-source.zip -o /opt/bowtie2/bowtie2.zip && \
unzip /opt/bowtie2/bowtie2.zip -d /opt/bowtie2 && \
cd /opt/bowtie2/bowtie2-2.3.2/ && \
make && \
ln -s /opt/bowtie2/bowtie2-2.3.2/bowtie2 /usr/local/bin/bowtie2 && \
rm /opt/bowtie2/bowtie2.zip

# Install Bismark
RUN mkdir /opt/Bismark && \
curl -fsSL https://github.com/FelixKrueger/Bismark/archive/0.17.0.zip -o /opt/Bismark/bismark.zip && \
unzip /opt/Bismark/bismark.zip -d /opt/Bismark && \
ln -s /opt/Bismark/Bismark-0.17.0/bam2nuc /usr/local/bin/bam2nuc && \
ln -s /opt/Bismark/Bismark-0.17.0/bismark /usr/local/bin/bismark && \
ln -s /opt/Bismark/Bismark-0.17.0/bismark2bedGraph /usr/local/bin/bismark2bedGraph && \
ln -s /opt/Bismark/Bismark-0.17.0/bismark2report /usr/local/bin/bismark2report && \
ln -s /opt/Bismark/Bismark-0.17.0/bismark2summary /usr/local/bin/bismark2summary && \
ln -s /opt/Bismark/Bismark-0.17.0/bismark_genome_preparation /usr/local/bin/bismark_genome_preparation && \
ln -s /opt/Bismark/Bismark-0.17.0/bismark_methylation_extractor /usr/local/bin/bismark_methylation_extractor && \
ln -s /opt/Bismark/Bismark-0.17.0/coverage2cytosine /usr/local/bin/coverage2cytosine && \
ln -s /opt/Bismark/Bismark-0.17.0/deduplicate_bismark /usr/local/bin/deduplicate_bismark && \
ln -s /opt/Bismark/Bismark-0.17.0/filter_non_conversion /usr/local/bin/filter_non_conversion && \
echo "export PATH=/opt/Bismark/Bismark-0.17.0:$PATH" >> ~/.bashrc && \
rm /opt/Bismark/bismark.zip

# Install Qualimap
Expand Down
2 changes: 1 addition & 1 deletion assets/summary_email.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<img src="data:image/png;base64,<% out << new File("${projectDir}/assets/NGI-MethylSeq_logo.png").bytes.encodeBase64().toString() %>">

<h1>NGI-MethylSeq: RNA-Seq Best Practice v${version}</h1>
<h1>NGI-MethylSeq: Bisulfite-Seq Best Practice v${version}</h1>
<h2>Run Name: $runName</h2>

<% if (success){
Expand Down
7 changes: 5 additions & 2 deletions bismark.nf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ params.reads = "data/*_R{1,2}.fastq.gz"
params.outdir = './results'
params.notrim = false
params.nodedup = false
params.unmapped = false
params.non_directional = false
params.relaxMismatches = false
params.numMismatches = 0.6
// 0.6 will allow a penalty of bp * -0.6
Expand Down Expand Up @@ -102,6 +104,8 @@ summary['Output dir'] = params.outdir
summary['Script dir'] = workflow.projectDir
// log.info "---------------------------------------------------"
summary['Deduplication'] = params.nodedup ? 'No' : 'Yes'
summary['Save Unmapped'] = params.unmapped ? 'No' : 'Yes'
summary['Directional Mode'] = params.non_directional ? 'Yes' : 'No'
if(params.rrbs) summary['RRBS Mode'] = 'On'
if(params.relaxMismatches) summary['Mismatch Func'] = 'L,0,-${params.numMismatches} (Bismark default = L,0,-0.2)'
// log.info "---------------------------------------------------"
Expand Down Expand Up @@ -366,7 +370,7 @@ process qualimap {
file bam from bam_dedup_qualimap

output:
file '${bam.baseName}_qualimap' into qualimap_results
file "${bam.baseName}_qualimap" into qualimap_results

script:
gcref = params.genome == 'GRCh37' ? '-gd HUMAN' : ''
Expand All @@ -392,7 +396,6 @@ process multiqc {

input:
file (fastqc:'fastqc/*') from fastqc_results.collect()
file ('fastqc/*') from fastqc_results.collect()
file ('trimgalore/*') from trimgalore_results.collect()
file ('bismark/*') from bismark_align_log_3.collect()
file ('bismark/*') from bismark_dedup_log_3.collect()
Expand Down
40 changes: 40 additions & 0 deletions tests/docker_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

script_path="../bismark.nf"
if [ -z $1]
then
echo "No argument given, going to try to run ../bismark.nf"
else
script_path=$1
fi

data_path="/tmp"
if [ -d "./test_data" ]
then
data_path="./test_data"
echo "Found data directory in current working directory, using ./test_data/"
fi

curl --version >/dev/null 2>&1 || { echo >&2 "I require curl, but it's not installed. Aborting."; exit 1; }
tar --version >/dev/null 2>&1 || { echo >&2 "I require tar, but it's not installed. Aborting."; exit 1; }
docker -v >/dev/null 2>&1 || { echo >&2 "I require docker, but it's not installed. Visit https://www.docker.com/products/overview#/install_the_platform ."; exit 1; }
nextflow -v >/dev/null 2>&1 || { echo >&2 "I require nextflow, but it's not installed. If you hava Java, run 'curl -fsSL get.nextflow.io | bash'. If not, install Java."; exit 1; }

data_dir=${data_path}/ngi-bisulfite_test_set
if [ -d $data_dir ]
then
echo "Found existing test set, using $data_dir"
else
echo "Downloading test set..."
curl https://export.uppmax.uu.se/b2013064/test-data/ngi-bisulfite_test_set.tar.bz2 > ${data_path}/ngi-bisulfite_test_set.tar.bz2
echo "Unpacking test set..."
tar xvjf ${data_path}/ngi-bisulfite_test_set.tar.bz2 -C ${data_path}
echo "Done"
fi

cmd="nextflow run $script_path -resume -profile testing --bismark_index ${data_dir}/references/BismarkIndex/ --reads \"${data_dir}/*.fastq.gz\""
echo "Starting nextflow... Command:"
echo $cmd
echo "-----"
eval $cmd

40 changes: 40 additions & 0 deletions tests/docker_test_bwameth.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

script_path="../bwa-meth.nf"
if [ -z $1]
then
echo "No argument given, going to try to run ../bwa-meth.nf"
else
script_path=$1
fi

data_path="/tmp"
if [ -d "./test_data" ]
then
data_path="./test_data"
echo "Found data directory in current working directory, using ./test_data/"
fi

curl --version >/dev/null 2>&1 || { echo >&2 "I require curl, but it's not installed. Aborting."; exit 1; }
tar --version >/dev/null 2>&1 || { echo >&2 "I require tar, but it's not installed. Aborting."; exit 1; }
docker -v >/dev/null 2>&1 || { echo >&2 "I require docker, but it's not installed. Visit https://www.docker.com/products/overview#/install_the_platform ."; exit 1; }
nextflow -v >/dev/null 2>&1 || { echo >&2 "I require nextflow, but it's not installed. If you hava Java, run 'curl -fsSL get.nextflow.io | bash'. If not, install Java."; exit 1; }

data_dir=${data_path}/ngi-bisulfite_test_set
if [ -d $data_dir ]
then
echo "Found existing test set, using $data_dir"
else
echo "Downloading test set..."
curl https://export.uppmax.uu.se/b2013064/test-data/ngi-bisulfite_test_set.tar.bz2 > ${data_path}/ngi-bisulfite_test_set.tar.bz2
echo "Unpacking test set..."
tar xvjf ${data_path}/ngi-bisulfite_test_set.tar.bz2 -C ${data_path}
echo "Done"
fi

cmd="nextflow run $script_path -resume --fasta ${data_dir}/references/WholeGenomeFasta/genome.fa --fasta_index ${data_dir}/references/WholeGenomeFasta/genome.fa.fai --reads \"${data_dir}/*.fastq.gz\""
echo "Starting nextflow... Command:"
echo $cmd
echo "-----"
eval $cmd

0 comments on commit 7bab7d0

Please sign in to comment.