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
!226
Resolve "Design of the structure section in a system's page"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Design of the structure section in a system's page"
matrix-pdock
into
dev
Overview
0
Commits
27
Pipelines
21
Changes
6
Merged
Remi PLANEL
requested to merge
matrix-pdock
into
dev
1 year ago
Overview
0
Commits
27
Pipelines
21
Changes
6
Expand
Ref
#137 (closed)
0
0
Merge request reports
Viewing commit
81a36aab
Prev
Next
Show latest version
6 files
+
151
−
25
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
81a36aab
try add matrix-pdock auto
· 81a36aab
Remi PLANEL
authored
1 year ago
components/content/MatrixPdock.vue
0 → 100644
+
132
−
0
Options
<
script
setup
lang=
"ts"
>
import
*
as
d3
from
"
d3
"
;
import
*
as
Plot
from
"
@observablehq/plot
"
;
import
PlotFigure
from
"
~/components/PlotFigure
"
;
export
interface
Props
{
system
?:
MaybeRef
<
string
|
null
>
}
const
{
page
}
=
useContent
();
const
{
system
}
=
withDefaults
(
defineProps
<
Props
>
(),
{
system
:
null
})
const
dbName
=
"
structure
"
const
filterBase
=
ref
<
string
[]
>
([
"
prediction_type='multimer(dimer)'
"
,
"
completed='true'
"
])
export
interface
PlotMargin
{
marginTop
:
number
,
marginRight
:
number
,
marginBottom
:
number
,
marginLeft
:
number
}
const
margin
=
ref
<
PlotMargin
>
({
marginTop
:
100
,
marginRight
:
50
,
marginBottom
:
0
,
marginLeft
:
150
})
const
computedSystem
=
computed
(()
=>
{
const
toValPage
=
toValue
(
page
)
const
toValSystem
=
toValue
(
system
)
if
(
toValSystem
===
null
)
{
return
toValPage
?.
title
?.
toLowerCase
()
??
null
}
else
{
return
toValSystem
}
})
const
groupedPdocks
=
computed
(()
=>
{
const
toValData
=
toValue
(
data
)
return
d3
.
groups
(
toValData
.
hits
.
flatMap
(({
System_name_ok
,
pDockQ
,
pdb
,
nb_sys
,
proteins_in_the_prediction
,
system_genes
})
=>
{
if
(
proteins_in_the_prediction
.
length
===
2
)
{
const
sanitizedSystemGenes
=
system_genes
.
map
(
d
=>
d
.
split
(
"
__
"
)[
1
])
const
sanitizedProteins
=
proteins_in_the_prediction
.
map
(
d
=>
d
.
split
(
"
__
"
)[
1
])
const
setProteins
=
new
Set
(
sanitizedProteins
)
if
(
setProteins
.
size
===
2
)
{
return
sanitizedProteins
.
map
((
prot
,
i
)
=>
{
if
(
i
===
0
)
{
return
{
System_name_ok
,
system_genes
:
sanitizedSystemGenes
,
pDockQ
,
pdb
,
nb_sys
,
proteins_in_the_prediction
:
sanitizedProteins
,
protX
:
prot
,
protY
:
sanitizedProteins
[
i
+
1
]
}
}
else
{
return
{
System_name_ok
,
system_genes
:
sanitizedSystemGenes
,
pDockQ
,
pdb
,
nb_sys
,
proteins_in_the_prediction
:
sanitizedProteins
,
protX
:
prot
,
protY
:
sanitizedProteins
[
i
-
1
]
}
}
})
}
else
{
return
{
System_name_ok
,
system_genes
:
sanitizedSystemGenes
,
pDockQ
,
pdb
,
nb_sys
,
proteins_in_the_prediction
:
sanitizedProteins
,
protX
:
sanitizedProteins
[
0
],
protY
:
sanitizedProteins
[
1
]
}
}
}
else
{
throw
createError
(
`More than 2 proteins in a dimer structure for system
${
computedSystem
.
value
}
!`
)
}
}),
d
=>
d
.
system_genes
.
join
(
"
--
"
))
})
const
computedPDocksMatrixPlotOptions
=
computed
(()
=>
{
const
{
marginBottom
,
marginLeft
,
marginRight
,
marginTop
}
=
toValue
(
margin
)
return
toValue
(
groupedPdocks
).
map
((
matrix
)
=>
{
return
{
width
:
matrix
[
1
][
0
].
system_genes
.
length
*
75
+
marginLeft
+
marginRight
,
height
:
matrix
[
1
][
0
].
system_genes
.
length
*
75
+
marginTop
+
marginBottom
,
title
:
matrix
[
0
],
padding
:
0
,
marginTop
,
marginLeft
,
marginRight
,
marginBottom
,
grid
:
true
,
x
:
{
axis
:
"
top
"
,
label
:
"
Proteins
"
,
tickRotate
:
45
},
y
:
{
label
:
"
Proteins
"
},
legend
:
{
label
:
matrix
[
0
]
},
color
:
{
scheme
:
"
plasma
"
,
legend
:
true
,
reverse
:
true
},
marks
:
[
Plot
.
frame
(),
Plot
.
cell
(
toValue
(
matrix
[
1
]),
{
x
:
(
d
)
=>
d
.
protX
,
y
:
(
d
)
=>
d
.
protY
,
fill
:
"
pDockQ
"
,
inset
:
0.5
,
tip
:
true
,
sort
:
{
x
:
"
x
"
,
y
:
"
y
"
}
})
]
}
})
})
const
{
data
,
error
}
=
await
useAsyncMeiliSearch
({
index
:
toValue
(
dbName
),
query
:
""
,
params
:
{
facets
:
[
"
*
"
],
filter
:
[
`System='
${
toValue
(
computedSystem
)}
'`
,
...
toValue
(
filterBase
)
],
}
})
if
(
error
.
value
)
{
throw
createError
(
"
Error while getting structure pdocks
"
)
}
</
script
>
<
template
>
<v-card
flat
color=
"transparent"
>
<v-card-text
v-if=
"computedSystem !== null"
v-for=
"option in computedPDocksMatrixPlotOptions"
:key=
"option.legend.label"
>
<PlotFigure
:options=
"unref(option)"
defer
></PlotFigure>
</v-card-text>
</v-card>
</
template
>
\ No newline at end of file
Loading