I want help in code that allows to fix the correction of my DNA strand.

1 回表示 (過去 30 日間)
Abraham Ramirez Sierra
Abraham Ramirez Sierra 2022 年 6 月 7 日
回答済み: Sai Teja G 2023 年 8 月 31 日
I am wrting code for a dna strand , i have made it so that when there is a wrong sister strand or when A-T or C-G are not read it leaves an X where there is an error. But i want the second part to fix the wrong nucleotide. please help or suggestions.
string1 = 'ATCG';
string2 = 'TACC';
outputstring1 = '';
outputstring2 = '';
%%j=0;%%
for i = 1 : length(string1)
ch1 = string1(i);
ch2 = string2(i);
matching = 0;
if (ch1 == 'A') & (ch2 == 'T') matching = 1; end;
if (ch1 == 'T') & (ch2 == 'A') matching = 1; end;
if (ch1 == 'C') & (ch2 == 'G') matching = 1; end;
if (ch1 == 'G') & (ch2 == 'C') matching = 1; end;
if (matching == 1)
%j = j + 1;
outputstring1(i) = ch1; %% js to (i)'s
outputstring2(i) = ch2;
else
outputstring1(i) = 'X';
outputstring2(i) = 'X';
end
outputstring2
end
if outputstring2(i) == 'X'
if (ch1 == 'A') & (ch2 == 'A') || (ch2 == 'C') || (ch2 == 'G') matching = 0; end;
if (ch1 == 'T') & (ch2 == 'T') || (ch2 == 'C') || (ch2 == 'G') matching = 0; end;
if (ch1 == 'C') & (ch2 == 'C') || (ch2 == 'A') || (ch2 == 'T') matching = 0; end;
if (ch1 == 'G') & (ch2 == 'G') || (ch2 == 'A') || (ch2 == 'T') matching = 0; end;
if (matching == 0);
end;
end;

回答 (1 件)

Sai Teja G
Sai Teja G 2023 年 8 月 31 日
Hi Abraham,
I understand you want to fix the wrong nucleoid when there is a mismatch in the DNA strand. You can refer to the below code to fix the wrong nucleoid.
string1 = 'ATCG';
string2 = 'TACC';
outputstring1 = '';
outputstring2 = '';
%%j=0;%%
for i = 1 : length(string1)%checking if the strings match or not
ch1 = string1(i);
ch2 = string2(i);
matching = 0;
if (ch1 == 'A') && (ch2 == 'T') matching = 1; end
if (ch1 == 'T') && (ch2 == 'A') matching = 1; end
if (ch1 == 'C') && (ch2 == 'G') matching = 1; end
if (ch1 == 'G') && (ch2 == 'C') matching = 1; end
if (matching == 1)%if the strands match
%j = j + 1;
outputstring1(i) = ch1; %% js to (i)'s
outputstring2(i) = ch2;
else
outputstring1(i) = 'X';
outputstring2(i) = 'X';
end
if outputstring2(i) == 'X' %checking if this is a mismatch
if (ch1 == 'A') %correcting or fixing the wrong nucleoid
outputstring2(i)='T';
outputstring1(i)='A';
end
if (ch1 == 'T') %correcting or fixing the wrong nucleoid
outputstring2(i)='A';
outputstring1(i)='T';
end
if (ch1 == 'C') %correcting or fixing the wrong nucleoid
outputstring2(i)='G';
outputstring1(i)='C';
end
if (ch1 == 'G') %correcting or fixing the wrong nucleoid
outputstring2(i)='C';
outputstring1(i)='G';
end
end
end
Hope it helps!

カテゴリ

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