Skip to content

ProteinSequenceViewer

Protein sequence display with amino acid annotations, codon view, and residue coloring.

Demo

Usage

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

<ProteinSequenceViewer data={proteinSeqData} width={700} height={400} />

Data Type — ProteinSequenceData

FieldTypeRequiredDescription
seqstringnoAmino acid sequence
dnaSourcestringnoSource DNA sequence
frame0 | 1 | 2noReading frame
annotationsProteinAnnotation[]noSequence annotations

Props

PropTypeDefaultDescription
dataProteinSequenceDataPrimary data prop
widthnumber700Container width
heightnumberContainer height
showCodonsbooleanShow codon view
colorResiduesbooleanfalseColor amino acids
showNumbersbooleanShow position numbers

Example — Constructing Data

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

const proteinSequenceData: ProteinSequenceData = {
  seq: 'MVLSPADKTNVKAAWGKVGAHAGEYGAEALERMFLSFPTTKTYFPHFDLSH',
  annotations: [
    { name: 'Helix A', type: 'helix', start: 3, end: 18, color: '#e377c2' },
    { name: 'Helix B', type: 'helix', start: 20, end: 35, color: '#ff7f0e' },
    { name: 'Active site', type: 'site', start: 37, end: 38, color: '#d62728' },
    { name: 'Helix C', type: 'helix', start: 40, end: 49, color: '#2ca02c' },
  ],
};

This is the data used in the demo above. See docs/data/protein.ts for the full source.

When dnaSource is provided, the viewer shows codons below each amino acid.