Find isn't getting the right index it says: "Error using > Matrix dimensions must agree."
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Mohannad Abboushi
el 16 de En. de 2017
Respondida: Walter Roberson
el 16 de En. de 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 comentarios
Respuesta aceptada
Walter Roberson
el 16 de En. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Genomics and Next Generation Sequencing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!