Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MATLAB, please help! DNA N-Gram Distribution (string scalar) In DNA analysis unique sequences of three bases need to be identified any point in the gene
MATLAB, please help!
DNA N-Gram Distribution (string scalar) In DNA analysis unique sequences of three bases need to be identified any point in the gene sequence. The bases could be combinations of either T, C, A or G. Write a function nGramFrequency to identify the unique n-grams (n letter sequence) in a given string scalar stringln and the number of times an n-gram occurs. In addition to the input stringln, the number n speficies the length of the n-gram. The identified unique n-gram sequences should be sorted alphabetically. The outputs should be empty if i) there are no n-grams, i) the input is not a string scalar, or ii) the length of the ngram is not a positive integer. Restriction: The nGramFrequency function should use the internal function extractBetween For example "AACTGAACG";lengthnGram-3; >>uniquegrams, count] uniquegrams- nGramFrequency (s,lengthnGram) 1x6 string array "AAC" "ACG""ACT""CTG" "GAA" TGA count 1 The unique 3-grams are "AAC" "ACG" "ACT" "CTG" "GAA" "TGA". The sequence AAC that appears twice, and all appear once >>s"AACTGAACG";lengthnGram-10; [uniquegrams, count] uniquegrams- nGramFrequency (s, lengthnGram) count IlStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started