Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/py scripts #3

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 29 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,31 @@ MAINTAINER PhenoMeNal-H2020 Project ([email protected])

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"
LABEL license="https://github.com/phnmnl/container-tamenmr/blob/master/License.txt"
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 && \
Expand All @@ -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

2 changes: 1 addition & 1 deletion galaxy/ident.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<container type="docker">container-registry.phenomenal-h2020.eu/phnmnl/tamenmr</container>
</requirements>
<description> metabolites in the data </description>
<command interpreter="python">
<command>
importTest.py $input $output
</command>

Expand Down
2 changes: 1 addition & 1 deletion galaxy/import_to_csv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<container type="docker">container-registry.phenomenal-h2020.eu/phnmnl/tamenmr</container>
</requirements>
<description> Bruker NMR data </description>
<command interpreter="python">
<command>
#if str($input_type.source) == "data":
import2csv.py $input_type.input $output data
#else:
Expand Down
2 changes: 1 addition & 1 deletion galaxy/import_to_nmrML.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<container type="docker">container-registry.phenomenal-h2020.eu/phnmnl/tamenmr</container>
</requirements>
<description> NMR data to nmrML</description>
<command interpreter="python">
<command>
import2nmrML.py $input $output $proc
</command>

Expand Down
2 changes: 1 addition & 1 deletion galaxy/quant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<container type="docker">container-registry.phenomenal-h2020.eu/phnmnl/tamenmr</container>
</requirements>
<description> the metabolites </description>
<command interpreter="python">
<command>
importTest.py $input $output
</command>

Expand Down
13 changes: 13 additions & 0 deletions runTest/runTest1.sh
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions runTest/runTest10.sh
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions runTest/runTest11.sh
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions runTest/runTest12.sh
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions runTest/runTest2.sh
Original file line number Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions runTest/runTest3.sh
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions runTest/runTest4.sh
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions runTest/runTest5.sh
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions runTest/runTest6.sh
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions runTest/runTest7.sh
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions runTest/runTest8.sh
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions runTest/runTest9.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 0 additions & 4 deletions runTest1.sh

This file was deleted.