필터 지우기
필터 지우기

Find isn't getting the right index it says: "Error using > Matrix dimensions must agree."

조회 수: 1 (최근 30일)
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)';

채택된 답변

Walter Roberson
Walter Roberson 2017년 1월 16일
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개)

카테고리

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