Vue Component to display genes.
npm install @lipme/gene-map-componentVue Component to display genes.
GeneMapComponent is a Vue component designed to visualize gene data in a structured and interactive manner. It supports features like compressed views, pagination, highlighting regions, and exporting visualizations as images.
- Visualize gene data with customizable labels, tooltips, and links.
- Support for compressed and paginated views.
- Highlight specific regions of interest.
- Export the visualization as an image.
- Fully configurable dimensions and layout.
- Type: (x: GeneData) => string
- Description: A function to define how each gene should be labeled.
- Default: Returns the Name attribute of the gene.
- Example:
``typescript`
label: (gene) => gene.attributes!.Name![0] || 'Unnamed Gene'
- Type: (x: GeneData) => string | undefinedundefined
- Description: A function to generate a URL for each gene, used for redirection when a gene is clicked.
- Default:
- Example:
`typescripthttps://example.com/gene/${gene.attributes!.ID![0]}
linksGenerator: (gene) => `
- Type: (x: GeneData) => stringAlias
- Description: A function to define the tooltip content for each gene.
- Default: Returns the attribute of the gene if available.
- Example:
`typescriptGene: ${gene.attributes!.Alias![0]}
tooltip: (gene) => `
- Type: RegionInputType | PaginationInputType
- Description: Specifies the region or pagination configuration for gene display.
- Required: Yes
- Types:
- RegionInputType: For displaying a specific region
`typescript`
{
seqID: string;
start: number;
end: number;
compressed?: {
offset: number;
};
}
- PaginationInputType: For paginated display
`typescript`
{
seqID: string
index: number
config: {
numberOfRows: number
}
}
- Examples:
- Region view:
`typescript`
selection: {
seqID: 'chromosome1',
start: 1000,
end: 5000,
compressed: { offset: 50 }
}
- Paginated view:
`typescript`
selection: {
seqID: 'chromosome1',
index: 2,
config: { numberOfRows: 8 }
}
- Type: string
- Description: The HTTP source of the GFF3 file containing gene data.
- Example:
`typescript`
fileUrl: 'https://example.com/data/genes.gff3'
- Type: booleantrue
- Description: Whether to display the legend in the visualization.
- Default:
- Type: string | undefinedfileUrl
- Description: The index file URL for the GFF3 file. Defaults to the with .tbi appended.undefined
- Default:
- Type: ColorService
- Description: A service to manage color schemes for the visualization.
- Example:
`typescript`
import { ColorService } from '@lipme/gffcolors'
const colors = new ColorService()
- Type: Array<[number, number]> | undefinedundefined
- Description: An array of regions to highlight in the visualization.
- Default:
- Example:
`typescript`
highlight: [
[1000, 2000],
[3000, 4000]
]
- Type: { width: number; height: number; rowSize: number }width
- Description: Configuration for the visualization layout.
- : Width of the visualization in pixels.height
- : Height of the visualization in pixels.rowSize
- : Size of each level.{ width: 1000, height: 800, rowSize: 30000 }
- Default:
- Example:
`typescript`
config: { width: 1200, height: 900, rowSize: 20000 }
- Type: (value: GeneData) => void
- Description: Emitted when a gene is selected (clicked).
- Example:
`html`
- Props: { screenshotFunction: () => void }
- Description: Slot to provide a custom button or UI for exporting the visualization as an image.
- Example:
`html`
`vue
:colors="colorService"
:selection="{
seqID: 'chromosome1',
start: 1000,
end: 5000
}"
/>
`
`vue
:colors="colorService"
:selection="{
seqID: 'chromosome1',
index: 2,
config: { numberOfRows: 8 }
}"
:config="{ width: 1200, height: 800, rowSize: 10000 }"
/>
`
`vue
:colors="colorService"
:selection="{
seqID: 'chromosome1',
start: 1000,
end: 5000,
compressed: { offset: 50 }
}"
:highlight="[
[1500, 2500],
[3000, 4000]
]"
:config="{ width: 1200, height: 800, rowSize: 10000 }"
/>
`
`vue
:colors="colorService"
:selection="{
seqID: 'chromosome1',
start: 1000,
end: 5000
}"
:label="customLabel"
:tooltip="customTooltip"
:linksGenerator="generateLink"
>
`
VSCode + Volar (and disable Vetur).
Imports in TSTypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need Volar to make the TypeScript language service aware of .vue types.
See Vite Configuration Reference.
`sh`
npm install
`sh`
npm run dev
`sh`
npm run build
`sh`
npm run test:unit
`sh`
npm run test:e2e:dev
This runs the end-to-end tests against the Vite development server.
It is much faster than the production build.
But it's still recommended to test the production build with test:e2e before deploying (e.g. in CI environments):
`sh`
npm run build
npm run test:e2e
`sh``
npm run lint