フィルターのクリア

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 Center および File ExchangeGenomics 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