A Simple Introduction to Read Simulators
By: Vijini Mallawaarachchi
Tags: Simulation, Software, Bioinformatics, Data Science, Science

A Simple Introduction to Read Simulators

Introduction to read simulation tools with examples and usage

Read simulators are widely being used within the research community to create synthetic and mock datasets for analysis. In this article, I will introduce some recently proposed, commonly used read simulators.

Screenshot from running InSilicoSeq

DNA Sequencing and Reads

If you have come across my previous article on DNA Sequence Data Analysis, you may have read about DNA sequencing. Sequencing is the process that determines the precise order of nucleotides of a given DNA molecule. We can determine the order of the four bases adenine, guanine, cytosine and thymine, in a strand of DNA. DNA sequencing is used to determine the sequence of individual genes, full chromosomes or entire genomes of an organism.

Special machines known as sequencing machines are used to extract short random DNA sequences from a particular genome we wish to determine (target genome). Current DNA sequencing technologies cannot read one whole genome at once. It reads small pieces of between 100 and 30,000 bases, depending on the technology used. These short pieces are called reads.

Read Simulators

Sequencing machines may not be available as we wish and we may not be able to get hold of real-world samples to sequence. This is where read simulators come in handy for research purposes. Read simulators can mimic sequencing machines to simulate reads. They have pre-defined statistical models to mimic the error rates relevant to the particular sequencing machines. Furthermore, we can provide our own error models as well (different rates of insertions, deletions and substitutions).

Estimating sequencing coverage

Sequencing coverage is defined as the average number of reads that covers each base of the reference genome. Estimating the sequencing coverage is very important when you are simulating datasets. The coverage equation is defined as follows.

C = LN / G

C is the sequencing coverage

G is the length of the genome

L is the read length

N is the number of reads

For example, if you have a genome of length 5Mbp and you simulate 1,000,000 HiSeq 2000 reads (read length is 100bp), then we will get a sequencing coverage of 20x as follows.

C = LN / G = 100 * 1,000,000 / 5,000,000 = 20x

Here, at least each position of the reference genome is covered by 20 reads.

Estimating Abundance

The abundance of a species in a dataset is considered as the fraction of reads that belong to that species. For example, if there is a dataset with 10,000,000 reads and 1,000,000 of them belong to E. coli, then the abundance of E. coli will be 0.1.

Note that coverage and abundance are not the same.

Short Read Simulators

With the popularity of next-generation sequencing (NGS) technologies, many NGS read simulators have been developed. Currently, many of the popular short read simulators are designed to simulate reads mimicking many Illumina, 454 and SOLiD platforms. Listed below are some popular short read simulators. Links to their publications are provided as well.

Long Read Simulators

With the advancements in sequencing technologies, scientists have shown an increasing interest in using third-generation sequencing (TGS) technologies. Currently, many of the popular long read simulators are designed to simulate reads mimicking the two main TGS technologies; (1) Pacific Biosciences (PacBio) and (2) Oxford Nanopore (ONT). Listed below are some of the popular and recently introduced PacBio and ONT simulators. Links to their publications are provided as well.

PacBio Simulators

ONT Simulators

InSilicoSeq

I have been using InSilicoSeq in my work a lot and I find it very intuitive and easy to use. I will walk you through some sample commands to simulate reads. You can easily install InSilicoSeq using conda or pip .

conda install -c bioconda insilicoseq

OR

pip install InSilicoSeq

Simulate reads by providing the number of reads

Assume that you have a single reference genome and you want to simulate 1 million Illumina MiSeq reads. Given below is a sample command you can run using InSilicoSeq.

iss generate --model miseq --genomes ref.fasta --n_reads 1M --cpus 8 --output reads

Simulate reads by providing the coverage

Assume that you have two reference genome files ref1.fasta and ref2.fasta . You want to simulate 30x coverage from ref1 and 10x coverage from ref2 . You will need to create a tab-separated file named coverages.tsv and add the coverage details as follows.

red1_id 30

ref2_id 10

ref1_id and ref2_id refer to the identifiers of the files ref1.fasta and ref2.fasta . If you download the reference genomes from NCBI, the identifies will consist of letters and numbers and for example, may look something like this NC_007712.1 or CP001844.2 . These identifiers are NCBI accession numbers provided for each reference genome.

Now you can simulate the reads using the following command.

iss generate --model miseq --genomes ref1.fasta ref2.fasta --coverage coverages.tsv --cpus 8 --output reads

Simulate reads by providing the abundance

Assume that you have two reference genome files ref1.fasta and ref2.fasta . You want to simulate 0.4 abundance from ref1 and 0.6 abundance from ref2 . Note that the sum of all the abundance values should be 1.0 . Similar to coverage, you will need to create a tab-separated file named abundance.tsv and add the abundance details as follows.

red1_id 0.4

ref2_id 0.6

Now you can simulate the reads using the following command.

iss generate --model miseq --genomes ref1.fasta ref2.fasta --abundance abundance.txt --cpus 8 --output reads

You can read more details from the InSilicoSeq documentation.

PBSIM

PBSIM is a PacBio reads simulator which provides both sampling-based and model-based simulations. I will walk you through some sample commands to simulate reads using PBSIM.

Model-based simulation

For model-based simulation, you can run the following command.

pbsim --data-type CLR --depth 100 --length-min 10000 --length-max 20000 --prefix test --model_qc data/model_qc_clr ref.fasta

The model can be found in the PBSIM folder PBSIM-PacBio-Simulator/data/model_qc_clr . The data type CLR refers to Continuous Long Read which simulates long and high error rates. The other data type CCS refers to Circular consensus Read which simulates short and low error rates.

Sampling-based simulation

For sampling-based simulation, you can run the following command.

pbsim --data-type CLR --depth 100 --sample-fastq sample/sample.fastq sample/sample.fasta

The sample FASTQ file can be found in the PBSIM folder PBSIM-PacBio-Simulator/sample/sample.fastq . You can use your own FASTQ file as well.

You can read more details from the PBSIM documentation.

SimLoRD

SimLoRD is a TGS read simulator based on the Pacific Biosciences SMRT error model. I have frequently used SimLoRD to simulate PacBio datasets for my work. I will walk you through some sample commands to simulate reads using SimLoRD.

Simulate fixed-length reads by providing the number of reads

Assume that you have a reference genome and you want to simulate fixed-length reads with 60x coverage. Given below is a sample command you can run using SimLoRD.

simlord --read-reference ref.fasta --coverage 60 --fixed-readlength 5000 output_prefix

Simulate fixed-length reads by providing the coverage

Assume that you have a reference genome and you want to simulate 2000 fixed-length reads. Given below is a sample command you can run using SimLoRD.

simlord --read-reference ref.fasta --num-reads 2000 --fixed-readlength 5000 output_prefix

You can also set a minimum length for the reads using the --min-readlength parameter during the simulation. You can read more from the SimLoRD documentation.

Final Thoughts

Read simulators have given us the opportunity to simulate reads ranging from zero errors to very high error rates. Also, they have allowed us to create synthetic and mock datasets mimicking different sequencing machines and different species compositions.

Hope you found this article useful and informative as a starting point towards using read simulators. Feel free to use these tools for your projects and research work as they are freely available.

Cheers, and stay safe!