Why Work With a Small Sample Dataset?

When learning computational biology, one of the biggest challenges is finding a dataset that is large enough to be biologically interesting but small enough to understand manually.

Real genomic datasets can contain thousands or millions of sequences. They are valuable for research, but they can also make it difficult for beginners to understand what is happening at each stage of an analysis.

A small, controlled dataset provides a useful middle ground.

In this resource, we provide a simple multi-FASTA DNA dataset that you can copy, save, and use to practice fundamental computational biology workflows.

The dataset is intentionally small and synthetic. Its purpose is education and experimentation, not biological inference about real organisms.

Learning objective: By the end of this exercise, you should be able to recognize the structure of a FASTA dataset, inspect sequence properties, calculate simple sequence features, and understand how the same sequences can become inputs for different computational analyses.

The Sample Dataset

Below is a small collection of synthetic DNA sequences.

The sequences have been designed to contain recognizable similarities and differences so that you can experiment with sequence comparison and representation methods.

Copy the following text into a plain-text file and save it as:

sample_sequences.fasta
>Sample_01
ATGCGTACGATCGATCGTACGTAGCTAGCTACGATCG

>Sample_02
ATGCGTACGATCGATCGTACGTAGCTAGCTACGATCA

>Sample_03
ATGCGTACGATCGATCGTACGTAGCTAGCTTCGATCA

>Sample_04
ATGCGTACGATCGATCGTACGTAGCTTGCTTCGATCA

>Sample_05
ATGCGTACGATCGATCGTACGTGGCTTGCTTCGATCA

>Sample_06
ATGCGTACGATCGATCGTACGTGGCTTGCTTCGATCG

>Sample_07
ATGCGTACGATCGATCGTTCGTGGCTTGCTTCGATCG

>Sample_08
ATGCGTACGATCGATCGTTCGTGGCTTGCTTCGATCC

>Sample_09
ATGCGTACGATCGATCGTTCGTGGCTTGCTTCGATCT

>Sample_10
ATGCGTACGATCGATCGTTCGTGGCTTGCTTCGATTT

You now have a valid multi-FASTA dataset containing ten sequence records.


Understanding the FASTA Structure

A FASTA file consists of sequence records. Each record begins with a header line beginning with the > character.

For example:

>Sample_01
ATGCGTACGATCGATCGTACGTAGCTAGCTACGATCG

The first line is the identifier:

Sample_01

The second line contains the DNA sequence.

In larger FASTA files, a sequence may span multiple lines. The line breaks are formatting and do not represent biological positions.

The important conceptual structure is:

>Sequence identifier
Sequence

Repeated across many records:

>Sequence_1
ATCG...

>Sequence_2
ATCG...

>Sequence_3
ATCG...

This structure is one of the first things you should become comfortable with when working in bioinformatics.


Exercise 1 β€” Count the Sequences

Before running any sophisticated analysis, start with a simple question:

How many sequences are in the dataset?

You can determine this by counting the FASTA headers.

Every line beginning with:

>

represents the beginning of a sequence record.

For this sample, there are:

10 sequence records

This simple exercise introduces an important principle in computational biology:

Always inspect your data before analyzing it.


Exercise 2 β€” Inspect Sequence Length

Next, determine the length of each sequence.

For a quick manual check, select one sequence and count its nucleotides.

You can also use Python to automate the task.

from pathlib import Path

fasta = Path("sample_sequences.fasta").read_text()

records = fasta.split(">")[1:]

for record in records:
    lines = record.strip().splitlines()
    name = lines[0]
    sequence = "".join(lines[1:])

    print(name, len(sequence))

This produces a simple report showing the identifier and sequence length.

The important programming pattern is:

Read file
   ↓
Separate records
   ↓
Extract identifier
   ↓
Extract sequence
   ↓
Calculate length

This pattern appears repeatedly in biological data processing.


Exercise 3 β€” Calculate GC Content

One of the simplest sequence statistics is GC content.

GC content represents the proportion of nucleotides in a DNA sequence that are either guanine (G) or cytosine (C).

The basic calculation is:

GC content =
(G + C) / sequence length Γ— 100

For example, if a sequence contains 40 nucleotides and 20 of them are G or C:

20 / 40 Γ— 100 = 50%

You can calculate GC content in Python:

