Generate Sequences

Note

Settings provided in the settings.json file have an influence over all sequences generated. See the Settings File documentation page for more information.

Note

All sequence pools generated below contain distinct sequences. There are no duplicated sequences.

First activate the Python virtual environment (if not already activated):

cd origami
source venv/bin/activate
cd poolgen

DeBruijn Sequences

A DeBruijn sequence generator is included in poolgen. The source code is kindly provided by the authors of paper Designing Uniquely Addressable Bio-orthogonal Synthetic Scaffolds for DNA and RNA Origami (2017).

For an intuitive definition, a DeBruijn DNA sequence of order k is a circular sequence of length 4^k bases with the following special property: a window of length k (or larger) will never frame the same sequence fragment twice when it is moved along the sequence. That is to say, each k-mer appears exactly once in the sequence.

The diagram below shows a DNA DeBruijn sequence of order k=3. As you slide at 3-letter window around the sequence, no 3-letter sequence e.g. “TGC”, appears more than once. The sequence has size 4^3 = 64 bases.

k=3 circular DBS sequence of 64 bases

To generate a pool of DNA DeBruijn sequences, the syntax is:

python3 generate.py <total sequences> dbsdna <sequence length> <output file>

For example:

python3 generate.py 100 dbsdna 2000 dbs.csv

will generate 100 DeBruijn sequences of DNA, where each sequence has length 2000nt. Sequences are saved to _assets/dbs.csv. Similarly:

python3 generate.py 100 dbsrna 2000 dbs.csv

will generate 100 DeBruijn sequences of RNA. All generated sequences are unique.

Note that the DeBruijn sequence order k is defined automatically from the sequence length that you specify. The lowest order k is used, as shown in the table below:

DeBruijn order k

Used for sequence lengths

8

16385nt to 65536nt

7

4097nt to 16384nt

6

1025nt to 4096nt

5

257nt to 1024nt

4

65nt to 256nt

Technical note: If the sequence length requested is not an exact power of 4, then the DeBruijn sequence returned may not satisfy the exact DeBruijn property when circularised.

Random Sequences

A pool of DNA sequences with base letters chosen from a uniform random distribution (all base letters equally likely) can be generated by using the following syntax:

python3 generate.py <total sequences> randomdna <sequence length> <output file>

For example:

python3 generate.py 1000 randomdna 7249 random.csv

will generate 1000 random DNA sequences each 7249nt long, and save the results to _assets/random.csv.

Similarly, random RNA sequences can be generated by:

python3 generate.py 1000 randomrna 7249 random.csv

Sequences ‘Cut Out’ from Larger Biological Vector Sequences

When supplied with a set of larger biological vector sequences (phage genome sequences or plasmid sequences for example) then poolgen can generate a pool of fixed length sequences by ‘cutting out’ contiguous regions of these vectors. All valid cut-out regions across all vectors have an equal probability of being sampled (longer vectors will be used more frequently than shorter vectors). Also, the linear or circular nature of each vector sequence is taken into account when cutting out sequence regions.

The syntax is:

python3 generate.py <total sequences> <vector sequences file> <sequence length> <output file>

For example:

python3 generate.py 300 vectors_available.csv 2484 vec.csv

will generate 300 sequences by randomly selecting and ‘cutting out’ regions of vector sequences supplied in _assets/vectors_available.csv where each sequence cut out is 2484 nt long. The final sequences are saved to _assets/vec.csv. Only those vectors of 2484nt or longer are used for cut outs.

The input vectors_available.csv file has a simple format, as shown in this example file containing five biological vector sequences. Each line of the file should contain three pieces of data, separated by commas:

Vector Name

LINEAR or CIRCULAR keyword

Vector Sequence 5’ to 3’

Note

It is not always possible to create the number of sequences specified. The maximal number of unique sequences possible is reported by the program.

Note

Sequences are only ‘cut out’ from the vector sequences listed. If a vector is double stranded DNA and cut-outs from both the sense and anti-sense strands are required, then the anti-sense strand should be added as a separate vector sequence in the vectors_available.csv file.

Note

NEB maintains a useful page of vector sequences here.