Revision 106
Added by Aaron Marcuse-Kubitza about 13 years ago
map | ||
---|---|---|
1 | 1 |
#!/bin/bash |
2 |
# Tests map |
|
3 |
# Usage: env [debug=1] [n=<num-rows>] self
|
|
2 |
# Tests map on all input/*.csv
|
|
3 |
# Usage: env [n=<num-rows>] self |
|
4 | 4 |
|
5 | 5 |
selfDir="$(dirname -- "$0")" |
6 | 6 |
cd "$selfDir" |
7 | 7 |
|
8 | 8 |
test -n "$n" || n=2 |
9 |
let n++ |
|
9 |
let n++ # include header row
|
|
10 | 10 |
|
11 |
in=NYBG.csv |
|
12 |
out=NYBG.xml |
|
11 |
# Update generated mappings |
|
12 |
../../mappings/extract_plot_map |
|
13 |
../../mappings/join_all_vegbank |
|
13 | 14 |
|
14 |
head -"$n" "input/$in"|../map ../../mappings/NYBG-VegX.organisms.csv \ |
|
15 |
>"output/$out" && diff "accepted_output/$out" "output/$out" |
|
16 |
|
|
17 |
test -z "$debug" && toVegbank=map2vegbank || toVegbank=map |
|
18 |
head -"$n" "input/$in"|"../$toVegbank" \ |
|
19 |
../../mappings/joins/NYBG-VegBank.organisms.csv |
|
15 |
for in in input/*.csv; do |
|
16 |
stem="$(basename -- "${in%.csv}")" # remove extension and dir |
|
17 |
src="${stem%.*}" # before last "." |
|
18 |
type="${stem##*.}" # after last "." |
|
19 |
|
|
20 |
# Test exporting to XML |
|
21 |
for fmt in VegX VegBank; do |
|
22 |
out="$stem.$fmt.xml" |
|
23 |
head -"$n" "$in"|../map "../../mappings/$src-$fmt.$type.csv" \ |
|
24 |
>"output/$out" && diff "accepted_output/$out" "output/$out" |
|
25 |
done |
|
26 |
|
|
27 |
# Test exporting to VegBank db |
|
28 |
head -"$n" "$in"|../map2vegbank "../../mappings/$src-VegBank.$type.csv" |
|
29 |
done |
Also available in: Unified diff
test/map: Expanded to include all input CSVs in test/input