1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
#!/usr/bin/env python
"""Tests for the Microarray output parser
"""
from __future__ import division
from cogent.util.unit_test import TestCase, main
from cogent.parse.agilent_microarray import *
__author__ = "Jeremy Widmann"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__credits__ = ["Jeremy Widmann", "Rob Knight"]
__license__ = "GPL"
__version__ = "1.5.3"
__maintainer__ = "Jeremy Widmann"
__email__ = "jeremy.widmann@colorado.edu"
__status__ = "Production"
class MicroarrayParserTests(TestCase):
"""Tests for MicroarrayParser.
"""
def setUp(self):
"""Setup function for MicroarrayParser tests.
"""
self.sample_file = ['first line in file',
'second line, useless data',
'FEATURES\tFirst\tL\tProbeName\tGeneName\tLogRatio',
'DATA\tFirst\tData\tProbe1\tGene1\t0.02',
'DATA\tSecond\tData\tProbe2\tGene2\t-0.34']
def test_MicroarrayParser_empty_list(self):
#Empty list should return tuple of empty lists
self.assertEqual(MicroarrayParser([]),([],[],[]))
def test_MicroarrayParser(self):
#Given correct file format, return correct results
self.assertEqual(MicroarrayParser(self.sample_file),
(['PROBE1','PROBE2'],
['GENE1','GENE2'],[float(0.02),float(-0.34)]))
#run if called from command-line
if __name__ == "__main__":
main()
|