Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Wiki
Manage
Activity
Members
Labels
Plan
Issues
53
Issue boards
Milestones
Wiki
Code
Merge requests
6
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Commits
d6d864a1
Commit
d6d864a1
authored
11 months ago
by
Remi PLANEL
Browse files
Options
Downloads
Patches
Plain Diff
handle inner padding better
parent
43f458a3
No related branches found
No related tags found
No related merge requests found
Pipeline
#129914
waiting for manual action with stages
in 6 minutes and 35 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/OperonStructure.vue
+37
-22
37 additions, 22 deletions
components/OperonStructure.vue
with
37 additions
and
22 deletions
components/OperonStructure.vue
+
37
−
22
View file @
d6d864a1
...
...
@@ -33,23 +33,46 @@ const margin = ref<PlotMargin>({
const
gbContainer
=
ref
(
null
)
const
geneToHighlight
=
ref
<
string
|
null
>
(
null
)
const
snackbar
=
ref
(
false
)
const
innerPaddingRatio
=
ref
<
number
>
(
0.1
)
// const color = d3.scaleOrdinal(d3.schemeCategory10);
const
domain
=
computed
(()
=>
{
const
genes
=
toValue
(
computedGenes
)
return
genes
?.
map
(
d
=>
{
return
d
.
gene
})
})
const
innerPadding
=
ref
<
number
>
(
30
)
const
totalGeneLength
=
computed
(()
=>
{
const
genes
=
toValue
(
computedGenes
)
return
genes
.
reduce
((
acc
,
curr
)
=>
{
return
acc
+
(
curr
?.
size
??
10
)
},
0
)
+
innerPadding
.
value
*
(
genes
.
length
-
1
)
},
0
)
})
const
innerPadding
=
computed
(()
=>
{
const
totalGeneLengthVal
=
toValue
(
totalGeneLength
)
const
genes
=
toValue
(
computedGenes
)
let
innerPadding
=
innerPaddingRatio
.
value
if
(
genes
.
length
===
1
)
innerPadding
=
0
return
totalGeneLengthVal
*
innerPadding
})
const
innerPaddingpPerGene
=
computed
(()
=>
{
const
genes
=
toValue
(
computedGenes
)
const
innerPaddingVal
=
toValue
(
innerPadding
)
return
innerPaddingVal
/
genes
.
length
})
const
totalGeneLengthWithPadding
=
computed
(()
=>
{
const
totalGeneLengthVal
=
toValue
(
totalGeneLength
)
return
totalGeneLengthVal
+
innerPadding
.
value
})
const
domainGenes
=
computed
(()
=>
{
return
[
0
,
totalGeneLength
.
value
]
return
[
0
,
totalGeneLengthWithPadding
.
value
]
// return [0, totalGeneLength.value]
})
const
xScale
=
computed
(()
=>
{
return
d3
.
scaleBand
()
...
...
@@ -76,14 +99,15 @@ const computedGenes = computed<StructureOperonGene[]>(() => {
const
genes
=
toValue
(
genesProps
)
if
(
genes
!==
null
&&
genes
?.
length
>
0
)
{
let
currentSumSize
=
0
return
genes
.
map
((
d
,
i
)
=>
{
return
genes
.
map
((
d
,
i
)
=>
{
const
size
=
d
?.
size
??
10
const
position
=
currentSumSize
currentSumSize
=
position
+
size
+
innerPadding
.
value
// const position = currentSumSize
// currentSumSize = position + size
// // + innerPaddingpPerGene.value
return
{
...
d
,
size
,
position
,
//
position,
highlight
:
geneToHighlight
.
value
===
d
.
gene
}
})
...
...
@@ -105,32 +129,23 @@ const structureVersion = computed(() => {
const
geneNodes
=
computed
<
StructureOperonGeneWithCoordinate
[]
>
(()
=>
{
const
genes
=
toValue
(
computedGenes
)
const
xScaleVal
=
toValue
(
xScaleGenes
)
const
innerPaddingpPerGeneVal
=
toValue
(
innerPaddingpPerGene
)
// const yScaleVal = toValue(yScale)
if
(
genes
!==
null
)
{
let
currentSumSize
=
0
return
genes
.
map
(
d
=>
{
const
x
=
xScaleVal
(
d
.
position
)
// const y = yScaleVal('gene')
const
width
=
xScaleVal
(
d
.
size
)
// let rotate = 0
// let labelWidth = (d.gene.length * textSizeRatio.value) / Math.sqrt(2)
// let labelHeight = labelWidth
// if (width
<
labelWidth
)
{
// // need to increase angle
// rotate = 90
// labelHeight = labelWidth
// labelWidth = 16
// }
const
position
=
currentSumSize
const
x
=
xScaleVal
(
position
)
currentSumSize
=
position
+
d
.
size
+
innerPaddingpPerGeneVal
return
{
...
d
,
width
,
position
,
x
,
// rotate: 0,
// labelWidth,
labelHeight
:
150
,
y
:
0
,
// y: y === undefined ? 0 : y,
height
:
0
// height: yScaleVal.bandwidth()
}
})
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment