Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[phylo github actions] add summary message #75

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
# conform since this is a collaborative repo with an external group.
uses: nextstrain/.github/.github/workflows/pathogen-repo-ci.yaml@v0
with:
build-args: test_target
build-args: --configfile config/gisaid.yaml -pf test_target
41 changes: 41 additions & 0 deletions .github/workflows/phylogenetic-fauna.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,46 @@ on:
type: string

jobs:
summary:
runs-on: ubuntu-latest
steps:
- name: summary_step
run: |
URL_A="avian-flu/h5n1/ha/2y"
URL_B="avian-flu/h9n2/pb2/all-time"
if [[ "$TRIAL_NAME" ]]; then
echo "### Trial Build URLs" >> $GITHUB_STEP_SUMMARY
URL_BASE="https://nextstrain.org/staging/avian-flu/trials"
TRIAL_NAME_URL=$( echo "$TRIAL_NAME" | sed "s|_|/|g" )
echo "" >> $GITHUB_STEP_SUMMARY
echo " * ${URL_BASE}/${TRIAL_NAME_URL}/${URL_A}" >> $GITHUB_STEP_SUMMARY
echo " * ${URL_BASE}/${TRIAL_NAME_URL}/${URL_B}" >> $GITHUB_STEP_SUMMARY
echo " * etc" >> $GITHUB_STEP_SUMMARY
else
echo "### Canonical URLs will be updated by this run" >> $GITHUB_STEP_SUMMARY
URL_BASE="https://nextstrain.org"
echo "" >> $GITHUB_STEP_SUMMARY
echo " * ${URL_BASE}/${URL_A}" >> $GITHUB_STEP_SUMMARY
echo " * ${URL_BASE}/${URL_B}" >> $GITHUB_STEP_SUMMARY
echo " * etc" >> $GITHUB_STEP_SUMMARY
fi;
echo "" >> $GITHUB_STEP_SUMMARY
NOTE="NOTE: These URL paths may be incorrect if you've changed the "
NOTE+="snakemake targets in 'config/gisaid.yaml' as part of this PR. "
NOTE+="Please update this GitHub Action if so!"
echo "> $NOTE" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Build (meta-)environment" >> $GITHUB_STEP_SUMMARY
if [[ "$NEXTSTRAIN_DOCKER_IMAGE" ]]; then
echo " * Docker image: $NEXTSTRAIN_DOCKER_IMAGE" >> $GITHUB_STEP_SUMMARY
else
echo " * Docker image: default (latest)" >> $GITHUB_STEP_SUMMARY
fi;
echo " * Git Branch: `${BRANCH_NAME}`" >> $GITHUB_STEP_SUMMARY
env:
NEXTSTRAIN_DOCKER_IMAGE: ${{ inputs.image }}
TRIAL_NAME: ${{ inputs.trial-name }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
phylogenetic:
permissions:
id-token: write
Expand All @@ -48,6 +88,7 @@ jobs:
--memory 28800mib \
. \
deploy_all \
--configfile config/gisaid.yaml \
--config "${config[@]}"

env: |
Expand Down
46 changes: 41 additions & 5 deletions .github/workflows/phylogenetic-ncbi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,46 @@ on:
type: string

jobs:
summary:
runs-on: ubuntu-latest
steps:
- name: summary_step
run: |
URL_A="avian-flu/h5n1-cattle-outbreak/genome"
URL_B="avian-flu/h5n1-cattle-outbreak/ha"
if [[ "$TRIAL_NAME" ]]; then
echo "### Trial Build URLs" >> $GITHUB_STEP_SUMMARY
URL_BASE="https://nextstrain.org/staging/avian-flu/trials"
TRIAL_NAME_URL=$( echo "$TRIAL_NAME" | sed "s|_|/|g" )
echo "" >> $GITHUB_STEP_SUMMARY
echo " * ${URL_BASE}/${TRIAL_NAME_URL}/${URL_A}" >> $GITHUB_STEP_SUMMARY
echo " * ${URL_BASE}/${TRIAL_NAME_URL}/${URL_B}" >> $GITHUB_STEP_SUMMARY
echo " * etc" >> $GITHUB_STEP_SUMMARY
else
echo "### Canonical URLs will be updated by this run" >> $GITHUB_STEP_SUMMARY
URL_BASE="https://nextstrain.org"
echo "" >> $GITHUB_STEP_SUMMARY
echo " * ${URL_BASE}/${URL_A}" >> $GITHUB_STEP_SUMMARY
echo " * ${URL_BASE}/${URL_B}" >> $GITHUB_STEP_SUMMARY
echo " * etc" >> $GITHUB_STEP_SUMMARY
fi;
echo "" >> $GITHUB_STEP_SUMMARY
NOTE="NOTE: These URL paths may be incorrect if you've changed the "
NOTE+="snakemake targets in 'config/gisaid.yaml' as part of this PR. "
NOTE+="Please update this GitHub Action if so!"
echo "> $NOTE" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Build (meta-)environment" >> $GITHUB_STEP_SUMMARY
if [[ "$NEXTSTRAIN_DOCKER_IMAGE" ]]; then
echo " * Docker image: $NEXTSTRAIN_DOCKER_IMAGE" >> $GITHUB_STEP_SUMMARY
else
echo " * Docker image: default (latest)" >> $GITHUB_STEP_SUMMARY
fi;
echo " * Git Branch: `${BRANCH_NAME}`" >> $GITHUB_STEP_SUMMARY
env:
NEXTSTRAIN_DOCKER_IMAGE: ${{ inputs.image }}
TRIAL_NAME: ${{ inputs.trial-name }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
phylogenetic:
permissions:
id-token: write
Expand All @@ -42,10 +82,6 @@ jobs:
run: |
declare -a config;

config+=(
s3_src="s3://nextstrain-data/files/workflows/avian-flu/h5n1"
);

if [[ "$TRIAL_NAME" ]]; then
config+=(
deploy_url="s3://nextstrain-staging/avian-flu_trials_${TRIAL_NAME}_"
Expand All @@ -55,7 +91,7 @@ jobs:
nextstrain build \
. \
deploy_all \
--snakefile Snakefile.genome \
--configfile config/h5n1-cattle-outbreak.yaml \
--config "${config[@]}"

env: |
Expand Down
58 changes: 22 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@ This is the Nextstrain build for avian influenza subtypes A/H5N1, A/H5NX, A/H7N9
The most up-to-date builds of avian influenza can be found [on nextstrain.org](https://nextstrain.org/avian-flu).
Please see [nextstrain.org/docs](https://nextstrain.org/docs) for details about augur and pathogen builds.

The Snakemake pipeline is parameterised by two config files, one for the A/H5N1, A/H5NX, A/H7N9, and A/H9N2 builds and one for the 2024 A/H5N1 cattle-flu outbreak.


## Segment-level GISAID builds

The default Snakemake pipeline builds 32 Auspice datasets (8 segments x 4 subtypes (A/H5N1, A/H5NX, A/H7N9, A/H9N2)),
and can be run via `snakemake` with no config overrides.
The `config/gisaid.yaml` config builds 32 Auspice datasets (8 segments x 4 subtypes (A/H5N1, A/H5NX, A/H7N9, A/H9N2)) using GISAID data and can be run via

```bash
snakemake --cores 1 -pf --configfile config/gisaid.yaml
```

This pipeline starts by downloading data from a private S3 bucket and the appropriate credentials are required; see below for how to use locally ingested files.
For rapid AWS rebuild run as:


```bash
nextstrain build --aws-batch --aws-batch-cpus 16 --aws-batch-memory 28800 . --jobs 16
nextstrain build --aws-batch --aws-batch-cpus 16 --aws-batch-memory 28800 . --jobs 16 --configfile config/gisaid.yaml
```

Please see [nextstrain.org/docs](https://nextstrain.org/docs) for details about augur and pathogen builds.
Expand All @@ -22,8 +30,8 @@ Please see [nextstrain.org/docs](https://nextstrain.org/docs) for details about
The pipeline can automatically deploy resulting builds within the auspice folder
to nextstrain.org by running:

```
nextstrain build . deploy_all
```bash
nextstrain build . --configfile config/gisaid.yaml -f deploy_all
```

## H5N1 Cattle Outbreak (2024)
Expand All @@ -33,50 +41,28 @@ These use NCBI data including consensus genomes and SRA data assembled via the A

> Running this build will overwrite GISAID files in `./data` and thus you can't maintain or run GISAID & NCBI builds in parallel. In most cases this isn't an issue and [we are working on improving this](https://github.com/nextstrain/avian-flu/issues/70). You may want to proactively remove the `./data` directory yourself to make sure everything works as expected.

#### Whole genome build

An up-to-date version of this build is available at [nextstrain.org/avian-flu/h5n1-cattle-outbreak/genome](https://nextstrain.org/avian-flu/h5n1-cattle-outbreak/genome).

``` bash
nextstrain build \
--env AWS_ACCESS_KEY_ID \
--env AWS_SECRET_ACCESS_KEY \
. \
--config s3_src=s3://nextstrain-data/files/workflows/avian-flu/h5n1 \
-pf auspice/avian-flu_h5n1-cattle-outbreak_genome.json
```bash
snakemake --cores 1 -pf --configfile config/h5n1-cattle-outbreak.yaml
```

This pipeline starts by downloading data from a public S3 bucket, however credentials may still be required to interact with AWS S3 buckets.


**Genome builds**

The build is restricted to a set of strains where we think there's no reassortment, with outgroups excluded (`config/dropped_strains_h5n1-cattle-outbreak.txt`).
Output files will be placed in `results/h5n1-cattle-outbreak/genome`.
See `Snakefile.genome` for more details.

#### Segment-level builds

**Segment-level builds**

Strains for each segment are chosen by first constructing a general tree for the segment with all strains from 2024 onwards and then taking the clade which contains all strains in the genome build.
This should allow any reassortments to be highlighted and will also include outbreak strains which are missing from the genome build (because they don't have all 8 segments sequenced).

> Note that generating any segment-level build here will necessarily build the genome tree, as it's needed to identify the clade of interest in each segment.

All 8 segments can be built by using the helper-target 'h5n1_cattle_outbreak'

``` bash
nextstrain build \
--env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY \
. \
--config s3_src=s3://nextstrain-data/files/workflows/avian-flu/h5n1 \
-pf h5n1_cattle_outbreak
```

Alternatively, you can target specific segments via:

``` bash
nextstrain build \
--env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY \
. \
--config s3_src=s3://nextstrain-data/files/workflows/avian-flu/h5n1 \
-pf auspice/avian-flu_h5n1-cattle-flu_ha.json
```


## Creating a custom build
The easiest way to generate your own, custom avian-flu build is to use the quickstart-build as a starting template. Simply clone the quickstart-build, run with the example data, and edit the Snakefile to customize. This build includes example data and a simplified, heavily annotated Snakefile that goes over the structure of Snakefiles and annotates rules and inputs/outputs that can be modified. This build, with it's own readme, is available [here](https://github.com/nextstrain/avian-flu/tree/master/quickstart-build).
Expand Down
Loading