Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Take home exam from my 201 Class
- % removed any identifying features
- % similar to DNA Strands to Amino Acids Paste
- %%
- % opening file
- seq_file = fopen('nonnatural.txt'); % Opens the text file
- temp5_3 = fscanf(seq_file,'%s'); % scanning file and saving it as a variable
- % starting replication
- A = {'A' 'T'
- 'C' 'G'
- 'G' 'C'
- 'T' 'A'}; % creates matrix to for comparison of replication
- for i = 1:length(temp5_3) % makes the for loop until end of the template
- row_A = strcmp(temp5_3(i),A(:,1)); % compares the template in 5'-3' to the matrix and saves it to variable
- synth5_3(i) = char(A(row_A,2)); %#ok<SAGROW> % chooses the corresponding DNA base and saves it to a synth variable as a character
- end
- % starts transcription
- sense5_3 = synth5_3; % moves synth strand to sense strand in the same direction
- B = {'A' 'U'
- 'C' 'G'
- 'G' 'C'
- 'T' 'A'};
- for i = 1:length(temp5_3)
- row_B = strcmp(sense5_3(i),B(:,1)); % compares the sense strand to the matrix and saves as a variable
- RNA5_3(i) = char(B(row_B,2)); % chooses the corresponding RNA base and saves it in the RNA variable
- end
- methionine_positions=strfind(RNA5_3,'AUG'); % finds all the start codons
- C = {'UUU' 'F'
- 'UUC' 'F'
- 'UUA' 'L'
- 'UUG' 'L'
- 'CUU' 'L'
- 'CUC' 'L'
- 'CUA' 'L'
- 'CUG' 'L'
- 'AUU' 'I'
- 'AUC' 'I'
- 'AUA' 'I'
- 'AUG' 'M'
- 'GUU' 'V'
- 'GUC' 'V'
- 'GUA' 'V'
- 'GUG' 'V'
- 'UCU' 'S'
- 'UCC' 'S'
- 'UCA' 'S'
- 'UCG' 'S'
- 'CCU' 'P'
- 'CCC' 'P'
- 'CCA' 'P'
- 'CCG' 'P'
- 'ACU' 'T'
- 'ACC' 'T'
- 'ACA' 'T'
- 'ACG' 'T'
- 'GCU' 'A'
- 'GCC' 'A'
- 'GCA' 'A'
- 'GCG' 'A'
- 'UAU' 'Y'
- 'UAC' 'Y'
- 'UAA' '*'
- 'UAG' '*'
- 'CAU' 'H'
- 'CAC' 'H'
- 'CAA' 'Q'
- 'CAG' 'Q'
- 'AAU' 'N'
- 'AAC' 'N'
- 'AAA' 'K'
- 'AAG' 'K'
- 'GAU' 'D'
- 'GAC' 'D'
- 'GAA' 'E'
- 'GAG' 'E'
- 'UGU' 'C'
- 'UGC' 'C'
- 'UGA' 'X' % new amino acid
- 'UGG' 'W'
- 'CGU' 'R'
- 'CGC' 'R'
- 'CGA' 'R'
- 'CGG' 'R'
- 'AGU' 'S'
- 'AGC' 'S'
- 'AGA' 'R'
- 'AGG' 'R'
- 'GGU' 'G'
- 'GGC' 'G'
- 'GGA' 'G'
- 'GGG' 'G'}; % Matrix for identifying amino acids
- AA_seq = NaN; % preallocating the vector to not a number
- ORF = RNA5_3(methionine_positions(2):end); % subsets the RNA starting with the first AUG
- AA_pos = 1; % the first Amino Acid position in the character vector
- ORF_pos = 1:3; % makes sure groups of 3 will be scanned
- while ~strcmp(char(AA_seq(end)),'*'); % only wants the loop run until it hits a stop codon
- row_C = strcmp(ORF(ORF_pos),C(:,1)); % compares the 3 RNA bases to the matrix for its amino acid and saves it as a vector
- AA_seq(AA_pos) = char(C(row_C,2)); % chooses the corresponding amino acid and saves it in the Amino Acid sequence vector
- AA_pos = AA_pos + 1; % moves to the next Amino acid index in the vector
- ORF_pos = ORF_pos + 3; % moves to the next 3 bases to compare
- end
- AA_seq = char(AA_seq); % changes to a character vector
- AA_org = {'MRCVIGKVAHDDVRK*'}; % orginal amino acid sequence
- AA_new = {'MRCVIGKVAHDDVRKXLSSVLCACVDSKYGTK*'} % new amino acid sequence
- org_value = strlength(AA_org); % length of the orginal strand
- new_value = strlength(AA_new); % length of the new strand
- if org_value > new_value % if the orginal strand is longer
- fprintf('orginal strand is longer') % prints the text
- elseif new_value > org_value % if new strand is longer
- fprintf('new strand is longer') % prints the text
- else % if strands are the same size
- fprintf('strands are the same size') % prints the text
- end
Add Comment
Please, Sign In to add comment