Skip to content

Commit

Permalink
ingest: Add default target rule
Browse files Browse the repository at this point in the history
Adds the default rule to rename the subset metadata TSV to the final
metadata TSV if the Nextclade parameters are not defined in the config.

This allows users to run the core ingest workflow with the simplest
command of `nextstrain build .`
  • Loading branch information
joverlee521 committed Oct 10, 2023
1 parent 645b26b commit 63bc9bd
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ingest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ If you have another data source or private data that needs to be formatted for
the phylogenetic workflow, then you can use a similar workflow to curate your
own data.

## Run

From within the `ingest` directory, run the workflow with:

```
nextstrain build .
```

This produces a `results` directory with the following outputs:
- sequences.fasta
- metadata.tsv

## Config

The config directory contains all of the default configurations for the ingest workflow.
Expand Down
22 changes: 22 additions & 0 deletions ingest/Snakefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
# Use default configuration values. Override with Snakemake's --configfile/--config options.
configfile: "config/defaults.yaml"

rule all:
input:
"results/sequences.fasta",
"results/metadata.tsv",


include: "rules/fetch_from_ncbi.smk"
include: "rules/curate.smk"


# If included, the nextclade rules will create the final metadata TSV by
# joining the Nextclade output with the metadata.
# However, if not including nextclade, we have to rename the subset metadata TSV
# to the final metadata TSV.
if "nextclade" in config:
include: "rules/nextclade.smk"

else:

rule create_final_metadata:
input:
metadata="results/subset_metadata.tsv"
output:
metadata="results/metadata.tsv"
shell:
"""
mv {input.metadata} {output.metadata}
"""

0 comments on commit 63bc9bd

Please sign in to comment.