ts-dna
TypeScript icon, indicating that this package has built-in type declarations

0.7.1 • Public • Published

ts-dna

A simple typescript utility library for working with nucleic acids, amino acids, and polypeptides. Going from DNA -> RNA -> Polypeptides has never been easier!

Description

ts-dna aims to model and offer utilities for the biological relationship between nucleic acids, amino acids, and polypeptides. All classes are immutable, and validation is enforced on construction. Therefor, all instances of the classes will always be valid once constructed. ts-dna is a zero dependency library.

Installing

npm:

npm install ts-dna

yarn:

yarn add ts-dna

Library Documentation

Check out the full library documentation here.

Examples

Below are some very brief (and contrived) examples of how some of this library's classes and its utilities might be used.

//Create complex IUPAC nucleotide symbol pattern regular expressions
const nucleotidePattern = new NucleotidePattern('^N*Y?A+(WY){3}$');
const dnaMatch = new DNA('ATCGATCGATCGATCGCAAAACTCTC');
nucleotidePattern.matches(dnaMatch); // --> true
nucleotidePattern.patternRegex; // --> '^[AaGgCcTt]*[CcTt]?[Aa]+([AaTt][CcTt]){3}$'

//Go from DNA -> RNA -> Polypeptide
const dna = new DNA('ATGTGCGACGAATTC');
const rna = convertToRNA(dna);
const polypeptide = new Polypeptide(rna);


//Get and compare amino acids
const met1 = getAminoAcidByCodon(new RNA('AUG'));
const met2 = new AminoAcid(new RNA('AUG'));
met1?.equals(met2); // --> true

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Package Sidebar

Install

npm i ts-dna

Weekly Downloads

13

Version

0.7.1

License

MIT

Unpacked Size

69.6 kB

Total Files

36

Last publish

Collaborators

  • neilcochran