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

相关推荐
m0_748256144 分钟前
前端 MYTED单篇TED词汇学习功能优化
前端·学习
忒可君9 分钟前
C# winform 报错:类型“System.Int32”的对象无法转换为类型“System.Int16”。
java·开发语言
GuYue.bing19 分钟前
网络下载ts流媒体
开发语言·python
StringerChen27 分钟前
Qt ui提升窗口的头文件找不到
开发语言·qt
数据小爬虫@33 分钟前
如何利用PHP爬虫获取速卖通(AliExpress)商品评论
开发语言·爬虫·php
小马哥编程1 小时前
Function.prototype和Object.prototype 的区别
javascript
小白学前端6661 小时前
React Router 深入指南:从入门到进阶
前端·react.js·react
java1234_小锋1 小时前
MyBatis如何处理延迟加载?
java·开发语言
web130933203982 小时前
前端下载后端文件流,文件可以下载,但是打不开,显示“文件已损坏”的问题分析与解决方案
前端
王小王和他的小伙伴2 小时前
解决 vue3 中 echarts图表在el-dialog中显示问题
javascript·vue.js·echarts