Biosciences: Genetics

This is an interactive courseware module that teaches the basics of genetics.
Updated 30 Apr 2024

Biosciences: Genetics

View Module on File Exchange or Open in MATLAB Online

This curriculum module teaches students the basic concepts involved in computational genetics.


In this module, we will learn how to use MATLAB to analyze genetic data. We will calculate the statistics of a single DNA sequence, use real genetic data to create a phylogenetic tree, and explore within-species genetic variation. Make sure you're familiar with the basics of using MATLAB by going through the MATLAB Onramp before continuing.

This module utilizes data pulled from GenBank, the NIH's library of publicly available genetic sequences.

A 3-dimensional model of DNA


This module assumes basic MATLAB knowledge and it is recommended that all students take the MATLAB Onramp.

Getting Started

To learn more about opening and using MATLAB, see the accompanying Getting Started guide.


Notes: These scripts can all be run independently, though we recommend going through these live scripts in order. These live scripts are intended to be used with output inline. To change the output, go to the View tab of the toolstrip, and select Output Inline. The scripts have areas for the students to interact with the code . There will also be exercises in most scripts and the answers will be provided at the end. A problem set for students to practice these concepts is also included here. Throughout the scripts, there are also moments to students to reflect on what they've learned or on what the data means . Particularly interesting examples of how these concepts are used in "real-world" biology are also pointed out .


  • Learning objective: Students will learn about how computation is used in genetics.

Explore a single DNA sequence

  • Learning objective: Students will learn to import and analyze DNA sequences in MATLAB, and visualize nucleotide content.

Comparative genetics

  • Learning objective: Students will calculate genetic distances between species, visualize genetic distance using phylogenetic trees, and use the data to interpret evolutionary relationships.

Population genetics

  • Learning objective: Students will visualize genetic differences within a population using dimensionality reduction.

Problem set

Related Courseware Modules

Link to 5 other modules here once set up.


MATLAB®, Bioinformatics Toolbox™, Statistics and Machine Learning Toolbox™


The License for this project is in the License.txt file in this repository.

© Copyright 2023 The MathWorks, Inc.

Cite As

Emma Smith Zbarsky (2024). Biosciences: Genetics (, GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2023a
Compatible with R2023a and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Versions that use the GitHub default branch cannot be downloaded

Version Published Release Notes

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.