Esempio n. 1
0
    def test_order_C002271_c19(self):  # pylint: disable=invalid-name
        cdss = {}
        for i, name in enumerate([
                "STAUR_3972", "STAUR_3982", "STAUR_3983", "STAUR_3984",
                "STAUR_3985"
        ]):
            cdss[name] = DummyCDS(start=i * 10, end=i * 10 + 1, locus_tag=name)

        n_terms = {
            'STAUR_3972': 'L-',
            'STAUR_3982': 'ER',
            'STAUR_3983': 'DK',
            'STAUR_3984': 'SQ',
            'STAUR_3985': 'SV'
        }
        c_terms = {
            'STAUR_3972': 'ES',
            'STAUR_3982': '--',
            'STAUR_3983': 'DS',
            'STAUR_3984': 'DS',
            'STAUR_3985': 'DS'
        }
        start = None
        end = cdss["STAUR_3982"]
        # there are multiple orders of equal score, but sort for simple testing
        possible_orders = orderfinder.find_possible_orders(
            list(cdss.values()), start, end)
        best = orderfinder.rank_biosynthetic_orders(n_terms, c_terms,
                                                    possible_orders)
        best = [gene.get_name() for gene in best]
        assert best == [
            'STAUR_3983', 'STAUR_3972', 'STAUR_3984', 'STAUR_3985',
            'STAUR_3982'
        ]
Esempio n. 2
0
 def run_ordering_simple(self, start, end, gene_list=None):
     start_gene = self.gene_mapping.get(start)
     end_gene = self.gene_mapping.get(end)
     if gene_list is None:
         gene_list = "abc"
     genes = [self.gene_mapping[name] for name in gene_list]
     orders = orderfinder.find_possible_orders(genes, start_gene, end_gene)
     simple_orders = []
     for order in orders:
         simple_orders.append([g.locus_tag for g in order])
     return simple_orders
Esempio n. 3
0
 def test_order_C002271_c19(self):  # pylint: disable=invalid-name
     n_terms = {'STAUR_3972': 'L-', 'STAUR_3982': 'ER',
                'STAUR_3983': 'DK', 'STAUR_3984': 'SQ',
                'STAUR_3985': 'SV'}
     c_terms = {'STAUR_3972': 'ES', 'STAUR_3983': 'DS',
                'STAUR_3984': 'DS', 'STAUR_3985': 'DS'}
     start = ""
     end = "STAUR_3982"
     # there are multiple orders of equal score, but sort for simple testing
     possible_orders = sorted(orderfinder.find_possible_orders(list(n_terms), start, end))
     best = self.run_ranking_as_genes(n_terms, c_terms, possible_orders)
     assert best == ['STAUR_3983', 'STAUR_3972', 'STAUR_3984', 'STAUR_3985', 'STAUR_3982']
Esempio n. 4
0
 def test_permutations_start_and_end(self):
     perms = orderfinder.find_possible_orders(list("abc"), "a", "b")
     assert perms == [["a", "c", "b"]]
     perms = orderfinder.find_possible_orders(list("abce"), "a", "b")
     assert perms == [["a", "c", "e", "b"], ["a", "e", "c", "b"]]
Esempio n. 5
0
 def test_permutations_start_only(self):
     perms = orderfinder.find_possible_orders(list("abc"), "a", "")
     assert perms == [["a", "b", "c"], ["a", "c", "b"]]
 def test_order_finding_size(self):
     cdss = [DummyCDS() for i in range(11)]
     with self.assertRaisesRegex(AssertionError, "input too large"):
         orderfinder.find_possible_orders(cdss, None, None)