Task 1: Frequency Counts
You've been asked to produce the counts of particular sequences handed to you from a test framework. The framework itself has a function for you to call with the results.
In essence, if you have been given the following sequence of nucleotide letters:
CCAAATT
We should be able to generate the following counts of each pattern in the following structure:
{ AA: 2, AT: 1, CC: 1, CA: 1, TT: 1 }
Note that 'AA' is detected as two patterns, as the first pair of 'A's then a second pair of overlapping 'A's:
CC AA ATT and CCA AA TT
Your code will be handed the input character-by-character, so it will be up to you how you decide to buffer and detect these sequences.
In the supplied .zip file, you should have 6 data files (in pairs, for each task), and two JavaScript files. One is the library you are to use (testlib.js) and the other is a template to base your implementation on (minimal_demo.js). You should not modify testlib.js . All need to be in the same folder to operate correctly.
To run the demo file, execute 'node minimal_demo.js' from the command line or terminal in the program's folder.

The minimal_demo includes how to connect to the testlib library, along with how to start the test. The source code of the library is documented on the functions available for your use.
For this particular task, you are required to use the testlib.frequencyTable() function to report your frequency counts. This function expects that you supply it with an object containing keys as specified by the patterns array in the 'ready' handler, each with a count of the number of times the program has seen that pattern.
Remember that you can access JavaScript object and array keys by square brackets.
An (extremely simple) example of how to do this might be:

Note: To know when one sequence stops and another begins, use the 'reset' hook via the testlib.on() function
SCC212 Javascript
_0206girl2024-01-11 22:32
相关推荐
Mr -老鬼4 分钟前
Rust适合干什么?为什么需要Rust?予枫的编程笔记7 分钟前
【Java集合】深入浅出 Java HashMap:从链表到红黑树的“进化”之路ohoy12 分钟前
RedisTemplate 使用之Setmjhcsp13 分钟前
C++ 后缀数组(SA):原理、实现与应用全解析hui函数14 分钟前
如何解决 pip install 编译报错 ‘cl.exe’ not found(缺少 VS C++ 工具集)问题Hilaku22 分钟前
我用 Gemini 3 Pro 手搓了一个并发邮件群发神器(附源码)IT_陈寒23 分钟前
Java性能调优实战:5个被低估却提升30%效率的JVM参数云栖梦泽23 分钟前
易语言Windows桌面端「本地AI知识管理+办公文件批量自动化处理」双核心系统快手技术24 分钟前
AAAI 2026|全面发力!快手斩获 3 篇 Oral,12 篇论文入选!颜酱26 分钟前
前端算法必备:滑动窗口从入门到很熟练(最长/最短/计数三大类型)