From 33892d3a1f1fa48d252537beda03faeb66e25cc7 Mon Sep 17 00:00:00 2001 From: Remi PLANEL <rplanel@pasteur.fr> Date: Thu, 25 Jan 2024 15:13:43 +0100 Subject: [PATCH] Update new refseq datatable --- components/content/RefseqDb.vue | 12 ++++++++---- data/refseq_res.csv | 4 ++-- packages/df-wiki-cli/df_wiki_cli/content/main.py | 2 ++ .../df-wiki-cli/df_wiki_cli/meilisearch/__init__.py | 9 ++++++++- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/components/content/RefseqDb.vue b/components/content/RefseqDb.vue index 4056d43c..be566e68 100644 --- a/components/content/RefseqDb.vue +++ b/components/content/RefseqDb.vue @@ -107,6 +107,8 @@ const scaleTypes = ref<string[]>(['linear', 'sqrt', 'log', 'symlog']) const selectedTaxoRank = ref("Superkingdom"); const headers = ref([ + { title: "Assembly", key: "Assembly" }, + { title: "Replicon", key: "replicon" }, { title: "System", @@ -474,14 +476,16 @@ async function downloadPng(component: ComponentPublicInstance | null, filename: </CollapsibleChips> </template> <template #[`item.type`]="{ item }"> - <v-chip color="info" link size="small" :to="`/defense-systems/${item.type.toLowerCase()}`" target="_blank"> {{ - item.type }} + <v-chip color="info" link size="small" :to="`/defense-systems/${item.type.toLowerCase()}`" + target="_blank"> {{ + item.type }} </v-chip> </template> <template #[`item.subtype`]="{ item }"> - <v-chip color="info" link size="small" :to="`/defense-systems/${item.type.toLowerCase()}`" target="_blank"> {{ - item.subtype }} + <v-chip color="info" link size="small" :to="`/defense-systems/${item.type.toLowerCase()}`" + target="_blank"> {{ + item.subtype }} </v-chip> </template> </ServerDbTable> diff --git a/data/refseq_res.csv b/data/refseq_res.csv index 733fbf04..becb6961 100644 --- a/data/refseq_res.csv +++ b/data/refseq_res.csv @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f19dff4f92dd3ca79a66fe6835f71261b9a5264f3df176dd005490dd74aa552d -size 64961046 +oid sha256:1a7d382a7f767718dc48aa49ae3dd9b0159fdffd96e48946c7a167bcbc516deb +size 68772089 diff --git a/packages/df-wiki-cli/df_wiki_cli/content/main.py b/packages/df-wiki-cli/df_wiki_cli/content/main.py index ee09705c..17b78657 100644 --- a/packages/df-wiki-cli/df_wiki_cli/content/main.py +++ b/packages/df-wiki-cli/df_wiki_cli/content/main.py @@ -270,6 +270,8 @@ def refseq( writer = csv.DictWriter(out, fieldnames=fieldnames) writer.writeheader() for row in reader: + if row["sys_id"] == "": + row["sys_id"] = f'{row["Assembly"]}_{row["replicon"]}' result = re.sub(r"^(\w+)\.\d+(_.*)$", r"\1\2", row["sys_id"]) console.print(f"[green]{row['sys_id']} -> {result}") row["sys_id"] = result diff --git a/packages/df-wiki-cli/df_wiki_cli/meilisearch/__init__.py b/packages/df-wiki-cli/df_wiki_cli/meilisearch/__init__.py index 3479787c..2963d14d 100644 --- a/packages/df-wiki-cli/df_wiki_cli/meilisearch/__init__.py +++ b/packages/df-wiki-cli/df_wiki_cli/meilisearch/__init__.py @@ -11,15 +11,22 @@ from rich.console import Console console = Console() +def emptyStringToNone(val: str) -> None | int: + if val == "": + return None + return int(float(val)) + + class RefSeqCsv(BaseModel): sys_id: str + Assembly: str replicon: str type: str subtype: str sys_beg: str sys_end: str protein_in_syst: List[str] - genes_count: int + genes_count: Annotated[int | None, BeforeValidator(emptyStringToNone)] name_of_profiles_in_sys: List[str] accession_in_sys: List[str] Superkingdom: str -- GitLab