Coarsening Nucleobase Count Assignment
Contents
Building On Previous Exercises
Be sure to complete the Half & Half and Ranges exercises first.
Code To Implement
Warning: Invoke NucleobaseUtils.countRange where appropriate. |
CoarseningNucleobaseCounter
class: | CoarseningNucleobaseCounter.java | |
methods: | constructor numRanges count |
|
package: | count.exercise | |
source folder: | student/src/main/java |
constructor
method: public CoarseningNucleobaseCounter(int numRanges)
(sequential implementation only)
To support the required count method below, we will need to hang onto the number of ranges as an instance variable.
numRanges
method: public int numRanges()
(sequential implementation only)
Getter method for numRanges.
count
method: public int count(byte[] chromosome, Nucleobase targetNucleobase)
(parallel implementation required)
To coarsen our parallel counting of an array of nucleobases, we must use our previously created Ranges slice method and count each Range in parallel. Remember to use the numRanges variable you stored from the constructor.
In the computation graph below, we depict a chromosome of length 42 sliced into 4 Ranges:
There are many incantations of the join_fork_loop to choose from. Be sure to select the correct one. If you are failing the CoarsenParallelismRightToolTest, you've picked a suboptimal join_fork_loop (though your solution may produce the correct result, the tests enforce the better style).
Check out this page for details on choosing the correct parallel loop.
Correctness
class: | _CoarseningNucleobaseCounterTestSuite.java | |
package: | count.exercise | |
source folder: | testing/src/test/java |
Pledge, Acknowledgments, Citations
file: | nucleobase-count-coarsen-pledge-acknowledgments-citations.txt |
More info about the Honor Pledge