Addition of two DNA sequenc

2 Ansichten (letzte 30 Tage)
lilly lord
lilly lord am 11 Jun. 2020
Kommentiert: lilly lord am 13 Jun. 2020
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 Kommentar
lilly lord
lilly lord am 11 Jun. 2020
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

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Sujay C Sharma
Sujay C Sharma am 11 Jun. 2020
Bearbeitet: Sujay C Sharma am 11 Jun. 2020
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

Weitere Antworten (0)

Kategorien

Mehr zu Genomics and Next Generation Sequencing finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by