Exemplo n.º 1
0
 def test_seq_to_symbol_factory(self):
     """checks factory function for conversion works"""
     motifs = ["AA", "AT", "TT"]
     seq_to_symbols = SeqToSymbols(motifs)
     got = seq_to_symbols("AATGGTTA")
     assert_equal(got, numpy.array([1, 1, 0, 0, 0, 1, 0, 0]))
     got = seq_to_symbols("AAGATT")
     assert_equal(got, numpy.array([1, 0, 0, 1, 1, 0], numpy.uint8))
Exemplo n.º 2
0
 def test_permutation_all(self):
     """performs permutation test of Hybrid, but considers all stats"""
     s = ("ATCGTTGGGACCGGTTCAAGTTTTGGAACTCGCAAGGGGTGAATGGTCTTCGTCTAACGCTGG"
          "GGAACCCTGAATCGTTGTAACGCTGGGGTCTTTAACCGTTCTAATTTAACGCTGGGGGGTTCT"
          "AATTTTTAACCGCGGAATTGCGTC")
     seq_to_symbol = SeqToSymbols(self.motifs, length=len(s))
     hybrid_calc = Hybrid(len(s), period=4, return_all=True)
     stat, p = blockwise_bootstrap(s,
                                   hybrid_calc,
                                   block_size=10,
                                   num_reps=1000,
                                   seq_to_symbols=seq_to_symbol)
Exemplo n.º 3
0
 def test_permutation_skips(self):
     """permutation test correctly handles data without symbols"""
     s = "N" * 150
     seq_to_symbol = SeqToSymbols(self.motifs, length=len(s))
     ipdft_calc = Ipdft(len(s), llim=2, period=4)
     stat, p = blockwise_bootstrap(
         s,
         ipdft_calc,
         block_size=10,
         num_reps=1000,
         seq_to_symbols=seq_to_symbol,
         num_stats=1,
     )
     self.assertEqual(stat, 0.0)
     self.assertEqual(p, 1.0)
Exemplo n.º 4
0
 def test_permutation(self):
     s = (
         "ATCGTTGGGACCGGTTCAAGTTTTGGAACTCGCAAGGGGTGAATGGTCTTCGTCTAACGCTGG"
         "GGAACCCTGAATCGTTGTAACGCTGGGGTCTTTAACCGTTCTAATTTAACGCTGGGGGGTTCT"
         "AATTTTTAACCGCGGAATTGCGTC"
     )
     seq_to_symbol = SeqToSymbols(self.motifs, length=len(s))
     hybrid_calc = Hybrid(len(s), llim=2, period=4)
     ipdft_calc = Ipdft(len(s), llim=2, period=4)
     stat, p = blockwise_bootstrap(
         s, hybrid_calc, block_size=10, num_reps=1000, seq_to_symbols=seq_to_symbol
     )
     stat, p = blockwise_bootstrap(
         s, ipdft_calc, block_size=10, num_reps=1000, seq_to_symbols=seq_to_symbol
     )