Skip to content

Chapter 17: K-mer Counting

Programs of chapter 17 of the book Data Algorithms (O'Reilly, 2015), running on Spark 4.3.0.

Chapter notes: chap17

Sample input: data/SP1.fq

Run the commands from the repository folder after building the jar (Running the programs).

Spark (Java)

chap17.spark.Kmer

Source: Kmer.java

scripts/run_spark.sh org.dataalgorithms.chap17.spark.Kmer data/SP1.fq 4 5
  • Writes to kmers/ in the current directory; delete it first if it exists: rm -r kmers

Spark (Java 8 lambdas)

chap17.sparkwithlambda.Kmer

Source: Kmer.java

scripts/run_spark.sh org.dataalgorithms.chap17.sparkwithlambda.Kmer data/SP1.fq 4 5
  • Writes to kmers/ in the current directory; delete it first if it exists: rm -r kmers

Spark (Scala)

chap17.scala.Kmer

Source: Kmer.scala

scripts/run_spark.sh org.dataalgorithms.chap17.scala.Kmer data/SP1.fq 4 5

MapReduce (Hadoop)

chap17.mapreduce.KmerCountDriver

Source: KmerCountDriver.java

scripts/run_mapreduce.sh org.dataalgorithms.chap17.mapreduce.KmerCountDriver data/SP1.fq /tmp/data-algorithms/chap17.mapreduce.KmerCountDriver/output 4

chap17.mapreduce.KmerUtil

Source: KmerUtil.java

scripts/run_mapreduce.sh org.dataalgorithms.chap17.mapreduce.KmerUtil ACGTACGTTAGC 3