Example #1
0
 def test_single_X(self):
     p = Seq("GYTXTRS")
     r = x_to_ggsg(p)
     assert r == Seq("GYTGTRS")
     p = Seq("XGYTTRS")
     r = x_to_ggsg(p)
     assert r == Seq("GGYTTRS")
     p = Seq("GYTTRSX")
     r = x_to_ggsg(p)
     assert r == Seq("GYTTRSG")
Example #2
0
def x2ggsg(input, output):
    """Replace stretches of Xs with Serine-Glycine linker (in a GGSG pattern)

    INPUT and OUTPUT are paths to fasta files or "-" to specify STDIN/STDOUT.

    """
    for (name, seq, qual) in readfq(input):
        replacement = x_to_ggsg(seq)
        if replacement != seq:
            output_title = f"{name}|withGSlinker"
        else:
            output_title = name
        print(f">{output_title}\n{replacement}", file=output)
Example #3
0
 def test_many_Xs(self):
     p = Seq("GYTXXXXXXXXXTRS")
     r = x_to_ggsg(p)
     assert r == Seq("GYTGGSGGGSGGTRS")
Example #4
0
 def test_many_single_Xs(self):
     p = Seq("GXYTXTXRXS")
     r = x_to_ggsg(p)
     assert r == Seq("GGYTGTGRGS")
Example #5
0
 def test_double_X(self):
     p = Seq("GYTXXTRS")
     r = x_to_ggsg(p)
     assert r == Seq("GYTGGTRS")
Example #6
0
 def test_multiple_stretches(self):
     p = Seq("XGYTXXXTRXXS")
     r = x_to_ggsg(p)
     assert r == Seq("GGYTGGSTRGGS")
Example #7
0
 def test_Xs_infix(self):
     p = Seq("GYTXXXXXTRS")
     r = x_to_ggsg(p)
     assert r == Seq("GYTGGSGGTRS")
Example #8
0
 def test_Xs_suffix(self):
     p = Seq("GYTTRSXXXX")
     r = x_to_ggsg(p)
     assert r == Seq("GYTTRSGGSG")
Example #9
0
 def test_Xs_prefix(self):
     p = Seq("XXXGYTTRS")
     r = x_to_ggsg(p)
     assert r == Seq("GGSGYTTRS")
Example #10
0
 def test_no_Xs(self):
     p = Seq("GYTTRS")
     r = x_to_ggsg(p)
     assert p == r
Example #11
0
 def test_null_seq(self):
     p = Seq("")
     r = x_to_ggsg(p)
     assert p == r