This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
140 lines (132 loc) · 6.39 KB
/
short-read-mngs-viral-benchmarks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: short-read-mngs viral benchmarks
on:
push
env:
LC_ALL: C.UTF-8
LANG: C.UTF-8
DEBIAN_FRONTEND: noninteractive
jobs:
cancel-previous:
runs-on: ubuntu-20.04
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
has-diff:
runs-on: ubuntu-20.04
outputs:
has_diff: ${{steps.check_for_diff.outputs.has_diff}}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- id: check_for_diff
# only run on wdl dirs with diff
run: echo "::set-output name=has_diff::$(if [ -n `git diff --name-status HEAD^|cut -c 3-|xargs dirname|sort|uniq|grep short-read-mngs` ]; then echo true; else echo false; fi)"
run-samples:
runs-on: ubuntu-20.04
needs: has-diff
if: ${{needs['has-diff'].outputs.has_diff == 'true'}}
strategy:
matrix:
sample: [idseq_bench_3, idseq_bench_5]
settings: [default]
steps:
- uses: actions/checkout@v2
- name: docker build
run: |
IMAGE_NAME=idseq-short-read-mngs-public
IMAGE_URI="ghcr.io/${GITHUB_REPOSITORY}/${IMAGE_NAME}"
CACHE_FROM=""; docker pull "$IMAGE_URI" && CACHE_FROM="--cache-from $IMAGE_URI"
docker build short-read-mngs --tag idseq-short-read-mngs $CACHE_FROM \
|| docker build short-read-mngs --tag idseq-short-read-mngs
- name: run sample
run: |
pip install -r requirements-dev.txt
export PATH=$PATH:$HOME/.local/bin
export MINIWDL__DOWNLOAD_CACHE__GET=true
export MINIWDL__DOWNLOAD_CACHE__PUT=true
export MINIWDL__DOWNLOAD_CACHE__DIR="$(mktemp -d --tmpdir miniwdl_download_cache_XXXXXX)"
# configure miniwdl to auto-delete task working directories, to reduce chance of worker
# running out of space
export MINIWDL__FILE_IO__OUTPUT_HARDLINKS=true
export MINIWDL__FILE_IO__DELETE_WORK=success
# explicitly block EC2 IMDS endpoint to work around awscli issue:
# https://github.com/aws/aws-cli/issues/5234#issuecomment-635459464
# https://github.com/aws/aws-cli/issues/5262
sudo ip route add blackhole 169.254.169.254
short-read-mngs/auto_benchmark/run_local.py --dir testrun/ --docker-image-id idseq-short-read-mngs \
--settings ${{ matrix.settings }} ${{ matrix.sample }}
- name: harvest output statistics
run: |
export PATH=$PATH:$HOME/.local/bin
taxadb download -o taxadb --type taxa
taxadb create -i taxadb --dbname taxadb.sqlite || true # exits nonzero w/o accessions
short-read-mngs/auto_benchmark/harvest.py ${{ matrix.sample }}=testrun/${{ matrix.sample }} \
--taxadb taxadb.sqlite > ${{ matrix.sample }}.${{ matrix.settings }}_viral.json
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.sample }}.${{ matrix.settings }}_viral.json
path: ${{ matrix.sample }}.${{ matrix.settings }}_viral.json
notebook:
runs-on: ubuntu-20.04
needs: run-samples
strategy:
matrix:
settings: [default]
steps:
- uses: actions/checkout@v2
- name: fetch idseq_bench_3
uses: actions/download-artifact@v2
with:
name: idseq_bench_3.${{ matrix.settings }}_viral.json
- name: fetch idseq_bench_5
uses: actions/download-artifact@v2
with:
name: idseq_bench_5.${{ matrix.settings }}_viral.json
- name: run notebook
run: |
TAG=$(git describe --long --tags --always --dirty)
cp *_viral.json short-read-mngs/auto_benchmark # notebook wd
chmod -R 777 short-read-mngs/auto_benchmark
# execute notebook
docker run -v $(pwd):/home/jovyan/work --workdir /home/jovyan/work \
--env "RUN_NAME=${{ matrix.settings }}_viral_$TAG" \
--env HARVEST_DATA=$(ls -1 *_viral.json | tr '\n' ':') \
--env REF_LIB=/home/jovyan/work/short-read-mngs/auto_benchmark/ref_libs/${{ matrix.settings }}_viral \
--env CHOWN_HOME=yes \
jupyter/scipy-notebook:latest jupyter nbconvert --to notebook --execute --inplace \
short-read-mngs/auto_benchmark/short-read-mngs-benchmarks.ipynb
cp short-read-mngs/auto_benchmark/short-read-mngs-benchmarks.ipynb short-read-mngs-benchmarks.${{ matrix.settings }}_viral.ipynb
# make HTML with code
docker run -v $(pwd):/home/jovyan/work --workdir /home/jovyan/work \
jupyter/scipy-notebook:latest jupyter nbconvert --to html \
short-read-mngs/auto_benchmark/short-read-mngs-benchmarks.ipynb
mv short-read-mngs/auto_benchmark/short-read-mngs-benchmarks.html short-read-mngs-benchmarks.${{ matrix.settings }}_viral.with_code.html
# make HTML without code
docker run -v $(pwd):/home/jovyan/work --workdir /home/jovyan/work \
jupyter/scipy-notebook:latest jupyter nbconvert --to html --no-input \
short-read-mngs/auto_benchmark/short-read-mngs-benchmarks.ipynb
mv short-read-mngs/auto_benchmark/short-read-mngs-benchmarks.html short-read-mngs-benchmarks.${{ matrix.settings }}_viral.html
mkdir ref_libs
cp -r short-read-mngs/auto_benchmark/ref_libs/${{ matrix.settings }}_viral ref_libs/
- name: test harvest2.py
run: short-read-mngs/auto_benchmark/harvest2.py *_viral.json --version "$(git describe --long --tags --always --dirty)" --wall 999
- uses: actions/upload-artifact@v2
with:
name: short-read-mngs-benchmarks.${{ matrix.settings }}_viral.html
path: short-read-mngs-benchmarks.${{ matrix.settings }}_viral.html
- uses: actions/upload-artifact@v2
with:
name: short-read-mngs-benchmarks.${{ matrix.settings }}_viral.ipynb
path: |
short-read-mngs-benchmarks.${{ matrix.settings }}_viral.*
*.${{ matrix.settings }}_viral.json
ref_libs/
- name: annotate deviations
run: |
if [[ -f short-read-mngs/auto_benchmark/.short-read-mngs-benchmarks-deviation ]]; then
echo "::warning ::auto_benchmark detected >1% deviation from reference values; review the notebook and update reference library if needed."
else
echo "auto_benchmark OK (all metrics within 1% of reference values)"
fi