-
Notifications
You must be signed in to change notification settings - Fork 21
157 lines (130 loc) · 5.06 KB
/
ancestry-vcf.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Run ancestry test with singularity or docker profiles
on:
workflow_call:
inputs:
container-cache-key:
type: string
required: true
ancestry-cache-key:
type: string
required: true
docker:
type: boolean
singularity:
type: boolean
env:
NXF_SINGULARITY_CACHEDIR: ${{ github.workspace }}/singularity
SINGULARITY_VERSION: 3.8.3
jobs:
docker:
if: ${{ inputs.docker }}
runs-on: ubuntu-latest
steps:
- name: Set environment variables
run: |
echo "ANCESTRY_REF_DIR=$RUNNER_TEMP" >> $GITHUB_ENV
echo "ANCESTRY_TARGET_DIR=$RUNNER_TEMP" >> $GITHUB_ENV
- name: Check out pipeline code
uses: actions/checkout@v3
- uses: nf-core/setup-nextflow@v1
- name: Restore docker images
id: restore-docker
uses: actions/cache/restore@v3
with:
path: ${{ runner.temp }}/docker
key: ${{ inputs.container-cache-key }}
fail-on-cache-miss: true
- name: Load docker images from cache
run: |
find $HOME -name '*.tar'
find ${{ runner.temp }}/docker/ -name '*.tar' -exec sh -c 'docker load < {}' \;
- name: Restore reference data
uses: actions/cache/restore@v3
with:
path: |
${{ env.ANCESTRY_TARGET_DIR }}/GRCh38_HAPNEST_TARGET_ALL.pgen
${{ env.ANCESTRY_TARGET_DIR }}/GRCh38_HAPNEST_TARGET_ALL.psam
${{ env.ANCESTRY_TARGET_DIR }}/GRCh38_HAPNEST_TARGET_ALL.pvar.zst
${{ env.ANCESTRY_REF_DIR }}/GRCh38_HAPNEST_reference.tar.zst
key: ${{ inputs.ancestry-cache-key }}
fail-on-cache-miss: true
- name: Install plink2 to recode
run: sudo apt-get install -y plink2
- name: run plink2
run: |
plink2 --pfile ${ANCESTRY_TARGET_DIR}/GRCh38_HAPNEST_TARGET_ALL vzs \
--export vcf bgz \
--out ${ANCESTRY_TARGET_DIR}/GRCh38_HAPNEST_TARGET_ALL
- name: Set up test requirements
uses: actions/setup-python@v3
with:
python-version: '3.10'
cache: 'pip'
- run: pip install -r ${{ github.workspace }}/tests/requirements.txt
- name: Run ancestry test
run: TMPDIR=~ PROFILE=docker pytest --kwdof --symlink --git-aware --wt 2 --tag "ancestry vcf" --ignore tests/bin
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: logs-singularity-ancestry
path: |
/home/runner/pytest_workflow_*/*/.nextflow.log
/home/runner/pytest_workflow_*/*/log.out
/home/runner/pytest_workflow_*/*/log.err
/home/runner/pytest_workflow_*/*/output/*
singularity:
if: ${{ inputs.singularity }}
runs-on: ubuntu-latest
steps:
- name: Set environment variables
run: |
echo "ANCESTRY_REF_DIR=$RUNNER_TEMP" >> $GITHUB_ENV
echo "ANCESTRY_TARGET_DIR=$RUNNER_TEMP" >> $GITHUB_ENV
- name: Check out pipeline code
uses: actions/checkout@v3
- uses: nf-core/setup-nextflow@v1
- name: Restore singularity setup
id: restore-singularity-setup
uses: actions/cache@v3
with:
path: /opt/hostedtoolcache/singularity/${{ env.SINGULARITY_VERSION }}/x64
key: ${{ runner.os }}-singularity-${{ env.SINGULARITY_VERSION }}
fail-on-cache-miss: true
- name: Add singularity to path
run: |
echo "/opt/hostedtoolcache/singularity/${{ env.SINGULARITY_VERSION }}/x64/bin" >> $GITHUB_PATH
- name: Restore singularity container images
id: restore-singularity
uses: actions/cache@v3
with:
path: ${{ env.NXF_SINGULARITY_CACHEDIR }}
key: ${{ inputs.container-cache-key }}
- name: Restore reference data
uses: actions/cache/restore@v3
with:
path: |
${{ env.ANCESTRY_TARGET_DIR }}/GRCh38_HAPNEST_TARGET_ALL.pgen
${{ env.ANCESTRY_TARGET_DIR }}/GRCh38_HAPNEST_TARGET_ALL.psam
${{ env.ANCESTRY_TARGET_DIR }}/GRCh38_HAPNEST_TARGET_ALL.pvar.zst
${{ env.ANCESTRY_REF_DIR }}/GRCh38_HAPNEST_reference.tar.zst
key: ${{ inputs.ancestry-cache-key }}
fail-on-cache-miss: true
- name: Set up test requirements
uses: actions/setup-python@v3
with:
python-version: '3.10'
cache: 'pip'
- run: pip install -r ${{ github.workspace }}/tests/requirements.txt
- name: Run ancestry test
run: TMPDIR=~ PROFILE=singularity pytest --kwdof --symlink --git-aware --wt 2 --tag "ancestry" --ignore tests/bin
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: logs-singularity-ancestry
path: |
/home/runner/pytest_workflow_*/*/.nextflow.log
/home/runner/pytest_workflow_*/*/log.out
/home/runner/pytest_workflow_*/*/log.err
/home/runner/pytest_workflow_*/*/output/*