Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Wiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MDM Lab
Wiki
Merge requests
!229
Draft: Modify all articles with article struct
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Draft: Modify all articles with article struct
modify-all-articles-with-article-struct
into
dev
Overview
0
Commits
11
Pipelines
1
Changes
159
Closed
Remi PLANEL
requested to merge
modify-all-articles-with-article-struct
into
dev
1 year ago
Overview
0
Commits
11
Pipelines
1
Changes
159
Expand
0
0
Merge request reports
Compare
dev
dev (base)
and
latest version
latest version
93a7b4d2
11 commits,
1 year ago
159 files
+
1146
−
3501
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
159
Search (e.g. *.vue) (Ctrl+P)
components/content/ArticleStructure.vue
0 → 100644
+
153
−
0
Options
<
script
setup
lang=
"ts"
>
import
{
toValue
}
from
'
@vueuse/core
'
;
import
MolstarPdbePlugin
from
'
./MolstarPdbePlugin.vue
'
;
const
{
page
}
=
useContent
();
// get the structures
const
structures
=
ref
()
const
structureTitle
=
ref
(
"
Structure
"
)
const
msIndexName
=
ref
<
string
>
(
"
structure
"
)
const
stuctureUrls
=
ref
<
string
[]
|
undefined
>
(
undefined
)
const
headers
=
ref
<
Record
<
string
,
any
>
[]
>
([
{
title
:
'
Structure
'
,
key
:
'
structure
'
,
sortable
:
false
,
removable
:
false
,
fixed
:
true
,
minWidth
:
"
110px
"
},
{
title
:
"
System
"
,
key
:
"
System
"
},
{
title
:
"
Gene name
"
,
key
:
"
gene_name
"
,
removable
:
false
},
{
title
:
"
Subtype
"
,
key
:
"
subtype
"
,
removable
:
false
},
{
title
:
"
Proteins in structure
"
,
key
:
'
proteins_in_the_prediction
'
,
sortable
:
false
,
removable
:
true
},
{
title
:
"
System genes
"
,
key
:
"
system_genes
"
,
sortable
:
false
,
removable
:
true
},
{
title
:
"
Prediction type
"
,
key
:
"
prediction_type
"
,
removable
:
true
},
{
title
:
"
N genes in sys
"
,
key
:
"
system_number_of_genes
"
,
removable
:
true
},
{
title
:
"
pLDDT
"
,
key
:
"
plddts
"
,
removable
:
true
},
{
title
:
"
iptm+ptm
"
,
key
:
"
iptm+ptm
"
,
removable
:
true
},
{
title
:
"
pDockQ
"
,
key
:
"
pDockQ
"
,
removable
:
true
},
])
const
groupBy
=
ref
([
{
key
:
'
subtype
'
,
order
:
'
asc
'
,
},
])
onBeforeMount
(()
=>
{
fetchStructures
()
})
onMounted
(()
=>
{
fetchStructures
()
})
function
namesToCollapsibleChips
(
names
:
string
[],
systemDir
:
string
,
file
:
string
|
null
=
null
)
{
if
(
file
===
null
)
{
return
names
.
filter
((
it
)
=>
it
!==
""
).
map
(
it
=>
({
title
:
it
.
split
(
"
__
"
)[
1
]
}))
}
else
{
return
names
.
filter
((
it
)
=>
it
!==
""
).
map
(
it
=>
({
title
:
it
.
split
(
"
__
"
)[
1
],
href
:
`/wiki/
${
systemDir
}
/
${
file
}
`
}))
}
}
function
pdbNameToCif
(
pdbPath
:
string
)
{
const
cifPath
=
pdbPath
.
split
(
"
.
"
).
slice
(
0
,
-
1
).
join
(
"
.
"
)
return
`
${
cifPath
}
.cif`
}
function
displayStructure
(
item
)
{
stuctureUrls
.
value
=
item
.
structuresUrls
console
.
log
(
item
)
structureTitle
.
value
=
`
${
item
.
subtype
}
-
${
item
.
gene_name
}
`
}
const
sanitizedStructures
=
computed
(()
=>
{
const
toValStructures
=
toValue
(
structures
)
if
(
toValStructures
?.
hits
?.
length
>
0
)
{
return
toValStructures
.
hits
.
map
(
item
=>
{
return
{
...
item
,
structuresUrls
:
[
`/
${
item
.
System_name_ok
}
/
${
pdbNameToCif
(
item
.
pdb
)}
`
,
`/
${
item
.
System_name_ok
}
/
${
item
.
pdb
}
`
]
.
map
(
url
=>
{
return
toValue
(
useRefinedUrl
(
url
).
refinedUrl
)
})
}
})
}
return
[]
})
// ==================================================================================
// ASYNC PART
async
function
fetchStructures
()
{
const
{
data
,
error
,
refresh
}
=
await
useAsyncMeiliSearch
({
index
:
toValue
(
msIndexName
),
query
:
""
,
params
:
{
facets
:
[
"
*
"
],
filter
:
[
`System='
${
toValue
(
page
).
title
}
'`
,
"
completed='true'
"
],
}
})
structures
.
value
=
data
.
value
if
(
error
.
value
)
{
throw
createError
(
`Cannot get structure for system:
${
page
.
title
}
`
)
}
}
// watch(page() => {
// refresh()
// })
console
.
log
(
structures
)
</
script
>
<
template
>
<v-card
flat
>
<v-data-table
:headers=
"headers"
:items=
"sanitizedStructures"
:group-by=
"groupBy"
>
<template
#
[`
item.proteins_in_the_prediction
`
]=
"
{ item }">
<CollapsibleChips
:items=
"namesToCollapsibleChips(item.proteins_in_the_prediction, item.System_name_ok, item.fasta_file)"
>
</CollapsibleChips>
</
template
>
<
template
#
[`
item.system_genes
`
]=
"{ item }"
>
<CollapsibleChips
:items=
"namesToCollapsibleChips(item.system_genes, item.System_name_ok)"
>
</CollapsibleChips>
</
template
>
<
template
v-slot:group-header=
"{ item, columns, toggleGroup, isGroupOpen }"
>
<tr>
<td
:colspan=
"columns.length"
>
<VBtn
:icon=
"isGroupOpen(item) ? '$expand' : '$next'"
size=
"small"
variant=
"text"
@
click=
"toggleGroup(item)"
></VBtn>
{{
item
.
value
===
'
na
'
?
'
No subtype
'
:
item
.
value
}}
</td>
</tr>
</
template
>
<
template
#
[`
item.structure
`
]=
"{ item }"
>
<v-row
justify=
"space-between"
dense
no-gutters
align=
"center"
>
<v-col>
<v-btn
size=
"x-small"
variant=
"text"
icon=
"md:visibility"
@
click=
"displayStructure(item)"
></v-btn>
</v-col>
<v-col>
<v-menu>
<template
v-slot:activator=
"
{ props }">
<v-btn
:disabled=
"item.structuresUrls?.length
<
1"
size=
"x-small"
variant=
"text"
icon=
"md:download"
class=
"ml-1"
v-bind=
"props"
></v-btn>
</
template
>
<v-list>
<v-list-item
v-for=
"(url, index) in item.structuresUrls"
:key=
"index"
:value=
"index"
:href=
"url"
>
<v-list-item-title>
{{ url.split('.').slice(-1)[0] }}
</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</v-col>
</v-row>
</template>
</v-data-table>
<PdbeMolstarPlugin
v-model=
"stuctureUrls"
v-model:title=
"structureTitle"
/>
</v-card>
</template>
\ No newline at end of file
Loading