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

Fixes for Andersen lab #56

Merged
merged 2 commits into from
Jun 11, 2024
Merged
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
16 changes: 15 additions & 1 deletion ingest/build-configs/ncbi/bin/curate-andersen-lab-data
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def create_new_record(anderson_record: dict) -> dict:
new_record['originating_lab'] = center_name
new_record['submitting_lab'] = center_name

new_record['strain'] = f'A/{anderson_record["Host"]}/{new_record["country"]}/{anderson_record["isolate"]}/{parse_year(new_record["date"])}'
new_record['strain'] = construct_strain_name(new_record, anderson_record['isolate'])
return new_record


Expand All @@ -78,6 +78,20 @@ def parse_center_name(center_name: str) -> str:
return center_name


def construct_strain_name(record: dict, sample_id: str) -> str:
"""
Construct a strain name for the *sample_id* using metadata from the *record*
to include host, country, and year.

Removes all spaces in the constructed strain name because they are not
allowed in the downstream phylogenetic workflow.
"""
host = record['host']
country = record['country']
year = parse_year(record['date'])
return f"A/{host}/{country}/{sample_id}/{year}".replace(" ", "")


def parse_year(date_string: str) -> str:
"""
Parse the year from the provided `date_string`
Expand Down
2 changes: 1 addition & 1 deletion ingest/build-configs/ncbi/defaults/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,4 @@ join_ncbi_andersen:
match_field: sra_accessions
source_column_name: data_source
ncbi_source: genbank
andersen_source: andersen-lab
andersen_source: sra-via-andersen-lab