Commit bae45101 authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

Add option to set y position

parent 64dab9b3
import { GeneData, PositionedGeneData } from "../component/sequence/gene"; import { GeneData, PositionedGeneData } from "../component/sequence/gene";
import { scaleLinear } from "d3-scale";
import { extent } from "d3-array"; import { extent } from "d3-array";
import { ScaleLinear } from "d3-scale";
export default function linearGene( export default function linearGene(
data: Array<GeneData>, data: Array<GeneData>,
width: number, xScale: ScaleLinear<number, number>,
geneOffset: 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 ( return data.reduce(function (
accum: PositionedGeneData[], accum: PositionedGeneData[],
gene: GeneData, gene: GeneData,
...@@ -28,7 +19,7 @@ export default function linearGene( ...@@ -28,7 +19,7 @@ export default function linearGene(
...gene, ...gene,
position: { position: {
x, x,
y: 0, y: yPosition,
width width
} }
}); });
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment