Mercurial > repos > yufei-luo > s_mart
diff SMART/Java/Python/test/Test_F_qualToFastq.py @ 18:94ab73e8a190
Uploaded
author | m-zytnicki |
---|---|
date | Mon, 29 Apr 2013 03:20:15 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SMART/Java/Python/test/Test_F_qualToFastq.py Mon Apr 29 03:20:15 2013 -0400 @@ -0,0 +1,38 @@ +import unittest +import os, glob + + +class Test_F_qualToFastq(unittest.TestCase): + + def setUp(self): + self.fastaFileName = "file.fasta" + self.qualFileName = "file.qual" + self.outputFileName = "outputFile.fastq" + + def tearDown(self): + for fileRoot in (self.fastaFileName, self.qualFileName, self.outputFileName): + for file in glob.glob("%s*" % (fileRoot)): + os.remove(file) + + def test_run_simple(self): + handle = open(self.fastaFileName, "w") + handle.write(">test1\n") + handle.write("AAAAAA") + handle.close() + handle = open(self.qualFileName, "w") + handle.write(">test1\n") + handle.write("32\t32\t32\t32\t32\t32") + handle.close() + os.system("python ../qualToFastq.py -f %s -q %s -o %s -v 0" % (self.fastaFileName, self.qualFileName, self.outputFileName)) + handle = open(self.outputFileName) + lines = handle.readlines() + self.assertEquals(len(lines), 4) + self.assertEquals(lines[0], "@test1\n") + self.assertEquals(lines[1], "AAAAAA\n") + self.assertEquals(lines[2], "+\n") + self.assertEquals(lines[3], "AAAAAA\n") + + +if __name__ == "__main__": + unittest.main() +