Get started with dna.js CDN

MIT licensed

DNA.js: library for DNA sequence manipulation, visualization.

Tags:
  • clone
  • dom
  • engine
  • html
  • jquery
  • json
  • template
  • templating
  • ui

Stable version

Copied!

How to start using dna.js CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with dna.js CDN - cdnhub.io</title>
    <script src="https://cdn.cdnhub.io/dna.js/3.1.0/dna.min.js"></script>
</head>
<body>
    <script>
        // Create a new DNA strand
        const dnaStrand = new DNA('ATGCGGTCTAGCTAGCTAGCTAGCT');

        // Perform a point mutation
        dnaStrand.mutate();

        // Get the new DNA sequence
        const newDnaSequence = dnaStrand.getSequence();

        console.log('Original DNA sequence:', dnaStrand.getSequence());
        console.log('New DNA sequence after mutation:', newDnaSequence);

        // Perform a crossover with another DNA strand
        const dnaStrand2 = new DNA('CGTAGCTAGCTAGCTAGCTAGCTAGCT');
        const childDna = dnaStrand.crossover(dnaStrand2);

        console.log('Child DNA sequence after crossover:', childDna.getSequence());
    </script>
</body>
</html>

All versions