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

相关推荐
Eric_见嘉4 小时前
打开这个 VSC 设置「组件引用位置」和数量就都清楚了
前端·typescript·visual studio code
李高钢4 小时前
Python Tornado 框架入门:从零搭建你的第一个异步 Web 应用
前端·python·tornado
白色的北极熊4 小时前
c语言 输出菱形字符串
c语言·开发语言
宁风4 小时前
JavaScript:函数体系-1
前端·javascript
mmsx4 小时前
Android 手簿 ADB 无线调试全攻略:USB 转 WiFi 一键连接
android·前端
学习智者4 小时前
《玄》IDE v3.6.3重磅发布:全功能修复与性能飞跃
开发语言·c++·ide·算法·中文语言 玄
guwentian4 小时前
Rolldown vs esbuild vs Webpack:Rust 打包器大战我们该怎么选
前端·webpack·rust·esbuild
奔跑吧树袋熊4 小时前
多租户隔离该做到哪一层:从连接池到 ORM 的取舍
开发语言·数据库·oracle·系统架构
特立独行的猫A4 小时前
用纯 Rust 重写 Podcastfy:把网页、PDF 和一段文字,变成一档双人对话播客
前端
大江东去浪淘尽千古风流人物4 小时前
【LoMa】局部特征匹配重访:从LoMa-B到旋转不变LoMa-R的架构与工程实践
开发语言·深度学习·计算机视觉·r语言·视觉定位·sfm·局部特征匹配