I am trying to assign a pattern of alphabets to a sequence of alphabets that I have.
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (2)
VBBV
le 19 Fév 2024
Modifié(e) : VBBV
le 19 Fév 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 commentaires
VBBV
le 19 Fév 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
le 19 Fév 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 commentaires
Voir également
Catégories
En savoir plus sur Tables dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!