#!/python ### # Test code for protein_motif_search.py # Copyright (C) 2013 Cameron Jack # cameron.jack@anu.edu.au # Genome Discovery Unit, Australian National University # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . ### from protein_motif_search import match_motifs # motifs are defined by: # B = Basic (R, K, H), # X = Hydrophobic (A, V, I, L, M, F, Y, W), # T = Turn (D, E, S, T, N, Q, C, U, G, P) def main(): # positive tests out_lines = match_motifs('R', 'r', 'b', 'B') assert len(out_lines) == 1 assert out_lines[0] == 'r\tb\tR\t0\n' out_lines = match_motifs('A', 'a', 'x', 'X') assert len(out_lines) == 1 assert out_lines[0] == 'a\tx\tA\t0\n' out_lines = match_motifs('D', 'd', 't', 'T') assert len(out_lines) == 1 assert out_lines[0] == 'd\tt\tD\t0\n' out_lines = match_motifs('KMH', 'kmh', 'bxb', 'BXB') assert len(out_lines) == 1 assert out_lines[0] == 'kmh\tbxb\tKMH\t0\n' out_lines = match_motifs('DKMHE', 'dkmhe', 'bxb', 'BXB') assert len(out_lines) == 1 assert out_lines[0] == 'dkmhe\tbxb\tKMH\t1\n' # negative tests out_lines = match_motifs('R', 'r', 'x', 'X') # R is not Hydrophobic assert len(out_lines) == 0 out_lines = match_motifs('X', 'r', 'x', 'X') # no residue with symbol X assert len(out_lines) == 0 out_lines = match_motifs('DRLP', 'drlp', 'xbx', 'XBX') # only two matches, not all 3 assert len(out_lines) == 0 if __name__ == '__main__': main()