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

6 ビュー (過去 30 日間)
Luke Lonershman
Luke Lonershman 2018 年 3 月 6 日
コメント済み: Akira Agata 2018 年 3 月 7 日
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 Center および File ExchangeStrategy & Logic についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by