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
相关推荐
FRing037 分钟前
JavaScript入门到精通二十八(forEach遍历、创建对象的三种方式、构造函数、new实例化执行过程、实例成员和静态成员)燕落南枝21 分钟前
CSS 表单选择器与伪元素选择器详解拖孩22 分钟前
一个人 + AI 做的小程序,今天,正式回本了1024奇点24 分钟前
【仓颉语言入门 · 第二篇 第 15 课】进击的丸子28 分钟前
APP 人脸识别增值版 SDK:Camera2 无缝接入指南进击的丸子29 分钟前
代理网络环境下 Linux Pro 在线激活实操指南开开心心就好31 分钟前
本地文件搜索工具,双击Ctrl就能呼出搜索独隅36 分钟前
Claude 高效使用指南深度评测Agent世界37 分钟前
千问Go上线我的应用:一句话生成可部署 AI 软件的技术拆解布莱克60538 分钟前
C++ 中 unordered_set 与 unordered_map 有什么不同?一篇讲透