Skip to content

MeltingCurve

Differential scanning fluorimetry (DSF) melting curves with Tm annotation and derivative view.

Demo

Usage

svelte
<script>
  import { MeltingCurve } from '@molbiohive/hatchlings';
</script>

<MeltingCurve data={meltingCurveData} width={600} height={350} />

Data Type — MeltingCurveData

FieldTypeRequiredDescription
curvesMeltingCurve[]yesMelting curves

Each curve

FieldTypeRequiredDescription
namestringyesCurve name
tempnumber[]yesTemperature values
rationumber[]yesFluorescence ratio
derivativenumber[]yesFirst derivative
tmnumbernoMelting temperature

Props

PropTypeDefaultDescription
dataMeltingCurveDataPrimary data prop
widthnumber500SVG width
heightnumber350SVG height

Example — Constructing Data

ts
import type { MeltingCurveData } from '@molbiohive/hatchlings';

const data: MeltingCurveData = {
  curves: [
    {
      name: 'Protein A',
      temp: Array.from({ length: 80 }, (_, i) => 25 + i),
      ratio: Array.from({ length: 80 }, (_, i) =>
        0.6 + 0.3 / (1 + Math.exp(-(25 + i - 58) / 2))),
      derivative: Array.from({ length: 80 }, (_, i) => {
        const e = Math.exp(-(25 + i - 58) / 2);
        return 0.3 * e / (2 * (1 + e) ** 2);
      }),
      tm: 58,
    },
    {
      name: 'Protein B',
      temp: Array.from({ length: 80 }, (_, i) => 25 + i),
      ratio: Array.from({ length: 80 }, (_, i) =>
        0.55 + 0.35 / (1 + Math.exp(-(25 + i - 72) / 3))),
      derivative: Array.from({ length: 80 }, (_, i) => {
        const e = Math.exp(-(25 + i - 72) / 3);
        return 0.35 * e / (3 * (1 + e) ** 2);
      }),
      tm: 72,
    },
  ],
};

This is the data powering the demo above. See docs/data/charts.ts for the full source.