Exemplo n.º 1
0
 def test_complement_ambiguous_rna_values(self):
     for ambig_char, values in sorted(ambiguous_rna_values.items()):
         # Will default to DNA if neither T nor U found...
         compl_values = str(Seq.Seq(values).complement().transcribe())
         ambig_values = ambiguous_rna_values[
             ambiguous_rna_complement[ambig_char]]
         self.assertEqual(set(compl_values), set(ambig_values))
Exemplo n.º 2
0
 def test_complement_ambiguous_rna_values(self):
     for ambig_char, values in sorted(ambiguous_rna_values.items()):
         compl_values = str(
             Seq.Seq(values, alphabet=IUPAC.ambiguous_rna).complement())
         self.assertEqual(
             set(compl_values),
             set(ambiguous_rna_values[
                 ambiguous_rna_complement[ambig_char]]))
Exemplo n.º 3
0
 def test_complement_ambiguous_rna_values(self):
     for ambig_char, values in sorted(ambiguous_rna_values.items()):
         compl_values = str(
             # Will default to DNA if neither T or U found...
             # Turn black code style off
             # fmt: off
             Seq.Seq(values).complement().transcribe()
             # fmt: on
         )
         ambig_values = ambiguous_rna_values[
             ambiguous_rna_complement[ambig_char]]
         self.assertEqual(set(compl_values), set(ambig_values))
Exemplo n.º 4
0

print("")
print("DNA Ambiguity mapping: %s" % sorted_dict(ambiguous_dna_values))
print("DNA Complement mapping: %s" % sorted_dict(ambiguous_dna_complement))
for ambig_char, values in sorted(ambiguous_dna_values.items()):
    compl_values = complement(values)
    print("%s={%s} --> {%s}=%s" % (ambig_char, values, compl_values,
                                   ambiguous_dna_complement[ambig_char]))
    assert set(compl_values) == set(
        ambiguous_dna_values[ambiguous_dna_complement[ambig_char]])

print("")
print("RNA Ambiguity mapping: %s" % sorted_dict(ambiguous_rna_values))
print("RNA Complement mapping: %s" % sorted_dict(ambiguous_rna_complement))
for ambig_char, values in sorted(ambiguous_rna_values.items()):
    compl_values = complement(values).replace(
        "T", "U")  # need to help as no alphabet
    print("%s={%s} --> {%s}=%s" % (ambig_char, values, compl_values,
                                   ambiguous_rna_complement[ambig_char]))
    assert set(compl_values) == set(
        ambiguous_rna_values[ambiguous_rna_complement[ambig_char]])

print("")
print("Reverse complements:")
for sequence in [
        Seq.Seq("".join(sorted(ambiguous_rna_values))),
        Seq.Seq("".join(sorted(ambiguous_dna_values))),
        Seq.Seq("".join(sorted(ambiguous_rna_values)), Alphabet.generic_rna),
        Seq.Seq("".join(sorted(ambiguous_dna_values)), Alphabet.generic_dna),
        Seq.Seq("".join(sorted(ambiguous_rna_values)).replace("X", ""),
Exemplo n.º 5
0
    return "{%s}" % ", ".join("%s: %s" % (repr(k), repr(v))
                              for k, v in sorted(d.items()))

print("")
print("DNA Ambiguity mapping: %s" % sorted_dict(ambiguous_dna_values))
print("DNA Complement mapping: %s" % sorted_dict(ambiguous_dna_complement))
for ambig_char, values in sorted(ambiguous_dna_values.items()):
    compl_values = complement(values)
    print("%s={%s} --> {%s}=%s" %
        (ambig_char, values, compl_values, ambiguous_dna_complement[ambig_char]))
    assert set(compl_values) == set(ambiguous_dna_values[ambiguous_dna_complement[ambig_char]])

print("")
print("RNA Ambiguity mapping: %s" % sorted_dict(ambiguous_rna_values))
print("RNA Complement mapping: %s" % sorted_dict(ambiguous_rna_complement))
for ambig_char, values in sorted(ambiguous_rna_values.items()):
    compl_values = complement(values).replace("T", "U")  # need to help as no alphabet
    print("%s={%s} --> {%s}=%s" %
        (ambig_char, values, compl_values, ambiguous_rna_complement[ambig_char]))
    assert set(compl_values) == set(ambiguous_rna_values[ambiguous_rna_complement[ambig_char]])

print("")
print("Reverse complements:")
for sequence in [Seq.Seq("".join(sorted(ambiguous_rna_values))),
            Seq.Seq("".join(sorted(ambiguous_dna_values))),
            Seq.Seq("".join(sorted(ambiguous_rna_values)), Alphabet.generic_rna),
            Seq.Seq("".join(sorted(ambiguous_dna_values)), Alphabet.generic_dna),
            Seq.Seq("".join(sorted(ambiguous_rna_values)).replace("X", ""), IUPAC.IUPACAmbiguousRNA()),
            Seq.Seq("".join(sorted(ambiguous_dna_values)).replace("X", ""), IUPAC.IUPACAmbiguousDNA()),
            Seq.Seq("AWGAARCKG")]:  # Note no U or T
        print("%s -> %s"
Exemplo n.º 6
0
 def test_complement_ambiguous_rna_values(self):
     for ambig_char, values in sorted(ambiguous_rna_values.items()):
         compl_values = str(Seq.Seq(values, alphabet=IUPAC.ambiguous_rna).complement())
         self.assertEqual(set(compl_values),
                          set(ambiguous_rna_values[ambiguous_rna_complement[ambig_char]]))