comparison 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
comparison
equal deleted inserted replaced
3:e91de3b04320 4:5526f8258e8a
1 #!/bin/bash
2
3 # Constants {{{1
4 ################################################################
5
6 PROG_PATH=$(dirname $0)
7
8 # MAIN {{{1
9 ################################################################
10
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
12
13 # Computed numbers are not always the same. We cannot use diff directly on files.
14
15 # 0) Check they have the same number of lines
16 nlines=$(wc -l <"$PROG_PATH/outputSampleMetadata.tsv")
17 ref_nlines=$(wc -l <"$PROG_PATH/../test-data/output-sampleMetadata.tsv")
18 if [ $nlines != $ref_nlines ] ; then
19 echo "Incorrect output sample metadata." >&2
20 exit 1
21 fi
22
23 # 1) We check the header line
24 head -n 1 "$PROG_PATH/outputSampleMetadata.tsv" > "$PROG_PATH/header.tsv"
25 head -n 1 "$PROG_PATH/../test-data/output-sampleMetadata.tsv" > "$PROG_PATH/ref_header.tsv"
26 if ! diff "$PROG_PATH/header.tsv" "$PROG_PATH/ref_header.tsv" ; then
27 echo "Incorrect output sample metadata." >&2
28 exit 1
29 fi
30
31 # 2) We remove computed values and compare what's left
32 awk 'BEGIN{FS=OFS="\t"} {$7=$8=$9="";sub("\t\t","\t")}1' "$PROG_PATH/outputSampleMetadata.tsv" > "$PROG_PATH/nocomput.tsv"
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"
34 if ! diff "$PROG_PATH/nocomput.tsv" "$PROG_PATH/ref_nocomput.tsv" ; then
35 echo "Incorrect output sample metadata." >&2
36 exit 1
37 fi