Skip to content

Commit

Permalink
[dengue-ingest]: Rescue dengue_upload script from fauna
Browse files Browse the repository at this point in the history
Rescue some of the original functionality of the dengue_upload script from fauna.

https://github.com/nextstrain/fauna/blob/35faa1ca0efc4f163116014fb6b42fe8ebe1a719/vdb/dengue_upload.py#L12-L26
  • Loading branch information
j23414 committed Sep 11, 2023
1 parent b04d6b2 commit c9a9cc9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ingest/bin/post_process_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import argparse
import json
from sys import stdin, stdout
import re

def parse_args():
parser = argparse.ArgumentParser(
Expand All @@ -15,6 +16,18 @@ def _set_strain_name(record):
"""Replace spaces, dashes, and periods with underscores in strain name."""
strain_name = record["strain"]

strain_name = strain_name.replace('Dengue_virus', '')
strain_name = strain_name.replace('Human', '').replace('human', '').replace('H.sapiens_wt', '').replace('H.sapiens_tc', '').replace('Hsapiens_tc', '').replace('H.sapiens-tc', '').replace('Homo_sapiens', '').replace('Homo sapiens', '').replace('Hsapiens', '').replace('H.sapiens', '')
strain_name = strain_name.replace('_URI', '').replace('_SER', '').replace('_PLA', '').replace('_MOS', '').replace('_SAL', '')
strain_name = strain_name.replace('Aaegypti_wt', 'Aedes_aegypti').replace('Aedessp', 'Aedes_sp')
strain_name = strain_name.replace(' ', '').replace('\'', '').replace('(', '').replace(')', '').replace('//', '/').replace('__', '_').replace('.', '').replace(',', '')
strain_name = re.sub(r'^[\/\_\-]', '', strain_name)

try:
strain_name = 'V' + str(int(strain_name))
except ValueError:
pass

return (
strain_name.replace(" ", "_")
.replace("-", "_")
Expand Down

0 comments on commit c9a9cc9

Please sign in to comment.