Addition of two DNA sequenc

1 visualización (últimos 30 días)
lilly lord
lilly lord el 11 de Jun. de 2020
Comentada: lilly lord el 13 de Jun. de 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 comentario
lilly lord
lilly lord el 11 de Jun. de 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

Iniciar sesión para comentar.

Respuesta aceptada

Sujay C Sharma
Sujay C Sharma el 11 de Jun. de 2020
Editada: Sujay C Sharma el 11 de Jun. de 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
  1 comentario
lilly lord
lilly lord el 13 de Jun. de 2020
Thank you. Its a great help

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Genomics and Next Generation Sequencing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by