Addition of two DNA sequenc

2 次查看(过去 30 天)
Hi, I have a problem in DNA addition
%%%%%%DNA addition
P_DNA1='ACAAGGGTTTAAACCCTTAC';
P_DNA2='TTTTGGGAAATGTGACATAT';
[m n]=size(P_DNA1);
mn=m*n;
d3=[];
for i = 1:mn
d3 = DNA_add('P_DNA1(i)','P_DNA2(i)');
end
where DNA_add is a function
  1 个评论
lilly lord
lilly lord 2020-6-11
DNA_add function
function K = DNA_add(Q1,Q2)
if Q1=='A' && Q2=='A';
K = 'A';
elseif Q1=='A' && Q2=='G';
K = 'G';
elseif Q1=='A' && Q2=='C';
K = 'C';
elseif Q1=='A' && Q2=='T';
K = 'T';
elseif Q1=='G' && Q2=='A';
K = 'G';
elseif Q1=='G' && Q2=='G';
K = 'C';
elseif Q1=='G' && Q2=='C';
K = 'T';
elseif Q1=='G' && Q2=='T';
K = 'A';
elseif Q1=='C' && Q2=='A';
K = 'C';
elseif Q1=='C' && Q2=='G';
K = 'T';
elseif Q1=='C' && Q2=='C';
K = 'A';
elseif Q1=='C' && Q2=='T';
K = 'G';
elseif Q1=='T' && Q2=='A';
K = 'T';
elseif Q1=='T' && Q2=='G';
K = 'A';
elseif Q1=='T' && Q2=='C';
K = 'G';
elseif Q1=='T' && Q2=='T';
K = 'C';
end

请先登录,再进行评论。

采纳的回答

Sujay C Sharma
Sujay C Sharma 2020-6-11
编辑:Sujay C Sharma 2020-6-11
Hi,
There are a couple of minor issues with your implementation that is causing a problem.
  1. Your function is missing an end statement.
  2. Assuming that you wanted to send the ith character of P_DNA1 and P_DNA2 to the function DNA_add, the quotation marks are not needed.
  3. The variable d3 gets overwritten at each iteration of the loop rather than the result of DNA_add being appended to d3.
Here is the modified code which should resolve these issues:
P_DNA1='ACAAGGGTTTAAACCCTTAC';
P_DNA2='TTTTGGGAAATGTGACATAT';
[m n]=size(P_DNA1);
mn=m*n;
d3=[];
for i = 1:mn
d3 = [d3 DNA_add(P_DNA1(i),P_DNA2(i))];
end
function K = DNA_add(Q1,Q2)
if Q1=='A' && Q2=='A';
K = 'A';
elseif Q1=='A' && Q2=='G';
K = 'G';
elseif Q1=='A' && Q2=='C';
K = 'C';
elseif Q1=='A' && Q2=='T';
K = 'T';
elseif Q1=='G' && Q2=='A';
K = 'G';
elseif Q1=='G' && Q2=='G';
K = 'C';
elseif Q1=='G' && Q2=='C';
K = 'T';
elseif Q1=='G' && Q2=='T';
K = 'A';
elseif Q1=='C' && Q2=='A';
K = 'C';
elseif Q1=='C' && Q2=='G';
K = 'T';
elseif Q1=='C' && Q2=='C';
K = 'A';
elseif Q1=='C' && Q2=='T';
K = 'G';
elseif Q1=='T' && Q2=='A';
K = 'T';
elseif Q1=='T' && Q2=='G';
K = 'A';
elseif Q1=='T' && Q2=='C';
K = 'G';
elseif Q1=='T' && Q2=='T';
K = 'C';
end
end

更多回答(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