Exemplo n.º 1
0
    def test_find_closest_gene(self):
        r = ReorderGenes([], [], {})
        gf = {
            'abc': GeneToFiles('abc', gene_to_files=[0, 2, 2, 0]),
            'efg': GeneToFiles('efg', gene_to_files=[2, 2, -2, 0]),
            'geneA': GeneToFiles('geneA', gene_to_files=[0, 2, 2, 0]),
            'outlier': GeneToFiles('outlier', gene_to_files=[0, 0, 0, 1])
        }

        self.assertEqual('abc', r.find_closest_gene('geneA', gf))
        self.assertEqual('abc', r.find_closest_gene('efg', gf))
        self.assertEqual('efg', r.find_closest_gene('abc', gf))
        self.assertEqual('abc', r.find_closest_gene('outlier', gf))
Exemplo n.º 2
0
    def create_gene_file_objects(self):
        genes_to_files = {}
        for i, g in enumerate(self.gene_names):
            logfc = []
            for report_file in self.genereports:
                logfc.append(int(self.reports_to_gene_logfc[report_file][i]))

            gf = GeneToFiles(g, gene_to_files=logfc)
            if gf.number_of_files > 0:
                genes_to_files[g] = gf

        return genes_to_files
Exemplo n.º 3
0
 def test_all(self):
     g = GeneToFiles('abc', gene_to_files=[2, 11, 10, -15])
     self.assertEqual(4, g.number_of_files)
Exemplo n.º 4
0
 def test_one(self):
     g = GeneToFiles('abc', gene_to_files=[0, 11, 0, 0])
     self.assertEqual(1, g.number_of_files)
Exemplo n.º 5
0
 def test_empty(self):
     g = GeneToFiles('abc', gene_to_files=[0, 0, 0, 0])
     self.assertEqual(0, g.number_of_files)
Exemplo n.º 6
0
    def test_common_counting(self):
        g1 = GeneToFiles('abc', gene_to_files=[0, 11, 13, 0])
        g2 = GeneToFiles('efg', gene_to_files=[0, 11, -12, 0])

        r = ReorderGenes([], [], {})
        self.assertEqual(2, r.files_in_common(g1, g2))