def setUp(self): self.hi = HiRapiAligner('rapi_bwa') self.reads = test_utils.get_mini_ref_seqs() for row in self.reads: if len(row) != 5: raise RuntimeError("Unexpected number of fields in mini_ref read record") self.hi.load_pair(*row)
def _align_mini_ref_seqs(self): self.hi.load_ref(test_utils.MiniRefMemPath) reads = test_utils.get_mini_ref_seqs() for row in reads: if len(row) != 5: raise RuntimeError("Unexpected number of fields in mini_ref read record") self.hi.load_pair(*row) self.hi.align_batch()
def setUp(self): self.hi = HiRapiAligner('rapi_bwa') self.reads = test_utils.get_mini_ref_seqs() for row in self.reads: if len(row) != 5: raise RuntimeError( "Unexpected number of fields in mini_ref read record") self.hi.load_pair(*row)
def _align_mini_ref_seqs(self): self.hi.load_ref(test_utils.MiniRefMemPath) reads = test_utils.get_mini_ref_seqs() for row in reads: if len(row) != 5: raise RuntimeError( "Unexpected number of fields in mini_ref read record") self.hi.load_pair(*row) self.hi.align_batch()
def test_simple_map(self): # get input data and expected output. We keep exactly one map batch of reads # (as per self._map_batch_size) reads = tseal_utils.get_mini_ref_seqs()[0:(self._map_batch_size / 2)] expected_output = sorted(tseal_utils.rapi_mini_ref_seqs_sam_no_header().split('\n')[0:2*len(reads)]) self._log.info("loaded %s fragments and %s lines of expected output", len(reads), len(expected_output)) if len(reads) * 2 < self._mapper.batch_size: self.fail("batch size for test (%s) is set larger than the number of available " "reads (%s). Aligner won't run" % (self._mapper.batch_size, len(reads) * 2)) for idx, fragment in enumerate(reads): self._ctx.set_input_key(idx * 100) self._ctx.set_input_value('\t'.join(fragment)) self._mapper.map(self._ctx) produced_sam = sorted(self._ctx.sam_lines) self.assertEquals(len(expected_output), len(produced_sam)) self.assertEquals(expected_output, produced_sam) self.assertEquals(len(reads) * 2, self._ctx.counters["SEQAL:EMITTED SAM RECORDS"])
def test_simple_map(self): # get input data and expected output. We keep exactly one map batch of reads # (as per self._map_batch_size) reads = tseal_utils.get_mini_ref_seqs()[0:(self._map_batch_size / 2)] expected_output = sorted( tseal_utils.rapi_mini_ref_seqs_sam_no_header().split( '\n')[0:2 * len(reads)]) self._log.info("loaded %s fragments and %s lines of expected output", len(reads), len(expected_output)) if len(reads) * 2 < self._mapper.batch_size: self.fail( "batch size for test (%s) is set larger than the number of available " "reads (%s). Aligner won't run" % (self._mapper.batch_size, len(reads) * 2)) for idx, fragment in enumerate(reads): self._ctx.set_input_key(idx * 100) self._ctx.set_input_value('\t'.join(fragment)) self._mapper.map(self._ctx) produced_sam = sorted(self._ctx.sam_lines) self.assertEquals(len(expected_output), len(produced_sam)) self.assertEquals(expected_output, produced_sam) self.assertEquals( len(reads) * 2, self._ctx.counters["SEQAL:EMITTED SAM RECORDS"])