def test_save_load(Tabletype): kh = Tabletype(5) ttype = type(kh) savefile = utils.get_temp_filename('tablesave.out') # test add(dna) x = kh.add("ATGGC") z = kh.get("ATGGC") assert z == 1 kh.save(savefile) # should we provide a single load function here? yes, probably. @CTB if ttype == _Countgraph: loaded = khmer.load_countgraph(savefile) elif ttype == Counttable: loaded = Counttable.load(savefile) elif ttype == _SmallCountgraph: loaded = khmer.load_countgraph(savefile, small=True) elif ttype == SmallCounttable: loaded = SmallCounttable.load(savefile) elif ttype == _Nodegraph: loaded = khmer.load_nodegraph(savefile) elif ttype == Nodetable: loaded = Nodetable.load(savefile) else: raise Exception("unknown tabletype") z = loaded.get('ATGGC') assert z == 1
def test_count_second_pass(): mask = Nodetable.load(data_file('minitrio/mask.nt')) counts = Counttable.load(data_file('minitrio/trio-proband-mask-counts.ct')) seqfile = data_file('minitrio/trio-proband.fq.gz') abund = count_second_pass([seqfile], counts) assert abund == {10: 6, 11: 10, 12: 12, 13: 18, 14: 16, 15: 11, 16: 9, 17: 9, 18: 11, 19: 8, 20: 9, 21: 7, 22: 3}