about | help | code help+videos | done | prefs |
ssr
A microsatellite or simple sequence repeat (SSR) is a repeat of a short sequence of DNA. The repeated sequence is typically 2-4 bases in length and can be repeated 10- 100 times or more. For example, 'cacacacaca' is a short SSR of 'ca', a very common repeat in humans. Microsatellites are very common in the DNA of most organisms, but their lengths are highly variable within populations because of replication errors resulting from "slippage" during copying. Comparing the distribution of length variants within and between populations can be used to determine genetic relationships and learn about evolutionary processes. Write a function ssr(dna, repeat) that returns the length (number of repeats) of the first SSR in dna that repeats the parameter repeat. If repeat is not found, return 0. For examples, return anything and click "Run" to see the test cases. You can assume dna and repeat are lowercase, non-empty, and dna is longer than repeat. ssr('agtcacacacacacacacatgggcaacacacacattg', 'ca') → 8 ssr('agtcacacacacacacacatgggcaacacacacacacacacacacacacacattg', 'ca') → 8 ssr('agcttttcattctgactgcaacgggcaatatgtctctgtgtggattaaaaaaagaggaggaggaggaggaggaggaggaggaggagtgtctgatagcagcttctgaactggttacctgcc', 'gag') → 11 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy