vibesketch.document.sequences

Peptides and nucleic acids from a sequence or HELM, as ordinary structures (#98).

A one-letter sequence or a HELM string becomes the full skeletal structure, which is then an ordinary species: it is laid out, exported and calculated like any other. RDKit builds both, with MolFromSequence and MolFromHELM; this module checks the letters first, so a refusal names the residue and its position instead of RDKit’s silent failure.

HELM is Pistoia Alliance’s Hierarchical Editing Language for Macromolecules: Zhang et al., J. Chem. Inf. Model. 2012, 52, 2796 (doi:10.1021/ci3001925).

Module Attributes

SEQUENCE_FORMATS

The import formats of this module.

ALPHABETS

the 20 standard amino acids, L, and the four bases of DNA or RNA.

MAX_RESIDUES

The longest sequence read; longer ones exceed the layout limit anyway.

Functions

helm_molecules(text)

One molecule per HELM string in text, one per line.

helm_of(mol)

The HELM of a molecule RDKit built from a sequence or HELM.

plain_sequence(helm)

The kind and one-letter sequence of helm, or None if it says more.

printed(helm)

helm as a figure prints it: H-Tyr-D-Ala-Gly-OH, 5'-ACGU-3' or 5'-d(ACGT)-3'.

sequence_export(document, fmt)

Every species as HELM, one per line, or as FASTA records headed by its label or id.

sequence_molecules(text, kind)

One molecule per sequence in text: one per line, or FASTA records.

with_sequences(document, molecules)

document with each species built from one of molecules recording its HELM.

Classes

Printed(text[, spans, bridges, chains, links])

A sequence as a figure prints it, with what it draws above the text.

Exceptions

SequenceRefused

The text is not a sequence of the stated kind.

vibesketch.document.sequences.ALPHABETS: dict[str, str] = {'dna': 'ACGT', 'peptide': 'ACDEFGHIKLMNPQRSTVWY', 'rna': 'ACGU'}

the 20 standard amino acids, L, and the four bases of DNA or RNA.

Type:

The one-letter codes each kind takes

vibesketch.document.sequences.MAX_RESIDUES = 2500

The longest sequence read; longer ones exceed the layout limit anyway.

vibesketch.document.sequences.SEQUENCE_FORMATS: tuple[str, ...] = ('peptide', 'dna', 'rna', 'helm')

The import formats of this module.

class vibesketch.document.sequences.Printed(text, spans=(), bridges=(), chains=(), links=())[source]

Bases: object

A sequence as a figure prints it, with what it draws above the text.

A peptide of several chains is its first chain here, the others in chains, each printed on a line of its own below the one before.

Parameters:
text: str
spans: tuple[tuple[int, int], ...] = ()

Per residue of a peptide, the start and end of its symbol in text.

bridges: tuple[tuple[int, int], ...] = ()

Disulfide bridges, as pairs of residue indices into spans, first < second.

chains: tuple[Printed, ...] = ()

The chains after the first, in the order of the HELM.

Disulfides between chains, as (chain, residue) pairs, the earlier chain first; chain 0 is this one and chain n is chains[n - 1].

exception vibesketch.document.sequences.SequenceRefused[source]

Bases: ValueError

The text is not a sequence of the stated kind.

vibesketch.document.sequences.helm_of(mol)[source]

The HELM of a molecule RDKit built from a sequence or HELM.

RDKit’s own HELM where it writes one; RDKit reads some monomers it does not write (Sar, Abu, D-Thr, D-Ile in 2026.09), and those keep the HELM they were read from.

Parameters:

mol (Any)

Return type:

str

vibesketch.document.sequences.helm_molecules(text)[source]

One molecule per HELM string in text, one per line.

Parameters:

text (str)

Return type:

list[Any]

vibesketch.document.sequences.plain_sequence(helm)[source]

The kind and one-letter sequence of helm, or None if it says more.

A HELM is plain when it is one chain of standard residues without links: exactly what that one-letter sequence builds again. D-amino acids, other monomers, links such as disulfides and several chains are not.

Parameters:

helm (str)

Return type:

tuple[Literal[‘peptide’, ‘dna’, ‘rna’], str] | None

vibesketch.document.sequences.printed(helm)[source]

helm as a figure prints it: H-Tyr-D-Ala-Gly-OH, 5’-ACGU-3’ or 5’-d(ACGT)-3’.

Peptides take IUPAC’s three-letter symbols with their termini, D-amino acids prefixed D- and the less common ones by their own symbols, and a disulfide as a bridge above the two cysteines, as “Nomenclature and symbolism for amino acids and peptides” (IUPAC-IUB JCBN 1983) draws cystine. A peptide of several chains, such as insulin, prints each on a line of its own, with a line joining the cysteines of each disulfide between two chains. Nucleic acids take their one-letter bases, 5’ to 3’, DNA marked d( ) as in IUPAC-IUB CBN’s “Abbreviations and symbols for nucleic acids, polynucleotides and their constituents” (1970).

Parameters:

helm (str)

Return type:

Printed

vibesketch.document.sequences.sequence_export(document, fmt)[source]

Every species as HELM, one per line, or as FASTA records headed by its label or id.

Parameters:
Return type:

str

vibesketch.document.sequences.sequence_molecules(text, kind)[source]

One molecule per sequence in text: one per line, or FASTA records.

Letters may be in either case and spaced or numbered as in GenBank, so acgt acgt and 1 ACGT both read; anything else is refused.

Parameters:
  • text (str)

  • kind (Literal['peptide', 'dna', 'rna'])

Return type:

list[Any]

vibesketch.document.sequences.with_sequences(document, molecules)[source]

document with each species built from one of molecules recording its HELM.

Parameters:
Return type:

Document