def gc_content(sequence):
    sequence = sequence.upper()
    gc = sequence.count("G") + sequence.count("C")
    return (gc / len(sequence)) * 100

sequence = "ATGCGTACGATCGATCGTACGTAGCTAGCTACGATCG"

print(gc_content(sequence))

GC content is a basic statistic, but it illustrates an important idea:

A biological sequence can be transformed into numerical features.

That transformation is a fundamental concept behind computational genomics and machine learning.


Exercise 4 β€” Compare Two Sequences

Now compare Sample_01 and Sample_02.

They are intentionally very similar.

Sample_01
ATGCGTACGATCGATCGTACGTAGCTAGCTACGATCG

Sample_02
ATGCGTACGATCGATCGTACGTAGCTAGCTACGATCA

Notice the difference near the end of the sequences.

This is a simple example of how sequence comparison can reveal substitutions.

You can perform a basic positional comparison in Python:

sequence_a = "ATGCGTACGATCGATCGTACGTAGCTAGCTACGATCG"
sequence_b = "ATGCGTACGATCGATCGTACGTAGCTAGCTACGATCA"

differences = []

for i, (a, b) in enumerate(zip(sequence_a, sequence_b)):
    if a != b:
        differences.append((i + 1, a, b))

print(differences)

The result identifies positions where the two sequences differ.

This is a deliberately simple comparison. Real sequence analysis requires more sophisticated approaches when sequences contain insertions, deletions, rearrangements, or substantial divergence.


Exercise 5 β€” Look at k-mers

Now we can transform the same DNA sequence into a collection of smaller sequence fragments.

These fragments are called k-mers.

For example, using k = 4:

ATCGTACG

becomes:

ATCG
TCGT
CGTA
GTAC
TACG

You can generate k-mers with Python:

sequence = "ATGCGTACGATCGATCGTACGTAGCTAGCTACGATCG"

k = 4

kmers = [
    sequence[i:i+k]
    for i in range(len(sequence) - k + 1)
]

for kmer in kmers:
    print(kmer)

This produces overlapping 4-mers across the sequence.

Now you are no longer treating the DNA as one long string. You are representing it as a collection of smaller sequence patterns.

This idea becomes particularly important when working with large-scale sequence analysis and machine learning.

For a deeper explanation of k-mers, see:

Understanding k-mers: The Foundation of Modern Genome Analysis


Exercise 6 β€” Count k-mer Frequencies

Instead of simply listing k-mers, we can count how frequently each one appears.

from collections import Counter

sequence = "ATGCGTACGATCGATCGTACGTAGCTAGCTACGATCG"

k = 4

kmers = [
    sequence[i:i+k]
    for i in range(len(sequence) - k + 1)
]

counts = Counter(kmers)

for kmer, count in counts.items():
    print(kmer, count)

The output becomes a simple numerical representation of the sequence.

For example:

ATGC    1
TGCG    1
GCGT    1
CGTA    2
...

The exact values depend on the sequence and the value of k.

This is one of the simplest ways to transform DNA into machine-readable features.


Exercise 7 β€” Compare k-mer Profiles

The real power of k-mers becomes more apparent when we compare multiple sequences.

Instead of asking only whether two sequences have the same nucleotides at the same positions, we can ask whether they contain similar collections of sequence patterns.

Conceptually:

Sequence A
      ↓
k-mer counting
      ↓
Numerical profile

Sequence B
      ↓
k-mer counting
      ↓
Numerical profile

Sequence C
      ↓
k-mer counting
      ↓
Numerical profile

The resulting profiles can then be compared mathematically.

This provides the foundation for many alignment-free approaches to biological sequence analysis.


Exercise 8 β€” Visualize the Dataset

Once the sequences have been converted into numerical features, you can begin visualizing the dataset.

For example, you could calculate GC content for every sequence and create a simple bar chart.

import matplotlib.pyplot as plt

names = []
gc_values = []

with open("sample_sequences.fasta") as f:
    records = f.read().split(">")[1:]

for record in records:
    lines = record.strip().splitlines()
    name = lines[0]
    sequence = "".join(lines[1:])

    gc = (
        sequence.count("G") +
        sequence.count("C")
    ) / len(sequence) * 100

    names.append(name)
    gc_values.append(gc)

