calculate the number of times each codon appears in a .mat file

4 ビュー (過去 30 日間)
Tahir Detinis Zur
Tahir Detinis Zur 2022 年 2 月 28 日
コメント済み: Ive J 2022 年 3 月 1 日
Hello,
I have an assignment that involves a given mat file. each row in the file is composed of a DNA sequence and the task is to find for each sequence the number of times each codon appears in it. I have very basic knowledge in MATLAB . Can someone help me solve it?
Thank you!!!

回答 (1 件)

Ive J
Ive J 2022 年 2 月 28 日
Maybe this example would help:
% create a random DNA seq
dna_codes = ['A', 'T', 'G', 'C'];
dna_str = string(dna_codes(randi(numel(dna_codes),1, 1000)));
count(dna_str, 'ATG') % count how many times ATG codon (M) has been repeated
ans = 20
  2 件のコメント
Tahir Detinis Zur
Tahir Detinis Zur 2022 年 3 月 1 日
Thanks!
But I need to count how many times each codon appears.. Is there a simpler way to do it rather than writing this count(dna_str, 'ATG') for each codon separately?
Thank you!!!!
Ive J
Ive J 2022 年 3 月 1 日
In that case just use:
% create a random DNA seq
dna_codes = ['A', 'T', 'G', 'C'];
dna_str = string(dna_codes(randi(numel(dna_codes),1, 1000)));
res = codoncount(dna_str)
res = struct with fields:
AAA: 5 AAC: 7 AAG: 7 AAT: 6 ACA: 5 ACC: 6 ACG: 7 ACT: 2 AGA: 9 AGC: 6 AGG: 5 AGT: 4 ATA: 7 ATC: 9 ATG: 6 ATT: 7 CAA: 3 CAC: 8 CAG: 5 CAT: 2 CCA: 3 CCC: 6 CCG: 7 CCT: 2 CGA: 6 CGC: 7 CGG: 3 CGT: 5 CTA: 6 CTC: 2 CTG: 5 CTT: 5 GAA: 4 GAC: 8 GAG: 10 GAT: 1 GCA: 3 GCC: 6 GCG: 2 GCT: 11 GGA: 8 GGC: 7 GGG: 4 GGT: 4 GTA: 2 GTC: 1 GTG: 3 GTT: 6 TAA: 5 TAC: 10 TAG: 3 TAT: 5 TCA: 8 TCC: 3 TCG: 2 TCT: 12 TGA: 2 TGC: 4 TGG: 6 TGT: 4 TTA: 5 TTC: 7 TTG: 0 TTT: 4

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGenomics and Next Generation Sequencing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by