I am trying to assign a pattern of alphabets to a sequence of alphabets that I have.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
VBBV
el 19 de Feb. de 2024
Editada: VBBV
el 19 de Feb. de 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 comentarios
VBBV
el 19 de Feb. de 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
el 19 de Feb. de 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 comentarios
Ver también
Categorías
Más información sobre Particle & Nuclear Physics 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!