Skip to content
Snippets Groups Projects
Commit f493a60f authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

Merge branch 'operon-struct-type' into operon-struct-type-article

parents 151a29e3 b6049948
No related branches found
No related tags found
No related merge requests found
Pipeline #129382 waiting for manual action
......@@ -45,11 +45,21 @@ onMounted(() => {
fetchStructures()
})
function extractGeneName(name: string) {
if (name.includes("__")) {
return name.split("__")[1]
}
if (name.includes("_")) {
return name.split("_")[1]
}
return undefined
}
function namesToCollapsibleChips(names: string[], systemDir: string, file: string | null = null) {
if (file === null) {
return names.filter((it) => it !== "").map(it => ({ title: it.split("__")[1] }))
return names.filter((it) => it !== "").map(it => ({ title: extractGeneName(it) }))
} else {
return names.filter((it) => it !== "").map(it => ({ title: it.split("__")[1], href: `/wiki/${systemDir}/${file}` }))
return names.filter((it) => it !== "").map(it => ({ title: extractGeneName(it), href: `/wiki/${systemDir}/${file}` }))
}
}
function pdbNameToCif(pdbPath: string) {
......
......@@ -65,22 +65,30 @@ const computedSystem = computed(() => {
return toValPage?.system ?? toValPage?.title ?? undefined
})
function extractGeneName(name: string) {
if (name.includes("__")) {
return name.split("__")[1]
}
if (name.includes("_")) {
return name.split("_")[1]
}
return undefined
}
const groupedPdocks = computed(() => {
const toValData = toValue(data)
const getSeqName = (d) => {
if (d.includes("__")) {
return d.split("__")[1]
} else {
return d
}
}
// const getSeqName = (d) => {
// if (d.includes("__")) {
// return d.split("__")[1]
// } else {
// return d
// }
// }
if (toValData?.hits) {
return d3.groups(toValData.hits.flatMap(({ system, pDockQ, pdb, nb_sys, proteins_in_the_prediction, system_genes }) => {
if (proteins_in_the_prediction.length === 2) {
const sanitizedSystemGenes = system_genes.map(getSeqName)
const sanitizedProteins = proteins_in_the_prediction.map(getSeqName)
const sanitizedSystemGenes = system_genes.map(extractGeneName)
const sanitizedProteins = proteins_in_the_prediction.map(extractGeneName)
const setProteins = new Set(sanitizedProteins)
const key = system_genes.sort().join(" / ")
if (setProteins.size === 2) {
......
......@@ -137,12 +137,21 @@ function toFolseekUrl(item: Item) {
return toValue(refinedUrl)
}
function extractGeneName(name: string) {
if (name.includes("__")) {
return name.split("__")[1]
}
if (name.includes("_")) {
return name.split("_")[1]
}
return undefined
}
function namesToCollapsibleChips(names: string[], systemDir: string, file: string | null = null) {
if (file === null) {
return names.filter((it) => it !== "").map(it => ({ title: it.split("__")[1] }))
return names.filter((it) => it !== "").map(it => ({ title: extractGeneName(it) }))
} else {
return names.filter((it) => it !== "").map(it => ({ title: it.split("__")[1], href: `/wiki/${systemDir}/${file}` }))
return names.filter((it) => it !== "").map(it => ({ title: extractGeneName(it), href: `/wiki/${systemDir}/${file}` }))
}
}
......
......@@ -34,29 +34,37 @@ const monomerStructures = computed(() => {
structImg: `${struct.pdb.split(".pdb")[0]}.png`,
structPath: struct.pdb,
proteins_in_the_prediction: struct.proteins_in_the_prediction.map(prot => {
return prot.split("__")[1]
return extractGeneName(prot)
})
}
})
}
})
function extractGeneName(name: string) {
if (name.includes("__")) {
return name.split("__")[1]
}
if (name.includes("_")) {
return name.split("_")[1]
}
return undefined
}
const sanitizedHits = computed<StructureOperonGeneWithImg[]>(() => {
const toValMsResponse = toValue(msResponse)
if (toValMsResponse && toValMsResponse?.hits?.length > 0) {
return toValMsResponse.hits.map(hit => {
// get structure information for this prot
const monomerStructuresVal = toValue(monomerStructures)
const sanitizedGene = hit.gene.split("__")[1]
const sanitizedExangeableGenes = hit.exchangeables.map(g => g.split("__")[1])
const sanitizedGene = extractGeneName(hit.gene)
const sanitizedExangeableGenes = hit.exchangeables.map(extractGeneName)
const genesAndSynonymous = new Set([sanitizedGene, ...sanitizedExangeableGenes])
if (monomerStructuresVal) {
const struct = monomerStructuresVal.find((struct) => {
return genesAndSynonymous.has(struct.proteins_in_the_prediction[0])
})
if (struct === undefined) {
console.log(hit)
}
const rawImgUrl = joinURL(`/${system.toLowerCase()}`, struct?.structImg ?? '')
const rawStructUrl = joinURL(`/${system.toLowerCase()}`, struct?.structPath ?? '')
const { refinedUrl: structImgHref } = useRefinedUrl(rawImgUrl)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment