Skip to content

Commit

Permalink
WIP: Add rule to create column for accessions
Browse files Browse the repository at this point in the history
  • Loading branch information
j23414 committed Dec 11, 2024
1 parent a443038 commit 436805f
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion ingest/rules/curate.smk
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,27 @@ rule curate:
--output-seq-field {params.sequence_field} ) 2>> {log}
"""

rule add_metadata_columns:
"""Add columns to metadata
Notable columns:
- [NEW] url: URL linking to the NCBI GenBank record ('https://www.ncbi.nlm.nih.gov/nuccore/*').
"""
input:
metadata = "data/all_metadata.tsv"
output:
metadata = "data/all_metadata_added.tsv"
shell:
"""
csvtk mutate2 -t \
-n url \
-e '"https://www.ncbi.nlm.nih.gov/nuccore/" + $accession' \
{input.metadata} \
> {output.metadata}
"""

rule subset_metadata:
input:
metadata="data/all_metadata.tsv",
metadata="data/all_metadata_added.tsv",
output:
subset_metadata="data/subset_metadata.tsv",
params:
Expand Down

0 comments on commit 436805f

Please sign in to comment.