Skip to content

Gene Tooltip Configuration Reference โ€‹

This package uses a single configuration object (GeneTooltipConfig) to control all aspects of tooltip rendering, data fetching, and display behavior.
You can pass this object when initializing your tooltip instance.

Example:

ts
import { defaultConfig } from 'gene-tooltips';

const config = {
  ...defaultConfig,
  truncateSummary: 3,
  pathwaySource: 'reactome',
  theme: 'auto',
};

new GeneTooltip(config);

๐Ÿงฉ Top-Level Configuration Options โ€‹

selector โ€‹

  • Type: string
  • Default: '.gene-tooltip'
  • CSS selector used to find gene elements to attach tooltips to.

api โ€‹

  • Type: 'mygene'
  • Default: 'mygene'
  • Specifies which backend API to use (currently only mygene.info supported).

prefetch โ€‹

  • Type: 'smart' | 'all' | 'none'
  • Default: 'smart'
  • Controls when gene data is prefetched:
    • 'smart' โ€“ only prefetch visible or soon-to-be-visible tooltips.
    • 'all' โ€“ prefetch all tooltip data immediately.
    • 'none' โ€“ fetch data only when a tooltip is opened.

prefetchThreshold โ€‹

  • Type: number
  • Default: 15
  • Number of tooltip elements to trigger prefetching behavior.

truncateSummary โ€‹

  • Type: number
  • Default: 4
  • Maximum number of sentences to display in a gene summary.

theme โ€‹

  • Type: string
  • Default: 'auto'
  • Tooltip theme. Accepts "light", "dark", "auto", or a custom Tippy.js theme name.

tooltipWidth โ€‹

  • Type: number (optional)
  • Sets a fixed width (in pixels) for the tooltip container.

tooltipHeight โ€‹

  • Type: number (optional)
  • Sets a fixed height (in pixels) for the tooltip container.

๐ŸŽจ Display Configuration (display) โ€‹

Control which content sections are shown in the tooltip.

display โ€‹

  • Type: Partial<TooltipDisplayConfig>
  • Default:
    ts
    {
      species: true,
      location: true,
      ideogram: true,
      pathways: true,
      domains: true,
      geneTrack: true,
      transcripts: true,
      structures: true,
      generifs: true,
      links: {
        ncbi: true,
        ensembl: true,
        wikipedia: true,
      },
    }

Available options:

OptionTypeDefaultDescription
speciesbooleantrueShow species name and taxonomy info.
locationbooleantrueShow genomic coordinates (chromosome, start, end).
ideogrambooleantrueShow chromosome ideogram visualization.
pathwaysbooleantrueShow associated biological pathways.
domainsbooleantrueShow InterPro protein domains.
geneTrackbooleantrueShow gene track visualization (exons/introns).
transcriptsbooleantrueShow transcript information (e.g., ENSEMBL IDs).
structuresbooleantrueShow PDB or 3D structure references.
generifsbooleantrueShow GeneRIF functional annotations.
links.ncbibooleantrueShow link to NCBI Gene page.
links.ensemblbooleantrueShow link to ENSEMBL Gene page.
links.wikipediabooleantrueShow link to Wikipedia.

๐Ÿงฌ Ideogram Configuration (ideogram) โ€‹

Controls the small chromosome ideogram visualization.

ideogram โ€‹

  • Type: Partial<IdeogramConfig>
  • Default:
    ts
    {
      enabled: true,
      height: 100,
      showLabels: false,
    }

Available options:

OptionTypeDefaultDescription
enabledbooleantrueToggle ideogram display.
widthnumbernoneSet custom width in pixels.
heightnumber100Set height of the ideogram in pixels.
showLabelsbooleanfalseShow chromosome labels.

๐Ÿงฌ Pathway Configuration โ€‹

pathwaySource โ€‹

  • Type: 'reactome' | 'kegg' | 'wikipathways'
  • Default: 'kegg'
  • Which pathway source to display when multiple are available.

pathwayCount โ€‹

  • Type: number
  • Default: 3
  • Maximum number of pathways to display.

๐Ÿงฌ Domain and Structure Settings โ€‹

OptionTypeDefaultDescription
domainCountnumber3Maximum number of InterPro domains to show.
structureCountnumber3Maximum number of protein structures (PDB) to show.

๐Ÿงฌ Transcript and GeneRIF Settings โ€‹

OptionTypeDefaultDescription
transcriptCountnumber3Maximum number of transcripts to show.
generifCountnumber3Maximum number of GeneRIF annotations to show.

๐Ÿ’ฌ Tippy.js Options (tippyOptions) โ€‹

Pass any subset of Tippy.js options to customize tooltip behavior.

Default: โ€‹

ts
{
  allowHTML: true,
  interactive: true,
  placement: 'bottom',
}

Common overrides:

OptionTypeDescription
placement'top' | 'bottom' | 'left' | 'right'Tooltip placement relative to target.
delay[number, number]Delay for showing/hiding tooltips.
themestringName of a Tippy.js theme.
maxWidthnumberMaximum tooltip width in pixels.

๐Ÿงพ Complete Prop Reference โ€‹

PropertyTypeDefaultDescription
selectorstring'.gene-tooltip'CSS selector for tooltip targets.
api'mygene''mygene'Backend API source.
prefetch'smart' | 'all' | 'none''smart'Prefetching behavior.
prefetchThresholdnumber15Number of elements before prefetching triggers.
truncateSummarynumber4Number of sentences to show in gene summary.
themestring'auto'Tooltip theme.
tooltipWidthnumberโ€”Fixed width (px).
tooltipHeightnumberโ€”Fixed height (px).
displayPartial<TooltipDisplayConfig>(see defaults above)Controls which sections are visible.
ideogramPartial<IdeogramConfig>(see defaults above)Controls ideogram appearance.
pathwaySource'reactome' | 'kegg' | 'wikipathways''kegg'Pathway source.
pathwayCountnumber3Number of pathways to show.
domainCountnumber3Number of InterPro domains to show.
transcriptCountnumber3Number of transcripts to show.
structureCountnumber3Number of PDB structures to show.
generifCountnumber3Number of GeneRIF annotations to show.
tippyOptionsPartial<Props>{ allowHTML: true, interactive: true, placement: 'bottom' }Tooltip behavior and styling.

๐Ÿ”ง Example Minimal Override โ€‹

ts
new GeneTooltip({
  selector: '.gene',
  theme: 'dark',
  pathwaySource: 'reactome',
  display: { domains: false, generifs: false },
});