Exemple #1
0
    def test_chromosomes(self):
        # Setup
        data_mngr = DataManager(self.db_path, self.mfa_path)
        data_mngr.select_chromosomes_from_database = MagicMock(
            return_value=[("dummy_01", 150, None, 10, 5, float("inf"), 0,
                           'dummy')])
        data_mngr.select_transcription_regions_from_database = MagicMock(
            return_value=[(25, 80, 'dummy_01')])
        data_mngr.probability_landscape = MagicMock(
            return_value="dummy_landscape")

        # Call
        chrm = data_mngr.chromosomes("dummy")

        # Assertions
        data_mngr.select_chromosomes_from_database.assert_called_once_with(
            organism="dummy")
        data_mngr.select_transcription_regions_from_database.assert_called_once_with(
            chromosome_code="dummy_01")
        self.assertEqual(chrm,
                         [{
                             'code': 'dummy_01',
                             'length': 150,
                             'probability_landscape': 'dummy_landscape',
                             'transcription_regions': [{
                                 'start': 25,
                                 'end': 80
                             }],
                             'constitutive_origins': []
                         }])
Exemple #2
0
 def test_probability_landscape(self):
     data_mngr = DataManager(self.db_path, self.mfa_path)
     prob = data_mngr.probability_landscape("dummy_01", 7)
     self.assertEqual(prob, [
         0.00010000000000021103, 0.3334000000000006, 1.0,
         0.6667000000000001, 0.6667000000000001, 0.3334000000000006,
         0.1667500000000004
     ])