-
Notifications
You must be signed in to change notification settings - Fork 0
/
mutateDNASingle.m
54 lines (46 loc) · 1 KB
/
mutateDNASingle.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
% Last update on 02/28/2014
% Changchuan Yin
% Mutant DNA from start to end at different positions
function [mutSeq] = mutateDNASingle(seq,p)
% Mutate DNA at multiple positions defiend in pos array
%seq='CAAAGATGCGTTAACGTAATCC'
%pos=[2,3,7];
% p=5
seq=upper(seq)
r = randi(3,1,3);
if seq(p)=='A'
if (r(1) == 1)
x = 'T';
elseif (r(1) == 2)
x = 'C';
elseif (r(1) == 3)
x = 'G';
end
elseif seq(p)=='T'
if (r(1) == 1)
x = 'A';
elseif (r(1) == 2)
x = 'C';
elseif (r(1) == 3)
x = 'G';
end
elseif seq(p)=='C'
if (r(1) == 1)
x = 'A';
elseif (r(1) == 2)
x = 'T';
elseif (r(1) == 3)
x = 'G';
end
elseif seq(p)=='G'
if (r(1) == 1)
x = 'T';
elseif (r(1) == 2)
x = 'C';
elseif (r(1) == 3)
x = 'A';
end
end
seq(p)=x;
mutSeq=seq
end