From: Diane Trout Date: Mon, 4 May 2015 22:24:16 +0000 (-0700) Subject: add test case to make sure we merge tables with different sets of labels correctly X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=helpful_scripts.git;a=commitdiff_plain;h=ee247d7baddc8df0bbe82c7024631b64afdc060e add test case to make sure we merge tables with different sets of labels correctly --- diff --git a/test/m1.tsv b/test/m1.tsv new file mode 100644 index 0000000..ae50984 --- /dev/null +++ b/test/m1.tsv @@ -0,0 +1,7 @@ +genes FPKM +a 1 +b 2 +c 0 +d 4 +e 0 +f 6 diff --git a/test/m2.tsv b/test/m2.tsv new file mode 100644 index 0000000..0b14d28 --- /dev/null +++ b/test/m2.tsv @@ -0,0 +1,7 @@ +genes FPKM +a 10 +b 20 +c 0 +x 40 +y 50 +z 0 diff --git a/test_translate_tsv_genes.py b/test_translate_tsv_genes.py new file mode 100644 index 0000000..e4eb351 --- /dev/null +++ b/test_translate_tsv_genes.py @@ -0,0 +1,15 @@ +#!/usr/bin/python3 + +from unittest import TestCase +from translate_tsv_genes import load_matrixes + + +class TestTranslateTSV(TestCase): + def test_load_matrix(self): + """Make sure we create a matrix indexed by the union of ids + """ + m = load_matrixes(['test/m1.tsv', 'test/m2.tsv'], 'FPKM') + self.assertEqual(m.shape, (9, 2)) + self.assertEqual(list(m.index), + ['a', 'b', 'c', 'd', 'e', 'f', 'x', 'y', 'z']) + self.assertEqual(list(m.keys()), ['m1.tsv', 'm2.tsv'])