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")
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")
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]
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
def test_negative_length(self): length = -10 overlap = 5 with raises(ValueError): tiles = list(tile(protein_seq, length, overlap))
def test_overlap_longer_than_length(self): length = 10 overlap = 15 with raises(ValueError): tiles = list(tile(protein_seq, length, overlap))
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
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
def test_zero_length(self): length = 0 overlap = 5 with raises(ValueError): tiles = list(tile(protein_seq, length, overlap))