Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Remi PLANEL
bioviz-js
Commits
bae45101
Commit
bae45101
authored
Apr 03, 2019
by
Remi PLANEL
Browse files
Add option to set y position
parent
64dab9b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/scripts/layout/linear-gene.ts
View file @
bae45101
import
{
GeneData
,
PositionedGeneData
}
from
"
../component/sequence/gene
"
;
import
{
scaleLinear
}
from
"
d3-scale
"
;
import
{
extent
}
from
"
d3-array
"
;
import
{
ScaleLinear
}
from
"
d3-scale
"
;
export
default
function
linearGene
(
data
:
Array
<
GeneData
>
,
width
:
number
,
geneOffset
:
number
xScale
:
ScaleLinear
<
number
,
number
>
,
yPosition
:
number
=
20
)
{
const
sequenceInterval
=
extent
(
data
.
reduce
(
(
accum
,
gene
)
=>
[...
accum
,
gene
.
begin
,
gene
.
end
],
[]
as
Array
<
number
>
));
const
xScale
=
scaleLinear
()
.
domain
([
sequenceInterval
[
0
]
||
0
,
sequenceInterval
[
1
]
||
0
])
.
range
([
0
,
width
])
return
data
.
reduce
(
function
(
accum
:
PositionedGeneData
[],
gene
:
GeneData
,
...
...
@@ -28,7 +19,7 @@ export default function linearGene(
...
gene
,
position
:
{
x
,
y
:
0
,
y
:
yPosition
,
width
}
});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment