Question: URGENT!!! Really need help with this. % Code to start Part 3 from. function HW7_3 % Ask the user for DNA sequence 1. prompt =
URGENT!!! Really need help with this.


% Code to start Part 3 from.
function HW7_3
% Ask the user for DNA sequence 1.
prompt = 'Enter the first DNA sequence of length 1 to 99: ';
seq1 = input(prompt, 's');
len1 = length(seq1);
sprintf(' Seq 1 %s has %d bases', seq1, len1)
% Ask the user for DNA sequence 2.
prompt = 'Enter the second DNA sequence of length 1 to 99: ';
seq2 = input(prompt, 's');
len2 = length(seq2);
sprintf(' Seq 2 %s has %d bases', seq2, len2)
% Guess sequence 1 is longer than sequence 2.
longSeq = seq1;
longLen = len1;
shortSeq = seq2;
shortLen = len2;
% Correct an incorrect guess.
if (len2 > len1)
longSeq = seq2;
longLen = len2;
shortSeq = seq1;
shortLen = len1;
end
% Create "buffered" strings to facilitate the scan.
bufLength = longLen + 2 * shortLen;
scan1 = blanks(bufLength);
scan2 = blanks(bufLength);
% Fill the "scan" strings with dashes
for i = 1:bufLength
scan1(i) = '-';
scan2(i) = '-';
end
% Initialize the first scan string with the long sequence in the middle.
for i = shortLen + 1:shortLen + longLen
scan1(i) = longSeq(i-shortLen);
end
% Initialize the second scan string with the short sequence at the
% beginning.
for i = 1:shortLen
scan2(i) = shortSeq(i);
end
% Score & print the initial alignment.
score = scoreSequences(scan1, scan2);
printSeq(scan1, scan2, score);
% Rotate the short sequence to the right, score & print.
scan2 = rotateSeqRight(scan2);
score = scoreSequences(scan1, scan2);
printSeq(scan1, scan2, score);
% Repeat in a loop!!
end
% Use your scoring logic from part 1.
function score = scoreSequences(seq1, seq2)
Page of 2
ZOOM
% Code to start Part 3 from.
function HW7_3
% Ask the user for DNA sequence 1.
prompt = 'Enter the first DNA sequence of length 1 to 99: ';
seq1 = input(prompt, 's');
len1 = length(seq1);
sprintf(' Seq 1 %s has %d bases', seq1, len1)
% Ask the user for DNA sequence 2.
prompt = 'Enter the second DNA sequence of length 1 to 99: ';
seq2 = input(prompt, 's');
len2 = length(seq2);
sprintf(' Seq 2 %s has %d bases', seq2, len2)
% Guess sequence 1 is longer than sequence 2.
longSeq = seq1;
longLen = len1;
shortSeq = seq2;
shortLen = len2;
% Correct an incorrect guess.
if (len2 > len1)
longSeq = seq2;
longLen = len2;
shortSeq = seq1;
shortLen = len1;
end
% Create "buffered" strings to facilitate the scan.
bufLength = longLen + 2 * shortLen;
scan1 = blanks(bufLength);
scan2 = blanks(bufLength);
% Fill the "scan" strings with dashes
for i = 1:bufLength
scan1(i) = '-';
scan2(i) = '-';
end
% Initialize the first scan string with the long sequence in the middle.
for i = shortLen + 1:shortLen + longLen
scan1(i) = longSeq(i-shortLen);
end
% Initialize the second scan string with the short sequence at the
% beginning.
for i = 1:shortLen
scan2(i) = shortSeq(i);
end
% Score & print the initial alignment.
score = scoreSequences(scan1, scan2);
printSeq(scan1, scan2, score);
% Rotate the short sequence to the right, score & print.
scan2 = rotateSeqRight(scan2);
score = scoreSequences(scan1, scan2);
printSeq(scan1, scan2, score);
% Repeat in a loop!!
end
% Use your scoring logic from part 1.
function score = scoreSequences(seq1, seq2)
Part 1: Create a Matlab script hw7_1.m that prompts the user for two DNA sequence strings and scores an alignment. Each A or T match contributes a value of +2 Each C or G match contributes a value of +3 Each mismatch or Gap contributes a score of -2 You can assume the input will be valid (only DNA bases) and the sequences will be at most 99 bases in length. For example, two sequences and their corresponding score would be Sequence 1ATGCTGACTGCA Sequence 2: CTTGAGACG- A/T score G/C score Mismatches + GAPS = 8*-2= -16 Score = 2* 2= +4 = 2* 3= +6 -6
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
