Skip to content

Commit

Permalink
ingest: Dedup by sample id within NCBI and Andersen lab data
Browse files Browse the repository at this point in the history
In investigating the duplicates dropped from the joined-ncbi metadata,
I realized that these duplicates were not purely from the merge of
the two data sources.

This commit deduplicates by sample id in the upstream metadata as well.
There's no need to change the processing of sequence FASTAs at this
point because they are still matched by their respective accessions
instead of strain name.
  • Loading branch information
joverlee521 committed Oct 11, 2024
1 parent 58c0508 commit 12e8964
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion ingest/build-configs/ncbi/rules/curate.smk
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,12 @@ rule split_curated_ndjson_by_segment:
benchmark:
"ncbi/benchmarks/{segment}/split_curated_ndjson_by_segment.txt"
shell:
"""
r"""
(cat {input.curated_ndjson} \
| ./build-configs/ncbi/bin/filter-ndjson-by-segment \
--segment {wildcards.segment} \
| ./build-configs/ncbi/bin/dedup-by-strain \
| ./build-configs/ncbi/bin/dedup-by-sample-id \
| augur curate passthru \
--output-metadata {output.metadata} \
--output-fasta {output.sequences} \
Expand Down
7 changes: 4 additions & 3 deletions ingest/build-configs/ncbi/rules/ingest_andersen_lab.smk
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,12 @@ rule curate_metadata:
expected_date_formats=['%Y-%m-%d', '%Y', '%Y-%m-%d %H:%M:%S', '%Y-%m-%dT%H:%M:%SZ'],
annotations_id=config["curate"]["annotations_id"],
shell:
"""
augur curate normalize-strings \
r"""
(augur curate normalize-strings \
--metadata {input.metadata} \
| ./build-configs/ncbi/bin/curate-andersen-lab-data \
| ./build-configs/ncbi/bin/dedup-by-strain \
| ./build-configs/ncbi/bin/dedup-by-sample-id \
| augur curate format-dates \
--date-fields {params.date_fields:q} \
--expected-date-formats {params.expected_date_formats:q} \
Expand All @@ -143,7 +144,7 @@ rule curate_metadata:
--annotations {input.annotations} \
--id-field {params.annotations_id} \
| augur curate passthru \
--output-metadata {output.metadata} 2>> {log}
--output-metadata {output.metadata}) 2>> {log}
"""

rule match_metadata_and_segment_fasta:
Expand Down

0 comments on commit 12e8964

Please sign in to comment.