Skip to content
Snippets Groups Projects
Commit 0c439c4f authored by Jean  CURY's avatar Jean CURY Committed by Remi PLANEL
Browse files

new tentative

parent d9f8c860
No related branches found
No related tags found
1 merge request!166new tentative
...@@ -159,8 +159,8 @@ const moleculeFormat: Ref<string> = ref("pdb") ...@@ -159,8 +159,8 @@ const moleculeFormat: Ref<string> = ref("pdb")
<template> <template>
<template v-if="uniq"> <template v-if="uniq">
<v-row> <v-row>
<v-btn size="x-small" variant="tonal" icon="md:visibility" @click="setSelectedPdbToFirst()"></v-btn> <v-btn size="x-small" variant="text" icon="md:visibility" @click="setSelectedPdbToFirst()"></v-btn>
<v-btn :disabled="!structureToDownload" size="x-small" variant="tonal" icon="md:download" class="ml-1" <v-btn :disabled="!structureToDownload" size="x-small" variant="text" icon="md:download" class="ml-1"
:href="structureToDownload"></v-btn> :href="structureToDownload"></v-btn>
</v-row> </v-row>
</template> </template>
...@@ -191,8 +191,9 @@ const moleculeFormat: Ref<string> = ref("pdb") ...@@ -191,8 +191,9 @@ const moleculeFormat: Ref<string> = ref("pdb")
<v-sheet v-if="selectedPdb" <v-sheet v-if="selectedPdb"
class="d-flex align-center justify-center flex-wrap text-center mx-auto px-4 my-3" class="d-flex align-center justify-center flex-wrap text-center mx-auto px-4 my-3"
:height="computedHeight" :width="computedWidth" position="relative"> :height="computedHeight" :width="computedWidth" position="relative">
<pdbe-molstar ref="pdbeMolstarComponent" landscape :custom-data-url="selectedPdb" <pdbe-molstar ref="pdbeMolstarComponent" landscape="true" hide-controls="true"
alphafold-view="true" :custom-data-format="moleculeFormat"></pdbe-molstar> :custom-data-url="selectedPdb" alphafold-view="true"
:custom-data-format="moleculeFormat"></pdbe-molstar>
</v-sheet> </v-sheet>
</v-col> </v-col>
<v-col :cols="mobile ? 12 : undefined"> <v-col :cols="mobile ? 12 : undefined">
...@@ -259,12 +260,12 @@ const moleculeFormat: Ref<string> = ref("pdb") ...@@ -259,12 +260,12 @@ const moleculeFormat: Ref<string> = ref("pdb")
<style> <style>
.msp-plugin .msp-plugin-content { /* .msp-plugin .msp-plugin-content {
color: black !important; color: black !important;
} } */
div.msp-plugin-content.msp-layout-expanded { div.msp-plugin-content.msp-layout-expanded {
z-index: 99 !important z-index: 5 !important
} }
.legendColor { .legendColor {
......
...@@ -6,12 +6,14 @@ import { useNumericalFilter } from "@/composables/useNumericalfilter" ...@@ -6,12 +6,14 @@ import { useNumericalFilter } from "@/composables/useNumericalfilter"
import { ServerDbTable } from "#components" import { ServerDbTable } from "#components"
const sortBy: Ref<SortItem[]> = ref([{ key: 'system', order: "asc" }]) const sortBy: Ref<SortItem[]> = ref([{ key: 'System', order: "asc" }])
const itemValue = ref("id"); const itemValue = ref("id");
const facets: Ref<string[]> = ref(["system", "completed", "prediction_type",]) const facets: Ref<string[]> = ref(["System", "subtype", "gene_name", "completed", "prediction_type",])
const headers: Ref<Object[]> = ref([ const headers: Ref<Object[]> = ref([
{ title: 'Structure', key: 'structure', sortable: false, removable: false }, { title: 'Structure', key: 'structure', sortable: false, removable: false },
{ title: "Type", key: "system", removable: false }, { title: "System", key: "System", removable: false },
{ title: "Gene name", key: "gene_name", removable: false },
{ title: "Subtype", key: "subtype", removable: false },
// { title: "pdb file", key: "pdb" }, // { title: "pdb file", key: "pdb" },
// { title: "fasta", key: "fasta_file" }, // { title: "fasta", key: "fasta_file" },
{ title: "Proteins in structure", key: 'proteins_in_the_prediction', sortable: false, removable: true }, { title: "Proteins in structure", key: 'proteins_in_the_prediction', sortable: false, removable: true },
...@@ -54,11 +56,11 @@ const dataTableServerProps = computed(() => { ...@@ -54,11 +56,11 @@ const dataTableServerProps = computed(() => {
function namesToCollapsibleChips(names: string[], file: string | null = null) { function namesToCollapsibleChips(names: string[], systemDir: string, file: string | null = null) {
if (file === null) { if (file === null) {
return names.filter((it) => it !== "").map(it => ({ title: it.split("__").pop() })) return names.filter((it) => it !== "").map(it => ({ title: it.split("__")[1] }))
} else { } else {
return names.filter((it) => it !== "").map(it => ({ title: it.split("__").pop(), href: `/wiki/${toSystemName(file)}/${file}` })) return names.filter((it) => it !== "").map(it => ({ title: it.split("__")[1], href: `/wiki/${systemDir}/${file}` }))
} }
} }
...@@ -68,14 +70,9 @@ function pdbNameToCif(pdbPath: string) { ...@@ -68,14 +70,9 @@ function pdbNameToCif(pdbPath: string) {
} }
function toSystemName(rawName: string) { function toSystemName(rawName: string) {
// split on -0 if exists else on _ // Does it work if it's a list of system genes ?
if (rawName.includes("-0")) { // split on __ for systeme_vgenes
return rawName.split("__")[0].toLocaleLowerCase()
return rawName.split("-0")[0].toLocaleLowerCase()
} else {
return rawName.split("_")[0].toLocaleLowerCase()
}
} }
...@@ -130,15 +127,16 @@ const plddtDistribution = computed(() => { ...@@ -130,15 +127,16 @@ const plddtDistribution = computed(() => {
</template> </template>
<template #[`item.proteins_in_the_prediction`]="{ item }"> <template #[`item.proteins_in_the_prediction`]="{ item }">
<CollapsibleChips :items="namesToCollapsibleChips(item.proteins_in_the_prediction, item.fasta_file)"> <CollapsibleChips
:items="namesToCollapsibleChips(item.proteins_in_the_prediction, item.System_name_ok, item.fasta_file)">
</CollapsibleChips> </CollapsibleChips>
</template> </template>
<template #[`item.system_genes`]="{ item }"> <template #[`item.system_genes`]="{ item }">
<CollapsibleChips :items="namesToCollapsibleChips(item.system_genes)"></CollapsibleChips> <CollapsibleChips :items="namesToCollapsibleChips(item.system_genes, item.System_name_ok)"></CollapsibleChips>
</template> </template>
<template #[`item.structure`]="{ item }"> <template #[`item.structure`]="{ item }">
<MolstarPdbePlugin v-if="item?.pdb && item.pdb !== 'na'" <MolstarPdbePlugin v-if="item?.pdb && item.pdb !== 'na'"
:data-urls="[`/${toSystemName(item.system)}/${pdbNameToCif(item.pdb)}`]" uniq> :data-urls="[`/${item.System_name_ok}/${pdbNameToCif(item.pdb)}`]" uniq>
</MolstarPdbePlugin> </MolstarPdbePlugin>
<!-- <v-icon v-else color="warning" icon="md:dangerous"></v-icon> --> <!-- <v-icon v-else color="warning" icon="md:dangerous"></v-icon> -->
......
source diff could not be displayed: it is stored in LFS. Options to address this: view the blob.
This diff is collapsed.
mmb_gp29_gp30: MMB_gp29_gp30
pd-lambda-4: PD-Lambda-4
zorya: Zorya
radar: RADAR
abie: AbiE
pd-t4-3: PD-T4-3
gaps6: GAPS6
abia: AbiA
pd-lambda-2: PD-Lambda-2
pd-t4-5: PD-T4-5
aditi: Aditi
fs_hp_sdh_sah: FS_HP_SDH_sah
gao_upx: Gao_Upx
kiwa: Kiwa
nhi: Nhi
abiq: AbiQ
pd-lambda-6: PD-Lambda-6
isg15-like: ISG15-like
pif: Pif
gasdermin: GasderMIN
mqsrac: MqsRAC
pd-t4-8: PD-T4-8
septu: Septu
bunzi: Bunzi
abir: AbiR
fs_giy_yig: FS_GIY_YIG
abij: AbiJ
retron: Retron
cas: CRISPR-Cas
pd-t7-5: PD-T7-5
fs_hp: FS_HP
abiv: AbiV
disarm: DISARM
rst_2tm_1tm_tir: Rst_2TM_1TM_TIR
pago: pAgo
menshen: Menshen
rst_3hp: Rst_3HP
pd-t4-9: PD-T4-9
viperin: Viperin
gaps1: GAPS1
fs_hsdr_like: FS_HsdR_like
pd-t4-1: PD-T4-1
pd-t4-10: PD-T4-10
pd-t4-7: PD-T4-7
rloc: RloC
stk2: Stk2
gao_qat: Gao_Qat
pd-t7-1: PD-T7-1
fs_sma: FS_Sma
rst_tir-nlr: Rst_TIR-NLR
gao_ppl: Gao_Ppl
pd-t4-2: PD-T4-2
sofic: SoFIC
detocs: Detocs
cbass: CBASS
abig: AbiG
gaps2: GAPS2
abiu: AbiU
abip2: AbiP2
sefir: SEFIR
borvo: Borvo
old_exonuclease: Old_exonuclease
rnlab: RnlAB
abii: AbiI
abid: AbiD
prrc: PrrC
rst_duf4238: Rst_DUF4238
abi2: Abi2
azaca: Azaca
rst_hydrolase-3tm: Rst_Hydrolase-3Tm
ddmde: DdmDE
mads: MADS
phrann_gp29_gp30: Phrann_gp29_gp30
abil: AbiL
olokun: Olokun
pd-t7-3: PD-T7-3
nixi: NixI
pd-lambda-1: PD-Lambda-1
dctpdeaminase: dCTPdeaminase
eleos: Eleos
drt: DRT
pd-t4-6: PD-T4-6
pd-t4-4: PD-T4-4
0:title
dartg: DarTG
dpd: Dpd
sanata: SanaTA
mokosh: Mokosh
paris: Paris
dsr: Dsr
abio: AbiO
hna: Hna
tiamat: Tiamat
brex: BREX
shango: Shango
druantia: Druantia
rosmerta: RosmerTA
abit: AbiT
psyrta: PsyrTA
abik: AbiK
thoeris: Thoeris
pd-t7-2: PD-T7-2
abib: AbiB
lamassu-fam: Lamassu-Fam
gao_iet: Gao_Iet
avs: Avs
spbk: SpbK
pycsar: Pycsar
wadjet: Wadjet
rst_helicaseduf2290: Rst_HelicaseDUF2290
gao_mza: Gao_Mza
gao_ape: Gao_Ape
mazef: MazEF
pd-lambda-3: PD-Lambda-3
abih: AbiH
shedu: Shedu
gao_her: Gao_Her
shosta: ShosTA
abic: AbiC
dazbog: Dazbog
gao_tery: Gao_TerY
hachiman: Hachiman
sspbcde: SspBCDE
lit: Lit
rm: RM
card_nlr: CARD_NLR
gaps4: GAPS4
abin: AbiN
pd-t7-4: PD-T7-4
charlie_gp32: Charlie_gp32
fs_hepn_tm: FS_HEPN_TM
rst_rt-nitrilase-tm: Rst_RT-nitrilase-Tm
uzume: Uzume
mok_hok_sok: Mok_Hok_Sok
dodola: Dodola
dgtpase: dGTPase
butters_gp57r: Butters_gp57r
bsta: BstA
gao_tmn: Gao_Tmn
panchino_gp28: Panchino_gp28
caprel: CapRel
nlr: NLR
pd-lambda-5: PD-Lambda-5
dnd: Dnd
abiz: AbiZ
gabija: Gabija
jukab: JukAB
gao_hhe: Gao_Hhe
rst_gop_beta_cll: Rst_gop_beta_cll
pfiat: PfiAT
gao_rl: Gao_RL
rexab: RexAB
butters_gp30_gp31: Butters_gp30_gp31
...@@ -4,7 +4,8 @@ import json ...@@ -4,7 +4,8 @@ import json
import pandas as pd import pandas as pd
import shutil import shutil
import csv import csv
import yaml import matplotlib.pyplot as plt
from pandas.errors import ParserError
from typing_extensions import Annotated from typing_extensions import Annotated
from typing import Optional, List from typing import Optional, List
from pathlib import Path from pathlib import Path
...@@ -88,17 +89,6 @@ def structure( ...@@ -88,17 +89,6 @@ def structure(
resolve_path=True, resolve_path=True,
), ),
], ],
map: Annotated[
Path,
typer.Option(
exists=True,
file_okay=True,
dir_okay=True,
writable=False,
readable=True,
resolve_path=True,
),
],
dir: Annotated[ dir: Annotated[
Path, Path,
typer.Option( typer.Option(
...@@ -122,13 +112,10 @@ def structure( ...@@ -122,13 +112,10 @@ def structure(
), ),
], ],
): ):
with open(map, "r") as map_f:
system_to_dir = yaml.safe_load(map_f)
with open(stat, "r") as stat_f: with open(stat, "r") as stat_f:
reader = csv.DictReader(stat_f) reader = csv.DictReader(stat_f)
for row in reader: for row in reader:
dir_name = system_to_dir[row["system"]] dir_name = row["System_name_ok"]
pdb_path_file = Path(row["pdb"]) pdb_path_file = Path(row["pdb"])
cif_file_name = Path(str(pdb_path_file).split(".pdb")[0] + ".cif") cif_file_name = Path(str(pdb_path_file).split(".pdb")[0] + ".cif")
files = [ files = [
...@@ -143,11 +130,21 @@ def structure( ...@@ -143,11 +130,21 @@ def structure(
for f in files: for f in files:
str_f = str(f["f"]) str_f = str(f["f"])
if str_f and str_f != "." and str_f != "" and str_f != "na": if str_f and str_f != "." and str_f != "" and str_f != "na":
# console.print("--" + str(f["f"]) + "--")
# console.print(f"[green] copy {f['f'].name} to {target_dir}")
file_to_copy = dir / f["d"] / f["f"] file_to_copy = dir / f["d"] / f["f"]
if file_to_copy.exists(): if file_to_copy.exists():
shutil.copy2(file_to_copy, target_dir) if f["d"] == "PAE":
png_file = str(file_to_copy).split(".tsv")[0] + ".png"
try:
pae2png(file_to_copy, png_file)
except ParserError as err:
console.print(
f"[red] file {str(file_to_copy.name)} cannot be parsed"
)
print(err)
else:
shutil.copy2(png_file, target_dir)
else:
shutil.copy2(file_to_copy, target_dir)
else: else:
console.print( console.print(
f"[red] file {str(file_to_copy.name)} does not exist" f"[red] file {str(file_to_copy.name)} does not exist"
...@@ -229,3 +226,16 @@ def systems( ...@@ -229,3 +226,16 @@ def systems(
json_object = json.dumps(systems, indent=2) json_object = json.dumps(systems, indent=2)
ty.write(json_object) ty.write(json_object)
def pae2png(tsv_file, png_file):
v = pd.read_table(tsv_file, index_col=0, low_memory=False)
fig, ax = plt.subplots(1, 1, figsize=(4, 3), facecolor=None)
m = ax.matshow(v, cmap="Greens_r", vmin=0, vmax=35, aspect="auto", origin="lower")
cbar = plt.colorbar(m, ax=ax, fraction=0.046, pad=0.04)
ax.set_xlabel("Scored Residues")
ax.set_ylabel("Aligned Residues")
cbar.set_label("Expected Position Error (Å)")
plt.tight_layout()
plt.savefig(png_file, dpi=150, facecolor=None, transparent=True)
plt.close()
...@@ -45,7 +45,10 @@ NaFloat = Annotated[Optional[float], BeforeValidator(na_to_none)] ...@@ -45,7 +45,10 @@ NaFloat = Annotated[Optional[float], BeforeValidator(na_to_none)]
class StrucutreStatistics(BaseModel): class StrucutreStatistics(BaseModel):
id: int id: int
system: str System_name_ok: str
System: str
gene_name: str
subtype: str
proteins_in_the_prediction: List[str] proteins_in_the_prediction: List[str]
prediction_type: str prediction_type: str
batch: int batch: int
...@@ -150,7 +153,16 @@ def update_structure( ...@@ -150,7 +153,16 @@ def update_structure(
) )
print(pagination_settings_task) print(pagination_settings_task)
attr_task = index.update_filterable_attributes( attr_task = index.update_filterable_attributes(
body=["system", "completed", "prediction_type", "plddts", "iptm+ptm", "pDockQ"] body=[
"System",
"gene_name",
"subtype",
"completed",
"prediction_type",
"plddts",
"iptm+ptm",
"pDockQ",
]
) )
params = { params = {
"maxValuesPerFacet": 1000000, "maxValuesPerFacet": 1000000,
...@@ -161,7 +173,10 @@ def update_structure( ...@@ -161,7 +173,10 @@ def update_structure(
print(attr_task) print(attr_task)
index.update_sortable_attributes( index.update_sortable_attributes(
[ [
"system", "System_name_ok",
"System",
"gene_name",
"subtype",
"completed", "completed",
"plddts", "plddts",
"nb_sys", "nb_sys",
...@@ -170,7 +185,6 @@ def update_structure( ...@@ -170,7 +185,6 @@ def update_structure(
"system_number_of_genes", "system_number_of_genes",
"iptm+ptm", "iptm+ptm",
"pDockQ", "pDockQ",
"type",
] ]
) )
index.update_typo_tolerance({"enabled": False}) index.update_typo_tolerance({"enabled": False})
......
This diff is collapsed.
[tool.poetry] [tool.poetry]
name = "df-wiki-cli" name = "df-wiki-cli"
version = "0.1.3" version = "0.1.4"
description = "" description = ""
authors = ["Remi PLANEL <rplanel@pasteur.fr>"] authors = ["Remi PLANEL <rplanel@pasteur.fr>"]
readme = "README.md" readme = "README.md"
...@@ -17,6 +17,7 @@ meilisearch = "^0.28.4" ...@@ -17,6 +17,7 @@ meilisearch = "^0.28.4"
pydantic = "^2.4.2" pydantic = "^2.4.2"
pydantic-yaml = "^1.2.0" pydantic-yaml = "^1.2.0"
python-frontmatter = "^1.0.1" python-frontmatter = "^1.0.1"
matplotlib = "^3.8.2"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment