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

1 visualizzazione (ultimi 30 giorni)
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!!!

Risposte (1)

Ive J
Ive J il 28 Feb 2022
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 Commenti
Tahir Detinis Zur
Tahir Detinis Zur il 1 Mar 2022
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 il 1 Mar 2022
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

Accedi per commentare.

Categorie

Scopri di più su Genomics and Next Generation Sequencing 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