How do I generate a random dna sequence without specific codons?

6 visualizzazioni (ultimi 30 giorni)
Hi all,
I am trying to figure out how to use randseq to generate a random dna sequence that excludes stop codons TAG, TAA, and TGA. I think it has to do with 'Case', but I am having difficulty finding information elsewhere.
Thank you!

Risposte (1)

Akira Agata
Akira Agata il 7 Mar 2018
randseq function does not have the option to exclude stop codons. The following is one possible solution to generate random sequence without stop codons.
% List of all possible combination
C = {'A','T','G','C'};
[x,y,z] = meshgrid(C,C,C);
list = strcat(x(:), y(:), z(:));
% Delete stop codons from the list
idx = ismember(list,{'TAG','TAA','TGA'});
list(idx) = [];
% Generate random sequence with N codons
N = 10;
idx = randi([1 numel(list)],1,N);
randSeq = [list{idx}];
The result is:
>> randSeq
randSeq =
'TGCATTTACAATGCCTCTCTAATTGAGCGT'
  1 Commento
Akira Agata
Akira Agata il 7 Mar 2018
More simple solution is to use randseq function and erase stop codons, like the following. But please note that this solution can not guarantee the output sequence length.
% Generate random sequence
randSeq = randseq(60);
% Erase stop codons
randSeq = erase(randSeq,{'TAG','TAA','TGA'});

Accedi per commentare.

Categorie

Scopri di più su Strategy & Logic in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by