Skip to content

Commit 1831d49

Browse files
authored
Merge pull request #93 from nextstrain/phylo/ppx
Phylo/ppx
2 parents 770fd86 + 9f9018f commit 1831d49

26 files changed

Lines changed: 487 additions & 282 deletions

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ RSV sequences and metadata can be downloaded in the `/ingest` folder using
2020
The ingest pipeline is based on the Nextstrain mpox ingest workflow (<https://github.com/nextstrain/mpox/tree/master/ingest>).
2121
Running the ingest pipeline produces `ingest/data/{a,b}/metadata.tsv` and `ingest/data/{a,b}/sequences.fasta`.
2222

23+
### Use locally ingested data
24+
25+
Once you have run the ingest pipeline locally you can copy the files into the top-level `data` directory so that the main phylo workflow uses these files rather than downloading from s3:
26+
27+
```sh
28+
mkdir -p data/{a,b}
29+
for i in ingest/data/*/{metadata.tsv,sequences.fasta}; do cp $i ${i#ingest/}; done
30+
```
31+
32+
2333
### `ingest/vendored`
2434

2535
This repository uses [`git subrepo`](https://github.com/ingydotnet/git-subrepo) to manage copies of ingest scripts in [`ingest/vendored`](./ingest/vendored), from [nextstrain/ingest](https://github.com/nextstrain/ingest). To pull new changes from the central ingest repository, first install `git subrepo`, then run:

config/auspice_config.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
{
99
"name": "GenBank",
1010
"url": "https://www.ncbi.nlm.nih.gov/genbank/"
11+
},
12+
{
13+
"name": "Pathoplexus",
14+
"url": "https://pathoplexus.org"
1115
}
1216
],
1317
"build_url": "https://github.com/nextstrain/rsv",
@@ -27,6 +31,11 @@
2731
"title": "Country",
2832
"type": "categorical"
2933
},
34+
{
35+
"key": "dataUseTerms",
36+
"title": "Data use terms",
37+
"type": "categorical"
38+
},
3039
{
3140
"key": "region",
3241
"title": "Region",
@@ -83,6 +92,11 @@
8392
"type": "ordinal"
8493
}
8594
],
95+
"metadata_columns": [
96+
"PPX_accession",
97+
"INSDC_accession",
98+
"restrictedUntil"
99+
],
86100
"geo_resolutions": [
87101
"country",
88102
"region"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"colorings": [
3+
{
4+
"key": "clade",
5+
"title": "Clade",
6+
"type": "categorical"
7+
}
8+
]
9+
}

config/configfile.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ builds_to_run: ["genome", "G", "F"]
66

77
resolutions_to_run: ["all-time", "6y", "3y"]
88

9-
exclude: "config/outliers.txt"
9+
exclude: "config/outliers_ppx.txt"
1010

1111
description: "config/description.md"
1212

@@ -43,6 +43,7 @@ filter:
4343

4444
files:
4545
auspice_config: "config/auspice_config.json"
46+
auspice_config_additional_colorings: "config/auspice_config_additional_colorings.json"
4647

4748
refine:
4849
coalescent: "opt"

