-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from nextstrain/add-nextclade-github-action
Add GitHub Action for Nextclade annotations
- Loading branch information
Showing
7 changed files
with
152 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Run Nextclade on all sequences | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
dockerImage: | ||
description: "Specific container image to use for build (will override the default of `nextstrain build`)" | ||
required: false | ||
type: string | ||
|
||
jobs: | ||
run-build: | ||
permissions: | ||
id-token: write | ||
uses: nextstrain/.github/.github/workflows/pathogen-repo-build.yaml@master | ||
secrets: inherit | ||
with: | ||
runtime: aws-batch | ||
env: | | ||
NEXTSTRAIN_DOCKER_IMAGE: ${{ inputs.dockerImage }} | ||
run: | | ||
nextstrain build \ | ||
--detach \ | ||
--cpus 36 \ | ||
--memory 72gib \ | ||
--env AWS_ACCESS_KEY_ID \ | ||
--env AWS_SECRET_ACCESS_KEY \ | ||
. \ | ||
upload_all_nextclade_files \ | ||
-p \ | ||
--configfile profiles/nextclade.yaml \ | ||
--set-threads run_nextclade=12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
custom_rules: | ||
- workflow/snakemake_rules/download_from_s3.smk | ||
- profiles/nextclade/run-nextclade.smk | ||
|
||
s3_dst: "s3://nextstrain-data-private/files/workflows/seasonal-flu" | ||
|
||
segments: | ||
- ha | ||
- na | ||
|
||
builds: | ||
h1n1pdm: | ||
lineage: h1n1pdm | ||
h3n2: | ||
lineage: h3n2 | ||
vic: | ||
lineage: vic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
rule upload_all_nextclade_files: | ||
input: | ||
files=lambda wildcards: [ | ||
"data/upload/s3/{filetype}_{lineage}_{segment}.done".format(filetype=filetype, lineage=build["lineage"], segment=segment) | ||
for filetype in ("alignment", "nextclade") | ||
for build in config["builds"].values() | ||
for segment in config["segments"] | ||
] | ||
|
||
rule get_nextclade_dataset_for_lineage_and_segment: | ||
output: | ||
nextclade_dir=directory("nextclade_dataset/{lineage}_{segment}/"), | ||
shell: | ||
""" | ||
nextclade3 dataset get \ | ||
-n flu_{wildcards.lineage}_{wildcards.segment} \ | ||
--output-dir {output.nextclade_dir} | ||
""" | ||
|
||
rule run_nextclade: | ||
input: | ||
nextclade_dir="nextclade_dataset/{lineage}_{segment}/", | ||
sequences="data/{lineage}/{segment}.fasta", | ||
output: | ||
alignment="data/upload/s3/{lineage}/{segment}/aligned.fasta", | ||
annotations="data/upload/s3/{lineage}/{segment}/nextclade.tsv", | ||
log: | ||
"logs/run_nextclade_{lineage}_{segment}.txt" | ||
threads: 8 | ||
shell: | ||
""" | ||
nextclade3 run \ | ||
-j {threads} \ | ||
-D {input.nextclade_dir} \ | ||
--output-fasta {output.alignment} \ | ||
--output-tsv {output.annotations} \ | ||
{input.sequences} | ||
""" | ||
|
||
rule upload_alignment: | ||
input: | ||
alignment="data/upload/s3/{lineage}/{segment}/aligned.fasta", | ||
output: | ||
flag="data/upload/s3/alignment_{lineage}_{segment}.done", | ||
params: | ||
s3_dst=config["s3_dst"], | ||
log: | ||
"logs/upload_alignment_{lineage}_{segment}.txt" | ||
shell: | ||
""" | ||
./scripts/upload-to-s3 \ | ||
--quiet \ | ||
{input.alignment:q} \ | ||
{params.s3_dst:q}/{wildcards.lineage}/{wildcards.segment}/aligned.fasta.xz 2>&1 | tee {output.flag} | ||
""" | ||
|
||
rule upload_nextclade_annotations: | ||
input: | ||
annotations="data/upload/s3/{lineage}/{segment}/nextclade.tsv", | ||
output: | ||
flag="data/upload/s3/nextclade_{lineage}_{segment}.done", | ||
params: | ||
s3_dst=config["s3_dst"], | ||
log: | ||
"logs/upload_nextclade_annotations_{lineage}_{segment}.txt" | ||
shell: | ||
""" | ||
./scripts/upload-to-s3 \ | ||
--quiet \ | ||
{input.annotations:q} \ | ||
{params.s3_dst:q}/{wildcards.lineage}/{wildcards.segment}/nextclade.tsv.xz 2>&1 | tee {output.flag} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters