Exemplo n.º 1
0
    def test_load_tabular_motif_counts_array(self):
        """correctly loads tabular data for MotifCountsArray"""

        data = [[2, 4], [3, 5], [4, 8]]
        mca = MotifCountsArray(data, "AB")
        loader = io_app.load_tabular(sep="\t", as_type="motif_counts")
        with TemporaryDirectory(dir=".") as dirname:
            writer = io_app.write_tabular(data_path=dirname, format="tsv")
            outpath = join(dirname, "delme.tsv")
            writer.write(mca, identifier=outpath)
            new = loader(outpath)
            self.assertEqual(mca.to_dict(), new.to_dict())
Exemplo n.º 2
0
 def test_to_dict(self):
     """correctly converts to a dict"""
     motifs = ["A", "C", "D"]
     counts = [[4, 0, 0]]
     marr = MotifCountsArray(counts, motifs)
     self.assertEqual(marr.to_dict(), {0: {"A": 4, "C": 0, "D": 0}})