Find isn't getting the right index it says: "Error using > Matrix dimensions must agree."
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Mohannad Abboushi
il 16 Gen 2017
Risposto: Walter Roberson
il 16 Gen 2017
How do I change the find to get the right index in the program that finds stop and start codons to get the longest reading frame?
function [ptn]=seq_transcribe2(x)
y=seq_transcribe1(x);
frames={};
frames={x(1:end) x(2:end) x(3:end) y(1:end) y(2:end) y(3:end)};
starts=[];
stops=[];
allorfs={};
for i=1:3:numel(frames)-2
for j=1:numel(frames)
codon= frames{j}([i i+1 i+2])
if strcmp(codon,'ATG')
starts= [starts codon];
end
if strcmp(codon,'TAA') | strcmp(codon,'TAG') | strcmp(codon,'TGA')
stops = [stops codon];
end
end
end
stops= find(stops>starts,1)
lengthofthisstart=stops-starts
allorfs{end+1}=frames(starts:stops-1)
map=geneticcode;
names=fieldnames(map);
ptn={};
% for i=1:numel(codon)
% ptn{end+1}=map.(codon{i})
% end
% ptn=char(ptn)';
0 Commenti
Risposta accettata
Walter Roberson
il 16 Gen 2017
It is not self-obvious from the code that the number of starts and the number of stops must be equal. Also, your starts and stops contain the condon characters themselves, not the positions, and all of your stop codons are alphabetically after your start codon so provided that stops and starts are non-empty, the find is going to return position 1.
By the way, you can write
if strcmp(codon,'TAA') | strcmp(codon,'TAG') | strcmp(codon,'TGA')
as
if ismember(codon, {'TAA', 'TAG', 'TGA'})
I wonder whether you could replace the loops entirely with some strfind() such as
strfind(frames{j}, 'ATG')
and
sort( [strfind(frames{j}, 'TAA'), strfind(frames{j}, 'TAG'), stfind(frames{j}, 'TGA')] )
0 Commenti
Più risposte (0)
Vedere anche
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!