So I am looping through codons and recording them on a .txt file. The script works, but I need the sequence to begin at the starting codon position, stop at the end codon then continue through the cell array while recording all of the following start and end codon sequences. I would just like to know the best option I can use to tweak my code here. Thanks in advance!
fid = fopen("sequence_long2.txt",'r');C = textscan(fid,'%3s');x = C{1}fclose(fid);%Start sequence
ss = 1;% end sequence
es = 183479;seq_id = long_codon(x(ss:es));
function seq = long_codon(v) seq = (v); for pos = 1:length(seq) if strcmp(seq{pos},'TAC') index = find(strcmp(v,seq{pos})); StartPos = index; elseif (strcmp(seq{pos},'ACT') || strcmp(seq{pos},'ATT') || strcmp(seq{pos},'ATC')) index = find(strcmp(v,seq{pos})); EndPos = index; end end fid2 = fopen('report_long.txt','w+'); fprintf(fid2,'Name: OP \n'); fprintf(fid2,'Lab 13: DNA Pattern Matching\n \n'); fprintf(fid2,'Start Position of Gene is: %d \n',StartPos); fprintf(fid2, 'End Position of Gene is: %d \n',EndPos); fclose(fid2); end
Best Answer