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

조회 수: 1 (최근 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 CenterFile Exchange에서 Genomics 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