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

6 次查看(过去 30 天)
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!

回答(1 个)

Akira Agata
Akira Agata 2018-3-7
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 个评论
Akira Agata
Akira Agata 2018-3-7
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'});

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Strategy & Logic 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by