Answered step by step
Verified Expert Solution
Question
1 Approved Answer
why? 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
why?
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 stringin 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, ii) 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 >>S"AACTGAACG"; lengthnGram 3; >>uniquegrams, count] nGramFrequency (s,lengthnGram) uniquegrams- 1x6 string array "AAC" "ACG""ACT""CTG""GAA""TGA" countE 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] nGramFrequency(s,lengthnGram) uniquegrams- [l countE [l Your Function Save C Reset E MATLAB Documentation 1 function [uniqueGrams, countGrams] nGramFrequency(instring, lengthnGram) 3 uniqueGrams [1; 4 count-[]; 5 SinString: 6 if (isStringScalar(s) &&lengthnGram > 0 && lengthnGramstrlength(s)) uniquegramsstrings; countTemp-0; k 1; 2while( (i+lengthnGram-1)Step 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