SCC212 Javascript

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

相关推荐
未来之窗软件服务2 小时前
一体化系统(九)智慧社区综合报表——东方仙盟练气期
大数据·前端·仙盟创梦ide·东方仙盟·东方仙盟一体化
陈天伟教授5 小时前
人工智能训练师认证教程(2)Python os入门教程
前端·数据库·python
陈文锦丫5 小时前
MQ的学习
java·开发语言
liwulin05066 小时前
【PYTHON-YOLOV8N】如何自定义数据集
开发语言·python·yolo
信看6 小时前
NMEA-GNSS-RTK 定位html小工具
前端·javascript·html
Tony Bai6 小时前
【API 设计之道】04 字段掩码模式:让前端决定后端返回什么
前端
青蛙大侠公主6 小时前
Thread及其相关类
java·开发语言
爱吃大芒果6 小时前
Flutter 主题与深色模式:全局样式统一与动态切换
开发语言·javascript·flutter·ecmascript·gitcode
云栖梦泽6 小时前
易语言数据库操作:结构化数据管理的核心
开发语言