Addition of two DNA sequenc

1 visualizzazione (ultimi 30 giorni)
lilly lord
lilly lord il 11 Giu 2020
Commentato: lilly lord il 13 Giu 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 Commento
lilly lord
lilly lord il 11 Giu 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

Accedi per commentare.

Risposta accettata

Sujay C Sharma
Sujay C Sharma il 11 Giu 2020
Modificato: Sujay C Sharma il 11 Giu 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

Più risposte (0)

Categorie

Scopri di più su Genomics and Next Generation Sequencing in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by