diff --git a/Dockerfile b/Dockerfile index 47ee101..79a98f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ MAINTAINER PhenoMeNal-H2020 Project (phenomenal-h2020-users@googlegroups.com) LABEL software="tamenmr" LABEL software.version="1.0" -LABEL version="0.5" +LABEL version="0.6" LABEL Description="tameNMR: Tools for Analysis of MEtabolomic NMR" LABEL website="https://github.com/PGB-LIV/tameNMR" LABEL documentation="https://github.com/PGB-LIV/tameNMR" @@ -12,14 +12,23 @@ LABEL license="https://github.com/phnmnl/container-tamenmr/blob/master/License.t LABEL tags="Metabolomics" # Install packages for compilation -RUN apt-get -y update && apt-get -y --no-install-recommends install ca-certificates wget zip unzip git libcurl4-gnutls-dev libcairo2-dev libxt-dev libxml2-dev libv8-dev libnlopt-dev libnlopt0 gdebi-core pandoc pandoc-citeproc software-properties-common make gcc gfortran g++ r-recommended r-cran-rcurl r-cran-foreach r-cran-multicore r-cran-base64enc r-cran-qtl r-cran-xml libgsl2 libgsl0-dev gsl-bin libssl-dev python python-dev python-setuptools build-essential python-pip && \ - pip install numpy scipy pandas matplotlib nmrglue && \ - R -e "install.packages(c('ggplot2','ellipse','markdown','viridis'), repos='https://mirrors.ebi.ac.uk/CRAN/')" +RUN apt-get -y update && apt-get -y --no-install-recommends install ca-certificates wget zip unzip git libcurl4-gnutls-dev libcairo2-dev libxt-dev libxml2-dev libv8-dev libnlopt-dev libnlopt0 gdebi-core pandoc pandoc-citeproc software-properties-common make gcc gfortran g++ r-recommended r-cran-rcurl r-cran-foreach r-cran-multicore r-cran-base64enc r-cran-qtl r-cran-xml libgsl2 libgsl0-dev gsl-bin libssl-dev python python-dev python-setuptools build-essential python-pip +RUN python -m pip install --upgrade pip==9.0.3 +RUN pip install numpy scipy pandas matplotlib nose coverage nose-cov python-coveralls spyder zip lxml xmltodict generateDS +RUN R -e "install.packages(c('rlang', 'ggplot2','ellipse','markdown','viridis','ggrepel','pls','knitr','rSFA'))" + +WORKDIR /usr/src +RUN git clone https://github.com/jjhelmus/nmrglue +WORKDIR /usr/src/nmrglue +RUN python setup.py install # Install tameNMR WORKDIR /usr/src -RUN git clone https://github.com/PGB-LIV/tameNMR -RUN for i in $(find tameNMR/tameNMR -name *.R); do install -m755 $i /usr/local/bin; done +RUN git clone https://github.com/PGB-LIV/tameNMR && \ + for i in $(find tameNMR/tameNMR -name *.R -or -name *py); do install -m755 $i /usr/local/bin; done && \ + for i in $(find /usr/local/bin -name *py); do sed -i '1i#!/usr/bin/env python' $i; done && \ + sed -i '1d' /usr/local/bin/prepPattern.R && \ + sed -i '1i#!/usr/bin/env Rscript' /usr/local/bin/prepPattern.R # Cleanup RUN apt-get -y --purge --auto-remove remove make gcc gfortran g++ && apt-get -y --purge remove libcurl4-gnutls-dev libcairo2-dev libxt-dev libxml2-dev libv8-dev libnlopt-dev && \ @@ -30,5 +39,18 @@ RUN apt-get -y --purge --auto-remove remove make gcc gfortran g++ && apt-get -y #RUN chmod +x /usr/local/bin/* # Add testing to container -#ADD runTest1.sh /usr/local/bin/runTest1.sh +ADD runTest/runTest1.sh /usr/local/bin/runTest1.sh +ADD runTest/runTest2.sh /usr/local/bin/runTest2.sh +ADD runTest/runTest3.sh /usr/local/bin/runTest3.sh +ADD runTest/runTest4.sh /usr/local/bin/runTest4.sh +ADD runTest/runTest5.sh /usr/local/bin/runTest5.sh +ADD runTest/runTest6.sh /usr/local/bin/runTest6.sh +ADD runTest/runTest7.sh /usr/local/bin/runTest7.sh +ADD runTest/runTest8.sh /usr/local/bin/runTest8.sh +ADD runTest/runTest9.sh /usr/local/bin/runTest9.sh +ADD runTest/runTest10.sh /usr/local/bin/runTest10.sh +ADD runTest/runTest11.sh /usr/local/bin/runTest11.sh +ADD runTest/runTest12.sh /usr/local/bin/runTest12.sh + +RUN chmod +x /usr/local/bin/runTest*.sh diff --git a/galaxy/ident.xml b/galaxy/ident.xml index ecfce35..b6ecc0b 100644 --- a/galaxy/ident.xml +++ b/galaxy/ident.xml @@ -3,7 +3,7 @@ container-registry.phenomenal-h2020.eu/phnmnl/tamenmr metabolites in the data - + importTest.py $input $output diff --git a/galaxy/import_to_csv.xml b/galaxy/import_to_csv.xml index 5843e1d..80ec5ed 100644 --- a/galaxy/import_to_csv.xml +++ b/galaxy/import_to_csv.xml @@ -3,7 +3,7 @@ container-registry.phenomenal-h2020.eu/phnmnl/tamenmr Bruker NMR data - + #if str($input_type.source) == "data": import2csv.py $input_type.input $output data #else: diff --git a/galaxy/import_to_nmrML.xml b/galaxy/import_to_nmrML.xml index 405812e..7ae47b4 100644 --- a/galaxy/import_to_nmrML.xml +++ b/galaxy/import_to_nmrML.xml @@ -3,7 +3,7 @@ container-registry.phenomenal-h2020.eu/phnmnl/tamenmr NMR data to nmrML - + import2nmrML.py $input $output $proc diff --git a/galaxy/quant.xml b/galaxy/quant.xml index 059143c..5d44778 100644 --- a/galaxy/quant.xml +++ b/galaxy/quant.xml @@ -3,7 +3,7 @@ container-registry.phenomenal-h2020.eu/phnmnl/tamenmr the metabolites - + importTest.py $input $output diff --git a/runTest/runTest1.sh b/runTest/runTest1.sh new file mode 100755 index 0000000..8c2c0b9 --- /dev/null +++ b/runTest/runTest1.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +echo "Testing Align.R" +Align.R --inData=/usr/src/tameNMR/test/test_data/out_slice.csv --inPeaks=/usr/src/tameNMR/test/test_data/out_peaks.csv --output=/tmp/out_aligned.csv --retainPpm=10-0 --remWater=Y + +if [ $(md5sum /tmp/out_aligned.csv | cut -d" " -f1) != $(md5sum /usr/src/tameNMR/test/outputs/out_aligned.csv | cut -d" " -f1) ]; then + echo "check sums do not match" + md5sum /tmp/out_aligned.csv + md5sum /usr/src/tameNMR/test/outputs/out_aligned.csv + exit 1 +fi + +exit 0 diff --git a/runTest/runTest10.sh b/runTest/runTest10.sh new file mode 100755 index 0000000..9a36560 --- /dev/null +++ b/runTest/runTest10.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo "Testing QuantilePlot.R" +QuantilePlot.R --input=/usr/src/tameNMR/test/test_data/out_norm_PQN.csv --outDir=/tmp --output=/tmp/out_quantiles.html --ppmInt=4-3 --pltMean=Y + +files=(out_quantiles.html QuantilePlot.png) +for i in ${files[*]}; do + + if [ $(wc -l /tmp/$i | cut -d" " -f1) != $(wc -l /usr/src/tameNMR/test/outputs/$i | cut -d" " -f1) ]; then + echo "lines number do not match" + wc -l /tmp/$i + wc -l /usr/src/tameNMR/test/outputs/$i + exit 1 + fi +done + +exit 0 diff --git a/runTest/runTest11.sh b/runTest/runTest11.sh new file mode 100755 index 0000000..d9a92b0 --- /dev/null +++ b/runTest/runTest11.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo "Testing SliceSpectra.R" +SliceSpectra.R --input=/usr/src/tameNMR/test/test_data/Out_Import2csv.csv --output=/tmp/out_slice.csv --retainPpm=10-0 --remWater=Y + +files=(out_slice.csv) +for i in ${files[*]}; do + + if [ $(md5sum /tmp/$i | cut -d" " -f1) != $(md5sum /usr/src/tameNMR/test/outputs/$i | cut -d" " -f1) ]; then + echo "check sums do not match" + md5sum /tmp/$i + md5sum /usr/src/tameNMR/test/outputs/$i + exit 1 + fi +done + +exit 0 diff --git a/runTest/runTest12.sh b/runTest/runTest12.sh new file mode 100755 index 0000000..86c5f92 --- /dev/null +++ b/runTest/runTest12.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo "Testing Ttest.R" +Ttest.R --input=/usr/src/tameNMR/test/test_data/data.csv --output=/tmp/ttest_out_ --outdir=/tmp --factorFile=/usr/src/tameNMR/test/test_data/fact.csv --factorCol=1 --tails=two.sided --paired=N --conf_level=0.05 + +files=(ttest_out_ meanBars.png p_Vals.png results.Rmd results.txt) +for i in ${files[*]}; do + + if [ $(md5sum /tmp/$i | cut -d" " -f1) != $(wc -l /usr/src/tameNMR/test/outputs/$i | cut -d" " -f1) ]; then + echo "check sums do not match" + md5sum /tmp/$i + md5sum /usr/src/tameNMR/test/outputs/$i + exit 1 + fi +done + +exit 0 diff --git a/runTest/runTest2.sh b/runTest/runTest2.sh new file mode 100755 index 0000000..2aba91e --- /dev/null +++ b/runTest/runTest2.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +echo "Testing Anova.R" +mkdir /tmp/anova_out +Anova.R --input=/usr/src/tameNMR/test/test_data/data.csv --output=/tmp/anova_out/anova_out --outdir=/tmp/anova_out --factorFile=/usr/src/tameNMR/test/test_data/fact.csv --factorCol=2 --conf_level=0.05 --adjust=BH + +for i in $(ls /usr/src/tameNMR/test/outputs/anova_out/); do + if [ $(md5sum /tmp/anova_out/$i | cut -d" " -f1) != $(md5sum /usr/src/tameNMR/test/outputs/$i | cut -d" " -f1) ]; then + echo "check sums do not match" + md5sum /tmp/anova_out/$i + md5sum /usr/src/tameNMR/test/outputs/$i + exit 1 + fi +done + +if [ $(md5sum /tmp/anova_out/anova_out.html | cut -d" " -f1) != $(md5sum /usr/src/tameNMR/test/outputs/anova_out.html | cut -d" " -f1) ]; then + echo "check sums do not match" + md5sum /tmp/anova_out/anova_out.html + md5sum /usr/src/tameNMR/test/outputs/anova_out.html + exit 1 +fi + +exit 0 diff --git a/runTest/runTest3.sh b/runTest/runTest3.sh new file mode 100755 index 0000000..bc3c5fa --- /dev/null +++ b/runTest/runTest3.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +echo "Testing BinSpectra.R" +echo "testing uniform binning" +BinSpectra.R --input=/usr/src/tameNMR/test/test_data/out_norm_PQN.csv --output=/tmp/out_binned_uniform.csv --pattern=/usr/src/tameNMR/test/output/bins_uniform.csv + +echo "testing binning with bruker bin table" +BinSpectra.R --input=/usr/src/tameNMR/test/test_data/out_norm_PQN.csv --output=/tmp/out_binned_bruker.csv --pattern=/usr/src/tameNMR/test/output/bins_bruker.csv + +echo "testing binning with custom bin table" +BinSpectra.R --input=/usr/src/tameNMR/test/test_data/out_norm_PQN.csv --output=/tmp/out_binned_fromCsv.csv --pattern=/usr/src/tameNMR/test/output/bins_fromCsv.csv + +echo "testing intelligent binning" +BinSpectra.R --input=/usr/src/tameNMR/test/test_data/out_norm_PQN.csv --output=/tmp/out_binned_intelligent.csv --pattern=/usr/src/tameNMR/test/output/bins_intelligent.csv + +files=(out_binned_uniform.csv out_binned_bruker.csv out_binned_fromCsv.csv out_binned_intelligent.csv) +for i in ${files[*]}; do + + if [ $(md5sum /tmp/$i | cut -d" " -f1) != $(wc -l /usr/src/tameNMR/test/outputs/$i | cut -d" " -f1) ]; then + echo "check sums do not match" + md5sum /tmp/$i + md5sum /usr/src/tameNMR/test/outputs/$i + exit 1 + fi +done + +exit 0 diff --git a/runTest/runTest4.sh b/runTest/runTest4.sh new file mode 100755 index 0000000..5e28a3a --- /dev/null +++ b/runTest/runTest4.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +echo "Testing import2csv.py" + +import2csv.py /usr/src/tameNMR/test/test_data/CPMG_exp.zip /tmp/import2csvOut.csv data + +if [ $(wc -l /tmp/import2csvOut.csv | cut -d" " -f1) != $(wc -l /usr/src/tameNMR/test/outputs/import2csvOut.csv | cut -d" " -f1) ]; then + echo "line numbers do not match" + wc -l /tmp/import2csvOut.csv + wc -l /usr/src/tameNMR/test/outputs/import2csvOut.csv + exit 1 +fi + +exit 0 diff --git a/runTest/runTest5.sh b/runTest/runTest5.sh new file mode 100755 index 0000000..b1d2d52 --- /dev/null +++ b/runTest/runTest5.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +echo "Testing Normalise.R" +Normalise.R --input=/usr/src/tameNMR/test/test_data/out_aligned.csv --output=/tmp/out_norm_PQN.csv --type=PQN + +Normalise.R --input=/usr/src/tameNMR/test/test_data/out_aligned.csv --output=/tmp/out_norm_totArea.csv --type=totInt + +Normalise.R --input=/usr/src/tameNMR/test/test_data/out_aligned.csv --output=/tmp/out_norm_refPeak.csv --type=refPeak --param=0.32-0.33 + +files=(out_norm_PQN.csv out_norm_totArea.csv out_norm_refPeak.csv) +for i in ${files[*]}; do + if [ $(md5sum /tmp/$i | cut -d" " -f1) != $(md5sum /usr/src/tameNMR/test/outputs/$i | cut -d" " -f1) ]; then + echo "check sums do not match" + md5sum /tmp/$i + md5sum /usr/src/tameNMR/test/outputs/$i + exit 1 + fi +done + +exit 0 diff --git a/runTest/runTest6.sh b/runTest/runTest6.sh new file mode 100755 index 0000000..c1c4131 --- /dev/null +++ b/runTest/runTest6.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +echo "Testing PCA.R" +mkdir /tmp/pca_out +PCA.R --input=/usr/src/tameNMR/test/test_data/data.csv --output=/tmp/pca_out/pca_out --outdir=/tmp/pca_out --factorFile=/usr/src/tameNMR/test/test_data/fact.csv --factorCol=2 --pcs="1-2,2-3,1-3" --scale=Y --showScores=Y --showLoadings=Y --showVarAcc=Y + +files=(PC_1-2_loadings.png PC_1-2_scores.png PC_1-3_loadings.png PC_1-3_scores.png PC_2-3_loadings.png PC_2-3_scores.png VarAcc.png results.Rmd) +for i in ${files[*]}; do + + if [ $(md5sum /tmp/pca_out/$i | cut -d" " -f1) != $(wc -l /usr/src/tameNMR/test/outputs/pca_out/$i | cut -d" " -f1) ]; then + echo "check sums do not match" + md5sum /tmp/pca_out/$i + md5sum /usr/src/tameNMR/test/outputs/pca_out/$i + exit 1 + fi +done + +if [ $(md5sum /tmp/pca_out.html | cut -d" " -f1) != $(wc -l /usr/src/tameNMR/test/outputs/pca_out.html | cut -d" " -f1) ]; then + echo "check sums do not match" + md5sum /tmp/pca_out/$i + md5sum /usr/src/tameNMR/test/outputs/pca_out/$i + exit 1 +fi + +exit 0 diff --git a/runTest/runTest7.sh b/runTest/runTest7.sh new file mode 100755 index 0000000..93f3c7c --- /dev/null +++ b/runTest/runTest7.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +echo "Testing PeakPick.R" +PeakPick.R --input=/usr/src/tameNMR/test/test_data/out_slice.csv --output=/tmp/out_peaks.csv + +files=(out_peaks.csv) +for i in ${files[*]}; do + if [ $(wc -l /tmp/$i | cut -d" " -f1) != $(wc -l /usr/src/tameNMR/test/outputs/$i | cut -d" " -f1) ]; then + echo "line numbers do not match" + wc -l /tmp/$i + wc -l /usr/src/tameNMR/test/outputs/$i + exit 1 + fi +done + +exit 0 diff --git a/runTest/runTest8.sh b/runTest/runTest8.sh new file mode 100755 index 0000000..0ba088b --- /dev/null +++ b/runTest/runTest8.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo "Testing PLSDA.R" +PLSDA.R --input=/usr/src/tameNMR/test/test_data/data.csv --output=/tmp/plsda_out --outdir=/tmp --factorFile=/usr/src/tameNMR/test/test_data/fact.csv --factorCol=2 + +files=(Diagnostics.png PLSDA_Scores.png VIP.png results.Rmd plsda_out.html) +for i in ${files[*]}; do + + if [ $(md5sum /tmp/$i | cut -d" " -f1) != $(wc -l /usr/src/tameNMR/test/outputs/$i | cut -d" " -f1) ]; then + echo "check sums do not match" + md5sum /tmp/$i + md5sum /usr/src/tameNMR/test/outputs/$i + exit 1 + fi +done + +exit 0 diff --git a/runTest/runTest9.sh b/runTest/runTest9.sh new file mode 100755 index 0000000..21bd04b --- /dev/null +++ b/runTest/runTest9.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +echo "Testing prepPattern.R" +echo "..making uniform bin table" +prepPattern.R --method=uniform --dataSet=/usr/src/tameNMR/test/test_data/out_norm_PQN.csv --output=/tmp/bins_uniform.csv --binSize=0.05 + +echo "..making intelligent bin table" +prepPattern.R --method=intelligent --dataSet=/usr/src/tameNMR/test/test_data/out_norm_PQN.csv --output=/tmp/bins_intelligent.csv + +files=(bins_uniform.csv bins_intelligent.csv) +for i in ${files[*]}; do + + if [ $(wc -l /tmp/$i | cut -d" " -f1) != $(wc -l /usr/src/tameNMR/test/outputs/$i | cut -d" " -f1) ]; then + echo "line numbers do not match" + wc -l /tmp/$i + wc -l /usr/src/tameNMR/test/outputs/$i + exit 1 + fi +done + +exit 0 diff --git a/runTest1.sh b/runTest1.sh deleted file mode 100755 index 5fa0219..0000000 --- a/runTest1.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -R -e "library(speaq)" -