Beispiel #1
0
 def test_two_alignments_same_reference(self):
     mut_df = pd.DataFrame([{
         "mutated_seq": "AAAAAAAA",
         "naive_seq": "AAAAAAAG",
         "mutated_seq_id": "s1",
         "mutation_index": 7,
         "gl_base": "G",
         "mutated_base": "A"
     }])
     r1 = SeqRecord("TTTT", name="r1")
     r2 = SeqRecord("TAAAGAAA", name="r2")
     kmer_dict = make_kmer_dictionary([r1, r2], k=3)
     nalign = n_alignments_per_mutation(mut_df, kmer_dict, k=3)
     # two templates for the mutation, both from r2
     self.assertEqual(
         nalign.loc[nalign.query_name == "s1", "n_alignments"].item(), 2)
Beispiel #2
0
 def test_one_alignment(self):
     mut_df = pd.DataFrame([{
         "mutated_seq": "AAAAAAAA",
         "naive_seq": "AAAAAAAG",
         "mutated_seq_id": "s1",
         "mutation_index": 7,
         "gl_base": "G",
         "mutated_base": "A"
     }])
     r1 = SeqRecord("TTTT", name="r1")
     r2 = SeqRecord("TAAA", name="r2")
     kmer_dict = make_kmer_dictionary([r1, r2], k=3)
     nalign = n_alignments_per_mutation(mut_df, kmer_dict, k=3)
     # there is one AAA sequence in r1 that could serve as a
     # template for the mutation
     self.assertEqual(
         nalign.loc[nalign.query_name == "s1", "n_alignments"].item(), 1)
Beispiel #3
0
 def test_no_alignments(self):
     mut_df = pd.DataFrame([{
         "mutated_seq": "AAAAAAAA",
         "naive_seq": "AAAAAAAG",
         "mutated_seq_id": "s1",
         "mutation_index": 7,
         "gl_base": "G",
         "mutated_base": "A"
     }])
     r1 = SeqRecord("TTTT", name="r1")
     r2 = SeqRecord("TCTC", name="r2")
     kmer_dict = make_kmer_dictionary([r1, r2], k=3)
     nalign = n_alignments_per_mutation(mut_df, kmer_dict, k=3)
     # there are no AAA sequences in the references (r1 and r2), so
     # we should get no alignments
     self.assertEqual(
         nalign.loc[nalign.query_name == "s1", "n_alignments"].item(), 0)