def setUp(self): self.buf = open('output').read() self.buf = self.buf.replace("\r\n","\n") thisdir = os.path.abspath(os.path.dirname(__file__)) self.db = seqdb.SequenceFileDB(os.path.join(thisdir, 'test_genomes.fna')) matches, genome_names = blastz_NLMSA.parse_blastz(self.buf) alignment = cnestedlist.NLMSA('test', mode='memory', seqDict=self.db, use_virtual_lpo=True) self.temp_nlmsa = blastz_NLMSA.create_NLMSA_blastz(self.buf, self.db, alignment)
def setUp(self): self.buf = open('output').read() thisdir = os.path.abspath(os.path.dirname(__file__)) self.db = seqdb.SequenceFileDB(os.path.join(thisdir, 'test_genomes.fna')) matches, genome_names = blastz_NLMSA.parse_blastz(self.buf) genomes_dict = {} for genome in genome_names: genomes_dict[genome] = self.db[genome] alignment = cnestedlist.NLMSA('test', mode='memory', seqDict=self.db, use_virtual_lpo=True) alignment += genomes_dict[genome_names[0]] self.temp_nlmsa = blastz_NLMSA.create_NLMSA_blastz(os.path.join(thisdir, 'output'), self.db, alignment)
def setUp(self): self.buf = open("output").read() self.buf = self.buf.replace("\r\n", "\n") thisdir = os.path.abspath(os.path.dirname(__file__)) def thisfile(name): return os.path.join(thisdir, name) self.db = seqdb.SequenceFileDB(thisfile("test_genomes.fna")) matches, genome_names = blastz_NLMSA.parse_blastz(self.buf) alignment = cnestedlist.NLMSA("test", mode="memory", seqDict=self.db, use_virtual_lpo=True) self.temp_nlmsa = blastz_NLMSA.create_NLMSA_blastz(self.buf, self.db, alignment)
def test_parse_blastz(self): matches, genome_names = blastz_NLMSA.parse_blastz(self.buf) self.assertEqual(set(genome_names), set(["testgenome1", "testgenome2"])) blastz_aln = matches[-1] score = getattr(blastz_aln, "score") start_top = getattr(blastz_aln, "start_top") start_bot = getattr(blastz_aln, "start_bot") end_top = getattr(blastz_aln, "end_top") end_bot = getattr(blastz_aln, "end_bot") sequence_name1 = getattr(blastz_aln, "sequence_name1") sequence_name2 = getattr(blastz_aln, "sequence_name2") orient = getattr(blastz_aln, "orient") blocks = getattr(blastz_aln, "blocks") last_ungapped = blocks[-1] last_ungapped_start_top = getattr(last_ungapped, "start_top") last_ungapped_start_bot = getattr(last_ungapped, "start_bot") last_ungapped_end_top = getattr(last_ungapped, "end_top") last_ungapped_end_bot = getattr(last_ungapped, "end_bot") last_ungapped_ident = getattr(last_ungapped, "ident") self.assertEqual(score, 74457) self.assertEqual(start_top, 40) self.assertEqual(start_bot, 41) self.assertEqual(end_top, 1120) self.assertEqual(end_bot, 1120) self.assertEqual(sequence_name1, "testgenome1") self.assertEqual(sequence_name2, "testgenome2") self.assertEqual(orient, 1) self.assertEqual(len(blocks), 4) self.assertEqual(last_ungapped_start_top, 302) self.assertEqual(last_ungapped_start_bot, 302) self.assertEqual(last_ungapped_end_top, 1120) self.assertEqual(last_ungapped_end_bot, 1120) self.assertEqual(last_ungapped_ident, 84)