plt.bar(names, gc_values)
plt.ylabel("GC Content (%)")
plt.xlabel("Sequence")
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()

This is a simple visualization, but the underlying workflow is important:

DNA
 ↓
Feature extraction
 ↓
Numerical values
 ↓
Visualization

The same general pattern appears in much more advanced genomic machine-learning workflows.


Exercise 9 β€” Think About Clustering

The sample sequences were intentionally constructed with gradual differences.

Some sequences are more similar to each other than others.

This means that if we convert the sequences into suitable numerical representations, we can potentially ask:

  • Which sequences are most similar?
  • Do natural groups emerge?
  • Are there outliers?
  • Does the computational grouping agree with what we know about the dataset?

This is the beginning of clustering.

A simplified machine-learning workflow might look like:

FASTA sequences
       ↓
Sequence representation
       ↓
Feature matrix
       ↓
Similarity or distance
       ↓
Clustering
       ↓
Visualization

For real research datasets, clustering results should always be interpreted alongside biological metadata and experimental context.


Exercise 10 β€” Compare Different Representations

One of the most important lessons in computational biology is that there is no single universal representation of biological data.

The same sequence can be represented in many different ways.

Raw sequence

ATGCGTACGATCG...

Composition

A = 0.24
T = 0.26
C = 0.25
G = 0.25

k-mer frequencies

ATCG = 4
CGTA = 7
GTAC = 3
...

Feature vector

[0.24, 0.26, 0.25, 0.25, ...]

Learned embedding

[0.18, -0.42, 0.77, 0.13, ...]

Each representation exposes different information to downstream algorithms.

This is why representation is such an important concept in modern computational biology.


From This Small Dataset to Real Genomics

Although this dataset contains only ten short sequences, the same principles apply to much larger biological datasets.

Imagine replacing the ten sequences with:

  • 10,000 bacterial genomes.
  • 50,000 viral genomes.
  • Millions of metagenomic reads.
  • Thousands of protein sequences.

The basic workflow remains recognizable:

Biological sequences
        ↓
Quality control
        ↓
Representation
        ↓
Similarity / distance
        ↓
Machine learning or statistical analysis
        ↓
Visualization
        ↓
Biological interpretation

The challenge is that computational requirements increase dramatically as datasets grow.

This is one reason researchers continue to explore efficient sequence representations and alignment-free approaches.


Using the Dataset With Traditional Phylogenetics

You can also use the sample dataset to understand a conventional phylogenetic workflow.

The simplified process is:

FASTA sequences
       ↓
Multiple sequence alignment
       ↓
Alignment inspection
       ↓
Phylogenetic inference
       ↓
Tree

For example, after generating an appropriate alignment, a tool such as FastTree can be used to infer a phylogenetic tree.

This provides a useful contrast with alignment-free approaches.

In an alignment-based workflow, positional correspondence between sequences is established before tree inference.

In an alignment-free workflow, sequences can instead be transformed into representations and compared without constructing a traditional multiple sequence alignment.


Using the Dataset to Understand Alignment-Free Analysis

The sample dataset is also useful for understanding the conceptual basis of alignment-free sequence analysis.

Instead of:

FASTA
  ↓
Alignment
  ↓
Tree

you can explore:

FASTA
  ↓
Sequence representation
  ↓
Distance / similarity
  ↓
Clustering
  ↓
Visualization

This does not mean that one workflow is universally better than the other.

They are different analytical strategies with different assumptions and use cases.

The important lesson is to understand what information each representation preserves and what information it may discard.


Using the Dataset for Machine Learning

Once you convert the sequences into numerical features, you can begin experimenting with machine-learning methods.

For example:

FASTA
 ↓
k-mer frequencies
 ↓
Feature matrix
 ↓
PCA
 ↓
2D visualization

You could also experiment with:

  • Hierarchical clustering
  • k-means clustering
  • PCA
  • t-SNE
  • UMAP
  • Nearest-neighbor analysis

Because the dataset is small, it is ideal for understanding these methods without requiring significant computational resources.


Important: This Is a Synthetic Dataset

The sequences in this resource are synthetic examples created for educational purposes.

They should not be interpreted as sequences belonging to real organisms, species, pathogens, genes, or evolutionary lineages.

Likewise, any clusters or relationships you discover in the dataset should not be presented as biological findings.

