示例#1
0
 def test_overlapping_imperfect(self):
     length = 22
     overlap = 3
     tiles = [t[2] for t in tile(protein_seq, length, overlap)]
     assert len(tiles) == 2
     assert all([len(t) == length for t in tiles])
     assert tiles[0] == Seq("METMSDYSKEVSEALSALRGEL")
     assert tiles[1] == Seq("GELSALSAAISNTVRAGSYSAP")
示例#2
0
 def test_overlapping_perfect(self):
     length = 21
     overlap = 3
     tiles = [t[2] for t in tile(protein_seq, length, overlap)]
     assert len(tiles) == 3
     assert all([len(t) == length for t in tiles])
     assert tiles[0] == Seq("METMSDYSKEVSEALSALRGE")
     assert tiles[1] == Seq("RGELSALSAAISNTVRAGSYS")
     assert tiles[2] == Seq("SYSAPVAKDCKAGHCDSKAVL")
示例#3
0
 def test_nonoverlapping_imperfect(self):
     length = 25
     overlap = 0
     tiles = [t[2] for t in tile(protein_seq, length, overlap)]
     assert len(tiles) == 2
     assert all([len(t) == length for t in tiles])
     assert tiles[0] == Seq("METMSDYSKEVSEALSALRGELSAL")
     assert tiles[1] == Seq("SAAISNTVRAGSYSAPVAKDCKAGH")
     assert sum(tiles, Seq("")) == protein_seq[:50]
示例#4
0
 def test_nonoverlapping_perfect(self):
     length = 19
     overlap = 0
     tiles = [t[2] for t in tile(protein_seq, length, overlap)]
     assert len(tiles) == 3
     assert all([len(t) == length for t in tiles])
     assert tiles[0] == Seq("METMSDYSKEVSEALSALR")
     assert tiles[1] == Seq("GELSALSAAISNTVRAGSY")
     assert tiles[2] == Seq("SAPVAKDCKAGHCDSKAVL")
     assert sum(tiles, Seq("")) == protein_seq
示例#5
0
 def test_negative_length(self):
     length = -10
     overlap = 5
     with raises(ValueError):
         tiles = list(tile(protein_seq, length, overlap))
示例#6
0
 def test_overlap_longer_than_length(self):
     length = 10
     overlap = 15
     with raises(ValueError):
         tiles = list(tile(protein_seq, length, overlap))
示例#7
0
 def test_length_longer_than_seq(self):
     length = len(protein_seq) + 5
     overlap = 5
     tiles = list(tile(protein_seq, length, overlap))
     assert len(tiles) == 0
示例#8
0
 def test_short_protein(self):
     length = 56
     overlap = 2
     assert len(list(tile(short_protein_seq, length, overlap))) == 0
     overlap = 20
     assert len(list(tile(short_protein_seq, length, overlap))) == 0
示例#9
0
 def test_zero_length(self):
     length = 0
     overlap = 5
     with raises(ValueError):
         tiles = list(tile(protein_seq, length, overlap))