Computational Biology Journal / 2013 / Article / Alg 1 / Research Article
SCBI_MapReduce, a New Ruby Task-Farm Skeleton for Automated Parallelisation and Distribution in Chunks of Sequences: The Implementation of a Boosted Blast+ c lass MyWorkerManager < WorkManager def self.init_work_manager # open input fastq file, and results as output @@fastq_file=FastqFile.new(fastq_file_path) @@results=FastqFile.new( ‘ ./results.fastq ’ , ‘ w+ ’ ) end def self.end_work_manager #close files on finish @@fastq_file.close @@results.close end # this method is called every time a worker # needs a new work def next_work # get next sequence or nil from file name,fasta,qual,comments=@@fastq_file.next_seq if !name.nil? return name,fasta,qual,comments else return nil end end def work_received(results) # write results to disk results.each do ∣ name,fasta,qual,comments ∣ @@results.write_seq(name,fasta,qual,comments) end end end