The purpose of this dataset is to provide a controlled environment for learning how computational methods operate on biological sequence data.

Research note: For research conclusions, replace this educational dataset with appropriately sourced biological data and document the provenance, preprocessing, quality control, and analytical assumptions of the dataset.

Mini Challenge

Now that you have the dataset, try answering the following questions without looking at the answers first:

  1. How many sequences are present?
  2. What is the length of each sequence?
  3. Which sequence has the highest GC content?
  4. Which pair of sequences appears most similar?
  5. How many unique 4-mers occur in Sample_01?
  6. Which 4-mers occur most frequently?
  7. What happens if you change k from 4 to 5?
  8. Does a simple k-mer representation separate the sequences into recognizable groups?
  9. How does your interpretation change if you use nucleotide composition instead of k-mer frequencies?

These questions gradually move from simple data inspection toward the central problem of computational biology:

How does the way we represent biological information affect what an algorithm can discover?


Why Representation Matters

Consider two researchers analyzing exactly the same DNA dataset.

The first researcher uses nucleotide composition.

The second uses k-mer frequencies.

A third researcher uses a learned sequence embedding.

They are all analyzing the same underlying biological sequences, but they may observe different patterns.

This is not necessarily a contradiction.

Each representation exposes different aspects of the data.

This idea becomes increasingly important as computational biology moves from manually engineered features toward machine-learned representations.


How This Connects to ChordexBio

A major focus of ChordexBio is understanding how biological sequences can be represented computationally so that machine-learning methods can work with genomic information at scale.

The small exercises in this dataset introduce the same fundamental concept from a much simpler perspective:

DNA
 ↓
Representation
 ↓
Numerical information
 ↓
Similarity
 ↓
Structure
 ↓
Biological interpretation

ChordexBio's TIPs research explores sequence representation using translation-aware approaches, while Covary applies these ideas to alignment-free genomic analysis.

The objective is not simply to convert DNA into numbers. The deeper question is whether the resulting representation preserves meaningful biological relationships and allows researchers to investigate genomic data in useful ways.

This is one of the central ideas behind modern genomic intelligence.


Suggested Learning Workflow

If you're using this dataset as part of a computational biology course or self-study program, try working through it in the following order:

  1. Open the FASTA file in a text editor.
  2. Identify each sequence record.
  3. Calculate sequence lengths.
  4. Calculate GC content.
  5. Compare sequences directly.
  6. Generate 4-mers.
  7. Calculate k-mer frequencies.
  8. Build a simple feature matrix.
  9. Visualize the feature matrix.
  10. Experiment with clustering or dimensionality reduction.
  11. Compare the results with a traditional alignment-based workflow.

By following these steps, you move from raw biological information toward increasingly abstract computational representations.


Key Takeaways

  • A FASTA file is one of the fundamental data formats in bioinformatics.
  • Even a small DNA dataset can support many different computational analyses.
  • Basic sequence statistics provide a first step toward numerical representation.
  • k-mers provide a simple way to transform DNA into measurable sequence features.
  • Different representations can reveal different patterns in the same biological data.
  • Small synthetic datasets are useful for learning because every step can be inspected manually.
  • Real biological datasets require additional quality control, metadata, and validation.
  • Representation is one of the central concepts connecting classical bioinformatics with modern machine learning.

Continue Learning

Now that you have a small dataset to experiment with, continue with these ChordexBio Learning Hub resources:

Once you're comfortable with these fundamentals, the next step is to move from simple hand-crafted features toward richer representations such as embeddings and machine-learning-based sequence representations.


Final Takeaway

A genome is more than a string of letters.

The moment you transform a sequence into nucleotide frequencies, k-mers, feature vectors, embeddings, or another computational representation, you are making a decision about what information an algorithm will be able to see.

Learning computational biology therefore starts with a deceptively simple question:

How should biological information be represented so that computers can learn from it?

This small FASTA dataset gives you a controlled environment for exploring that questionβ€”and provides a foundation for understanding much larger and more sophisticated genomic analyses.

D
Dexter

Hi, I’m Dexter 😎 I handle resource management at ChordexBioβ€”building tutorials, guides, and technical content that actually make sense. I like breaking down complex ideas into clear, usable write-ups, whether it’s for onboarding, research workflows, or product documentation.