config/description.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
We gratefully acknowledge the authors, originating and submitting laboratories of the genetic sequences and metadata for sharing their work. Please note that although data generators have generously shared data in an open fashion, that does not mean there should be free license to publish on this data. Data generators should be cited where possible and collaborations should be sought in some circumstances. Please try to avoid scooping someone else's work. Reach out if uncertain.
1+
We gratefully acknowledge the authors, originating and submitting laboratories of the genetic sequences and metadata for sharing their work via INSDC or Pathoplexus. Please note that data from Pathoplexus comes with specific data use terms that need to be abided by. If data are shared under RESTRICTED terms, you can not use these data in publications without collaborating with the group that generated the data, please consult the [Data Use Terms of Pathoplexus](https://pathoplexus.org/about/terms-of-use/restricted-data) for details. Even if data are shared without restrictions, that does not mean there should be free license to publish on this data. Data generators should be cited where possible and collaborations should be sought in some circumstances. Please try to avoid scooping someone else's work. Reach out if uncertain.
22

33
We maintain three views of human respiratory syncytial virus evolution for 3 time spans of each RSV subtype:
44

@@ -19,17 +19,18 @@ Our bioinformatic processing workflow can be found at [github.com/nextstrain/rsv
1919
- clade assignment via clade definitions defined here:
2020
[RSV-A](https://raw.githubusercontent.com/rsv-lineages/lineage-designation-A/main/.auto-generated/lineage.tsv)
2121
[RSV-B](https://raw.githubusercontent.com/rsv-lineages/lineage-designation-A/main/.auto-generated/lineage.tsv)
22-
These clade definitions are based on the not-yet-published nomenclature of the RSV Genotyping Consensus Consortium.
22+
These clade definitions are based on the [nomenclature proposal by the RSV Genotyping Consensus Consortium](https://wwwnc.cdc.gov/eid/article/30/8/24-0209_article).
2323

2424
#### Underlying data
2525

26-
We curate sequence data and metadata from the [NCBI Datasets command line tools](https://www.ncbi.nlm.nih.gov/datasets/docs/v2/download-and-install/)
27-
as starting point for these analyses. See our [ingest configuration file](https://github.com/nextstrain/rsv/blob/master/ingest/config/config.yaml)
28-
for the NCBI Taxonomy IDs used to fetch the virus genomes.
29-
Curated sequences and metadata are available as flat files at:
26+
We source sequence data and metadata from [Pathoplexus](https://pathoplexus.org) which ingests data from INSDC and provides data from INSDC together with data that were submitted directly to Pathoplexus. See our [ingest configuration file](https://github.com/nextstrain/rsv/blob/master/ingest/config/config.yaml).
27+
Curated sequences and metadata are available as flat files at the links below.
28+
The data in the files provided below is the subset of data from Pathoplexus under the OPEN [data use terms](https://pathoplexus.org/about/terms-of-use/data-use-terms). In the metadata files below, each sequence contains a field specifying the data use terms of this sequence and a link to the data use terms.
3029

3130
- [RSV-A sequences](https://data.nextstrain.org/files/workflows/rsv/a/sequences.fasta.xz)
3231
- [RSV-A metadata](https://data.nextstrain.org/files/workflows/rsv/a/metadata.tsv.gz)
3332

3433
- [RSV-B sequences](https://data.nextstrain.org/files/workflows/rsv/b/sequences.fasta.xz)
3534
- [RSV-B metadata](https://data.nextstrain.org/files/workflows/rsv/b/metadata.tsv.gz)
35+
36+
If you are interested in the RESTRICTED USE data, we ask you to obtain those directly from Pathoplexus.

config/include_a.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# A.D.3.7
2+
LC862029
3+
OZ279430
4+
OZ279094

config/include_b.txt

Whitespace-only changes.

config/outliers_ppx.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# A
2+
3+
PP_001LE8W # over diverged/misdated
4+
PP_001NQY1 # over diverged/misdated
5+
PP_001CJNE
6+
PP_0019Z0G
7+
PP_001TDF3
8+
9+
10+
# B
11+
PP_00226Q7 # over diverged/misdated
12+
PP_001B1YD
13+
PP_001B1ZB
14+
PP_0026MLS
15+
PP_00232B2
16+
PP_002S0BR

ingest/Snakefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ def _get_all_targets(wildcards):
88
"data/a/sequences.fasta",
99
"data/a/metadata.tsv",
1010
"data/b/sequences.fasta",
11-
"data/b/metadata.tsv"
11+
"data/b/metadata.tsv",
12+
"data/a/sequences_open.fasta",
13+
"data/a/metadata_open.tsv",
14+
"data/b/sequences_open.fasta",
15+
"data/b/metadata_open.tsv"
1216
]
1317

1418
# Add additional targets based on upload config

ingest/bin/curate-urls.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"""custom curate script to add URLs"""
2+
import sys
3+
import argparse
4+
from typing import Iterable
5+
6+
from augur.curate import validate_records
7+
from augur.io.json import dump_ndjson, load_ndjson
8+
9+
def run(args: argparse.Namespace, records: Iterable[dict]) -> Iterable[dict]:
10+
11+
for index, record in enumerate(records):
12+
record = record.copy()
13+
14+
ppx_accession = record.get('PPX_accession', None) # versioned
15+
insdc_accession = record.get('INSDC_accession', None) # versioned
16+
17+
# Add INSDC_accession__url and PPX_accession__url fields to NDJSON records
18+
record['PPX_accession__url'] = f"https://pathoplexus.org/seq/{ppx_accession}" \
19+
if ppx_accession \
20+
else ""
21+
record['INSDC_accession__url'] = f"https://www.ncbi.nlm.nih.gov/nuccore/{insdc_accession}" \
22+
if insdc_accession \
23+
else ""
24+
25+
yield record
26+
27+
28+
if __name__ == "__main__":
29+
parser = argparse.ArgumentParser(description=__doc__)
30+
args = parser.parse_args()
31+
32+
records = load_ndjson(sys.stdin)
33+
34+
# Validate records have the same input fields
35+
validated_input_records = validate_records(records, __doc__, True)
36+
37+
# Run this custom curate command to get modified records
38+
modified_records = run(args, validated_input_records)
39+
40+
# Validate modified records have the same output fields
41+
validated_output_records = validate_records(modified_records, __doc__, False)
42+
43+
dump_ndjson(validated_output_records)

0 commit comments

Comments
 (0)