Mercurial > repos > ethevenot > multivariate
annotate test/test-multi @ 4:5526f8258e8a draft default tip
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
author | ethevenot |
---|---|
date | Wed, 28 Feb 2018 09:59:25 -0500 |
parents | |
children |
rev | line source |
---|---|
4
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
1 #!/bin/bash |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
2 |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
3 # Constants {{{1 |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
4 ################################################################ |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
5 |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
6 PROG_PATH=$(dirname $0) |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
7 |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
8 # MAIN {{{1 |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
9 ################################################################ |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
10 |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
11 $PROG_PATH/../multivariate_wrapper.R dataMatrix_in $PROG_PATH/../test-data/input-dataMatrix.tsv sampleMetadata_in $PROG_PATH/../test-data/input-sampleMetadata.tsv variableMetadata_in $PROG_PATH/../test-data/input-variableMetadata.tsv respC age predI 1 orthoI 1 testL FALSE sampleMetadata_out $PROG_PATH/outputSampleMetadata.tsv variableMetadata_out $PROG_PATH/outputVariableMetadata.tsv |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
12 |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
13 # Computed numbers are not always the same. We cannot use diff directly on files. |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
14 |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
15 # 0) Check they have the same number of lines |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
16 nlines=$(wc -l <"$PROG_PATH/outputSampleMetadata.tsv") |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
17 ref_nlines=$(wc -l <"$PROG_PATH/../test-data/output-sampleMetadata.tsv") |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
18 if [ $nlines != $ref_nlines ] ; then |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
19 echo "Incorrect output sample metadata." >&2 |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
20 exit 1 |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
21 fi |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
22 |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
23 # 1) We check the header line |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
24 head -n 1 "$PROG_PATH/outputSampleMetadata.tsv" > "$PROG_PATH/header.tsv" |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
25 head -n 1 "$PROG_PATH/../test-data/output-sampleMetadata.tsv" > "$PROG_PATH/ref_header.tsv" |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
26 if ! diff "$PROG_PATH/header.tsv" "$PROG_PATH/ref_header.tsv" ; then |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
27 echo "Incorrect output sample metadata." >&2 |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
28 exit 1 |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
29 fi |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
30 |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
31 # 2) We remove computed values and compare what's left |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
32 awk 'BEGIN{FS=OFS="\t"} {$7=$8=$9="";sub("\t\t","\t")}1' "$PROG_PATH/outputSampleMetadata.tsv" > "$PROG_PATH/nocomput.tsv" |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
33 awk 'BEGIN{FS=OFS="\t"} {$7=$8=$9="";sub("\t\t","\t")}1' "$PROG_PATH/../test-data/output-sampleMetadata.tsv" > "$PROG_PATH/ref_nocomput.tsv" |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
34 if ! diff "$PROG_PATH/nocomput.tsv" "$PROG_PATH/ref_nocomput.tsv" ; then |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
35 echo "Incorrect output sample metadata." >&2 |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
36 exit 1 |
5526f8258e8a
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents:
diff
changeset
|
37 fi |