Question: Using Matlab write a code for the following The referenced code provided below PatternToNumber code: function number = PatternToNumber(pattern) number = 0; CharacterMap = containers.Map({'A',
Using Matlab write a code for the following
The referenced code provided below

PatternToNumber code:
function number = PatternToNumber(pattern)
number = 0;
CharacterMap = containers.Map({'A', 'C', 'G', 'T'}, [0, 1, 2, 3]);
for i = 1: length(pattern)
number = number * 4 + CharacterMap(pattern(i));
end
number = 1 + number;
end
reads.mat
'TGTTTA'
'TGGTTT'
'TTTAAT'
'TTTTGG'
'TTTTTT'
'CATGCC'
'CAATTG'
'GCCCAA'
'AAAACG'
'TAATGG'
'GCCCCC'
'CCCCCT'
'GCCATG'
'GGTTTT'
'TTTTTG'
'CCATGC'
'TTTTGT'
'GGCCCC'
'TGCCCA'
'TGGGGA'
'CCCCTT'
'CCATGC'
'AATTGG'
'CATGCC'
'CCTTTT'
'CCCTTT'
'CCCAAT'
'TGGCCC'
'GAAAAC'
'CTTTTG'
'CCCCCC'
'GGCCCA'
'ATGCCC'
'TTGTTT'
'ATTGGT'
'TTTAAT'
'TGCCAT'
'TTGGGG'
'TGTTTA'
'GGGGAA'
'AATGGC'
'AATGGC'
'TTGGTT'
'ATGCCA'
'TTTGTT'
'GCCCAT'
'ATGGCC'
'GTTTAA'
'TTAATG'
'TAATGG'
'CCCATG'
'GTTTAA'
'CCAATT'
'TTTGGG'
'TTAATG'
'GTTTTT'
'GGGAAA'
'ATGGCC'
'GGAAAA'
'TGGCCC'
Section 1 of the code: Make an adjacency matrix (Al of the graph from the reads Hint: The uploaded "reads.mat file consists of sixty 6-mers. Each 6-mer represents an edge where the beginning node is the prefix and the ending node is the suffix of the 6-mer. Prefix and suffix have length of 5. So the graph can have at most 4 nodes, and therefore you can define A as a matrix with 4 rows and 4 columns where all its elements are zero at first. Then all you have to do is Start reading each k-mer, find its prefix and suffix, convert each to a number between 0 and 4-1 use your PatternToNumber code from HW2). This way you can update the value of matrix A accordingly. For example, the first 6-mer is TGTTTA So preix TGTTT-959 and suffix='GTTA'=764. This means you need to add 1 to the element of the matrix A that sits on the 960" row and 765h column. Section 1 of the code: Make an adjacency matrix (Al of the graph from the reads Hint: The uploaded "reads.mat file consists of sixty 6-mers. Each 6-mer represents an edge where the beginning node is the prefix and the ending node is the suffix of the 6-mer. Prefix and suffix have length of 5. So the graph can have at most 4 nodes, and therefore you can define A as a matrix with 4 rows and 4 columns where all its elements are zero at first. Then all you have to do is Start reading each k-mer, find its prefix and suffix, convert each to a number between 0 and 4-1 use your PatternToNumber code from HW2). This way you can update the value of matrix A accordingly. For example, the first 6-mer is TGTTTA So preix TGTTT-959 and suffix='GTTA'=764. This means you need to add 1 to the element of the matrix A that sits on the 960" row and 765h column
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
