Skip to content
Snippets Groups Projects
Commit f143415d authored by Vermaat's avatar Vermaat
Browse files

Unit tests for describe module

git-svn-id: https://humgenprojects.lumc.nl/svn/mutalyzer/trunk@483 eb6bd6ab-9ccd-42b9-aceb-e2899b4a52f1
parent 0b8d5c14
No related branches found
No related tags found
No related merge requests found
File mode changed from 100644 to 100755
......@@ -13,6 +13,7 @@ from mutalyzer.util import palinsnoop, roll
def LCSMatrix(s1, s2) :
"""
Todo: Not yet in use.
"""
y_max = len(s1) + 1
......@@ -36,6 +37,8 @@ def findMax(M, x1, x2, y1, y2) :
N = describe.LCSMatrix("banaan", "na")
describe.findMax(M, 1, 7, 2, 4)
Todo: Not yet in use.
"""
longest, x_longest, y_longest = 0, 0, 0
......@@ -424,7 +427,7 @@ def describeDNA(original, mutated) :
lcs = len(longest_common_suffix(s1[lcp:], s2[lcp:]))
s1_end = len(s1) - lcs
s2_end = len(s2) - lcs
M = LCSMatrix(s1, s2)
return DNA_description(M, s1, s2, lcp, s1_end, lcp, s2_end)
......
"""
Tests for the mutalyzer.describe module.
"""
#import logging; logging.basicConfig()
import os
from nose.tools import *
import mutalyzer
from mutalyzer import describe
class TestDescribe():
"""
Test the mytalyzer.describe module.
"""
def setUp(self):
"""
Nothing.
"""
pass
def test1(self):
"""
Test 1.
"""
result = describe.describeDNA(
'ATGATGATCAGATACAGTGTGATACAGGTAGTTAGACAA',
'ATGATTTGATCAGATACATGTGATACCGGTAGTTAGGACAA')
description = describe.alleleDescription(result)
assert_equal(description, '[5_6insTT;17del;26A>C;35dup]')
def test2(self):
"""
Test 2.
"""
result = describe.describeDNA(
'TAAGCACCAGGAGTCCATGAAGAAGATGGCTCCTGCCATGGAATCCCCTACTCTACTGTG',
'TAAGCACCAGGAGTCCATGAAGAAGCTGGATCCTCCCATGGAATCCCCTACTCTACTGTG')
description = describe.alleleDescription(result)
assert_equal(description, '[26A>C;30C>A;35G>C]')
def test3(self):
"""
Test 3.
"""
result = describe.describeDNA(
'TAAGCACCAGGAGTCCATGAAGAAGATGGCTCCTGCCATGGAATCCCCTACTCTA',
'TAAGCACCAGGAGTCCATGAAGAAGCCATGTCCTGCCATGGAATCCCCTACTCTA')
description = describe.alleleDescription(result)
assert_equal(description, '[26_29inv;30C>G]')
def test4(self):
"""
Test 4.
"""
result = describe.describeDNA(
'TAAGCACCAGGAGTCCATGAAGAAGATGGCTCCTGCCATGGAATCCCCTACTCTA',
'TAAGCACCAGGAGTCCATGAAGAAGCCATGTCCTGCCATGAATCCCCTACTCTA')
description = describe.alleleDescription(result)
assert_equal(description, '[26_29inv;30C>G;41del]')
......@@ -117,6 +117,17 @@ class TestWSGI():
href = '/' + href
self.app.get(href)
def test_description_extractor(self):
"""
Submit the variant description extractor.
"""
r = self.app.get('/descriptionExtract')
form = r.forms[0]
form['referenceSeq'] = 'ATGATGATCAGATACAGTGTGATACAGGTAGTTAGACAA'
form['variantSeq'] = 'ATGATTTGATCAGATACATGTGATACCGGTAGTTAGGACAA'
r = form.submit()
r.mustcontain('g.[5_6insTT;17del;26A>C;35dup]')
def test_checksyntax_valid(self):
"""
Submit the check syntax form with a valid variant.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment