I am trying to assign a pattern of alphabets to a sequence of alphabets that I have.
3 views (last 30 days)
Show older comments
seq_file = fopen('insulinDNAseq.txt');
template5_3 = fscanf(seq_file,'%s');
seq_len = length(template5_3);
template3_5 = [flip(template5_3)];
A = {'a' 't'
'c' 'g'
'g' 'c'
't' 'a'};
I am supposed to modify the code below in order to get a stand of alphabets of a,c,g,t. On the process above, I import a document of a sequence of alphabets and flip it front a back. I need to modify the code below in order to assign a new alphabet and come up with a new strand according to the pattern A shown above. I am attaching the text file with the question.
for i = 1:seq_len
template_base = template3_5(i); % pull the ith base of the template strand
row_A = strcmp(template_base,A(:,1)); % identify the row in matrix A corresponding to templateBase; note that the variable row_A is a boolean vector
% Define the base added to the synthesized strand using matrix 'A' and
% vector 'row_A'
synth_base = [row_A];
% Store synth_base in the ith element of your storage vector. You'll
% need to use the command 'char' to store the character properly.
[];
end
0 Comments
Answers (2)
VBBV
on 19 Feb 2024
Edited: VBBV
on 19 Feb 2024
seq_file = fopen('insulinDNAseq.txt');
template5_3 = fscanf(seq_file,'%s');
seq_len = length(template5_3);
template3_5 = [flip(template5_3)];
A = {'a' 't'
'c' 'g'
'g' 'c'
't' 'a'};
for i = 1:seq_len
for k = 1:size(A,2)
template_base = template3_5(i); % pull the ith base of the template strand
row_A = strcmp(template_base,A(:,k)); % identify the row in matrix A corresponding to templateBase; note that the variable row_A is a boolean vector
% Define the base added to the synthesized strand using matrix 'A' and
% vector 'row_A'
synth_base{i} = A{[row_A]};
% Store synth_base in the ith element of your storage vector. You'll
% need to use the command 'char' to store the character properly.
[];
end
end
synth_base{:}
2 Comments
VBBV
on 19 Feb 2024
seq_file = fopen('insulinDNAseq.txt');
template5_3 = fscanf(seq_file,'%s');
seq_len = length(template5_3);
template3_5 = [flip(template5_3)];
A = {'a' 't'
'c' 'g'
'g' 'c'
't' 'a'};
for i = 1:seq_len
for k = 1:size(A,2)
template_base = template3_5(i); % pull the ith base of the template strand
row_A = strcmp(template_base,A(:,k)); % identify the row in matrix A corresponding to templateBase; note that the variable row_A is a boolean vector
% Define the base added to the synthesized strand using matrix 'A' and
% vector 'row_A'
synth_base(i) = A{[row_A]};
% Store synth_base in the ith element of your storage vector. You'll
% need to use the command 'char' to store the character properly.
[];
end
end
disp(synth_base) %
Voss
on 19 Feb 2024
seq_file = fopen('insulinDNAseq.txt');
template5_3 = fscanf(seq_file,'%s');
fclose(seq_file); % close the file when you're done reading it!!!
template3_5 = flip(template5_3);
A = {'a' 't'
'c' 'g'
'g' 'c'
't' 'a'};
[ism,idx] = ismember(template3_5,[A{:,1}]);
assert(all(ism),'Not all characters are a, c, g, or t')
synth_base = [A{idx,2}];
disp(synth_base)
0 Comments
See Also
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!