String Map K Mer Assignment

From CSE231 Wiki
Jump to navigation Jump to search

Group Assignment

This is a group assignment.

Code To Investigate

Code To Implement

StringHashMapKMerCounter

class: StringHashMapKMerCounter.java Java.png
methods: parse
package: kmer.warmup.stringmap
source folder: student/src/main/java

method: public KMerCount parse(List<byte[]> sequences, int k) Sequential.svg (sequential implementation only)

In this completely sequential implementation, you will have to write the parse method. The method takes in a list of arrays of bytes and a k-mer length. It should return an instance of MapKMerCount(which takes in a map), a class provided to you which does exactly what its name suggests. In order to implement this method, we recommend taking a look at the KMerUtils class and more specifically the toString method, which converts a given byte array into a String in order to make it compatible with the String HashMap.

parse should go through the amount of possible k-mers for every byte array in the list of sequences. As it goes through the bytes in the array, use the KMerUtils.toString() method to create a string to use for the HashMap. The map should take in a String as the key and an Integer as the value. We recommend using the map.compute() method and reviewing how to use lambdas.

StringConcurrentHashMapKMerCounter

class: StringConcurrentHashMapKMerCounter.java Java.png
methods: parse
package: kmer.warmup.stringmap
source folder: student/src/main/java

method: public KMerCount parse(List<byte[]> sequences, int k) Parallel.svg (parallel implementation required)

This implementation will make your sequential String HashMap implementation into a parallel one. To do so, you will be making use of Java’s atomic version of a HashMap: a ConcurrentHashMap. Like before, you will be need to complete the parse method. You can choose to finish this method with a forall loop or a finish/async approach, which is completely up to you.

ByteArrayRangeConcurrentHashMapKMerCounter

class: ByteArrayRangeConcurrentHashMapKMerCounter.java Java.png
methods: parse
package: kmer.warmup.bytearrayrangemap
source folder: student/src/main/java

method: public KMerCount parse(List<byte[]> sequences, int k) Parallel.svg (parallel implementation required)

This parallel implementation will overlap greatly with your previous two implementations, but it will use ByteArrayRange instead of Strings. Refer to the ByteArrayRange class in order to get a better idea of how to implement this method and instantiate an instance of the class. The class closely resembles the Slice class you worked on earlier in the semester.

Testing Your Solution

Correctness

class: KMerWarmupTestSuite.java Junit.png
package: kmer.group
source folder: testing/src/test/java