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
相关推荐
王解41 分钟前
webpack loader全解析,从入门到精通(10)老码沉思录41 分钟前
写给初学者的React Native 全栈开发实战班我不当帕鲁谁当帕鲁1 小时前
arcgis for js实现FeatureLayer图层弹窗展示所有field字段那一抹阳光多灿烂1 小时前
工程化实战内功修炼测试题爱吃生蚝的于勒1 小时前
C语言内存函数放逐者-保持本心,方可放逐2 小时前
微信小程序=》基础=》常见问题=》性能总结小白学大数据3 小时前
Python爬虫开发中的分析与方案制定冰芒猓4 小时前
SpringMVC数据校验、数据格式化处理、国际化设置失落的香蕉4 小时前
C语言串讲-2之指针和结构体毋若成4 小时前
前端三大组件之CSS,三大选择器,游戏网页仿写