Ejemplo n.º 1
0
    def test_contigs_to_genes_one_hit(self):
        """Tests that given one blast hit, will give the correct keys and values"""
        gene_detector = GeneDetector('madansi/tests/data/assembly.fa',
                                     'madansi/tests/data/one_blast_hit')
        self.assertCountEqual(list(gene_detector.contigs_to_genes().keys()),
                              ['Contig1', 'Contig2', 'Contig3'])

        self.assertEqual(
            gene_detector.contigs_to_genes()['Contig2'].gene_objects, {})
        self.assertEqual(
            gene_detector.contigs_to_genes()['Contig3'].gene_objects, {})
        self.assertCountEqual(
            list(gene_detector.contigs_to_genes()
                 ['Contig1'].gene_objects.keys()), ['gene1'])

        my_gene = Gene(-1, 402, 1, None, 'Contig1', 3)
        self.assertEqual(
            gene_detector.contigs_to_genes()
            ['Contig1'].gene_objects['gene1'].orientation, my_gene.orientation)
        self.assertEqual(
            gene_detector.contigs_to_genes()
            ['Contig1'].gene_objects['gene1'].start, my_gene.start)
        self.assertEqual(
            gene_detector.contigs_to_genes()
            ['Contig1'].gene_objects['gene1'].end, my_gene.end)
        self.assertEqual(
            gene_detector.contigs_to_genes()
            ['Contig1'].gene_objects['gene1'].node, my_gene.node)
        self.assertEqual(
            gene_detector.contigs_to_genes()
            ['Contig1'].gene_objects['gene1'].contig, my_gene.contig)
        self.assertEqual(
            gene_detector.contigs_to_genes()
            ['Contig1'].gene_objects['gene1'].qry_start, my_gene.qry_start)
Ejemplo n.º 2
0
 def test_contigs_to_genes_four_hits(self):
     """Tests output for multiple blast hits"""
     gene_detector = GeneDetector('madansi/tests/data/assembly.fa', 'madansi/tests/data/four_blast_hits' )
     self.assertCountEqual(list(gene_detector.contigs_to_genes().keys()), ['Contig1', 'Contig2', 'Contig3'])
     self.assertCountEqual(list(gene_detector.contigs_to_genes()['Contig1'].gene_objects.keys()), ['gene1', 'gene2', 'gene3'])
     self.assertCountEqual(list(gene_detector.contigs_to_genes()['Contig2'].gene_objects.keys()), ['geneA'])
     self.assertCountEqual(list(gene_detector.contigs_to_genes()['Contig3'].gene_objects.keys()), [])
Ejemplo n.º 3
0
 def test_contigs_to_genes_no_hits(self):
     """Tests that the correct keys are given in the contigs object and that there is no value for each contig in this object"""
     gene_detector = GeneDetector('madansi/tests/data/assembly.fa',
                                  'madansi/tests/data/empty_file')
     self.assertCountEqual(list(gene_detector.contigs_to_genes().keys()),
                           ['Contig1', 'Contig2', 'Contig3'])
     self.assertEqual(
         gene_detector.contigs_to_genes()['Contig1'].gene_objects, {})
Ejemplo n.º 4
0
 def test_contigs_to_genes_four_hits(self):
     """Tests output for multiple blast hits"""
     gene_detector = GeneDetector('madansi/tests/data/assembly.fa',
                                  'madansi/tests/data/four_blast_hits')
     self.assertCountEqual(list(gene_detector.contigs_to_genes().keys()),
                           ['Contig1', 'Contig2', 'Contig3'])
     self.assertCountEqual(
         list(gene_detector.contigs_to_genes()
              ['Contig1'].gene_objects.keys()), ['gene1', 'gene2', 'gene3'])
     self.assertCountEqual(
         list(gene_detector.contigs_to_genes()
              ['Contig2'].gene_objects.keys()), ['geneA'])
     self.assertCountEqual(
         list(gene_detector.contigs_to_genes()
              ['Contig3'].gene_objects.keys()), [])
Ejemplo n.º 5
0
 def test_contigs_to_genes_one_hit(self):
     """Tests that given one blast hit, will give the correct keys and values"""
     gene_detector = GeneDetector('madansi/tests/data/assembly.fa', 'madansi/tests/data/one_blast_hit')
     self.assertCountEqual(list(gene_detector.contigs_to_genes().keys()), ['Contig1', 'Contig2', 'Contig3'])
     
     self.assertEqual(gene_detector.contigs_to_genes()['Contig2'].gene_objects, {})
     self.assertEqual(gene_detector.contigs_to_genes()['Contig3'].gene_objects, {})
     self.assertCountEqual(list(gene_detector.contigs_to_genes()['Contig1'].gene_objects.keys()), ['gene1'])
 
     my_gene = Gene(-1,402,1,None, 'Contig1',3)
     self.assertEqual(gene_detector.contigs_to_genes()['Contig1'].gene_objects['gene1'].orientation, my_gene.orientation)
     self.assertEqual(gene_detector.contigs_to_genes()['Contig1'].gene_objects['gene1'].start, my_gene.start)
     self.assertEqual(gene_detector.contigs_to_genes()['Contig1'].gene_objects['gene1'].end, my_gene.end)
     self.assertEqual(gene_detector.contigs_to_genes()['Contig1'].gene_objects['gene1'].node, my_gene.node)
     self.assertEqual(gene_detector.contigs_to_genes()['Contig1'].gene_objects['gene1'].contig, my_gene.contig)
     self.assertEqual(gene_detector.contigs_to_genes()['Contig1'].gene_objects['gene1'].qry_start, my_gene.qry_start)
Ejemplo n.º 6
0
 def test_contigs_to_genes_no_hits(self):
     """Tests that the correct keys are given in the contigs object and that there is no value for each contig in this object"""
     gene_detector = GeneDetector('madansi/tests/data/assembly.fa', 'madansi/tests/data/empty_file')
     self.assertCountEqual(list(gene_detector.contigs_to_genes().keys()), ['Contig1', 'Contig2', 'Contig3'])
     self.assertEqual(gene_detector.contigs_to_genes()['Contig1'].gene_objects, {})