Mercurial > repos > vimalkumarvelayudhan > riboplot
comparison tests/test_riboplot.py @ 12:61c47a1d6a7a
Add a test to check if a valid FASTA file is used (ribocount)
author | Vimalkumar Velayudhan <vimal@biotechcoder.com> |
---|---|
date | Wed, 19 Aug 2015 11:11:37 +0100 |
parents | 096c6bbf4a04 |
children | 628f82e72d72 |
comparison
equal
deleted
inserted
replaced
11:7571f5c89090 | 12:61c47a1d6a7a |
---|---|
116 # using transcriptome FASTA file as the invalid RNA file for test | 116 # using transcriptome FASTA file as the invalid RNA file for test |
117 parser = riboplot.create_parser() | 117 parser = riboplot.create_parser() |
118 args = parser.parse_args(['-b', RIBO_FILE, '-f', TRANSCRIPTOME_FASTA, '-t', TRANSCRIPT_NAME, '-n', TRANSCRIPTOME_FASTA]) | 118 args = parser.parse_args(['-b', RIBO_FILE, '-f', TRANSCRIPTOME_FASTA, '-t', TRANSCRIPT_NAME, '-n', TRANSCRIPTOME_FASTA]) |
119 self.assertRaises(ValueError, ribocore.check_optional_arguments, ribo_file=args.ribo_file, rna_file=args.rna_file) | 119 self.assertRaises(ValueError, ribocore.check_optional_arguments, ribo_file=args.ribo_file, rna_file=args.rna_file) |
120 | 120 |
121 | |
121 class RiboPlotTestCase(unittest.TestCase): | 122 class RiboPlotTestCase(unittest.TestCase): |
122 | 123 |
123 def test_get_codon_positions(self): | 124 def test_get_codon_positions(self): |
124 """Get codon positions in all frames given a sequence.""" | 125 """Get codon positions in all frames given a sequence.""" |
125 # the positions on this sequence were calculated manually. | 126 # the positions on this sequence were calculated manually. |
144 self.assertTrue(os.path.exists(os.path.join(output_dir, fname))) | 145 self.assertTrue(os.path.exists(os.path.join(output_dir, fname))) |
145 shutil.rmtree(output_dir) | 146 shutil.rmtree(output_dir) |
146 | 147 |
147 def test_transcript_with_no_counts(self): | 148 def test_transcript_with_no_counts(self): |
148 """If the transcript has no ribocounts, no plot should be produced.""" | 149 """If the transcript has no ribocounts, no plot should be produced.""" |
149 transcript = 'gi|62955616|ref|NM_001017822.1|' # has no reads | 150 transcript = 'gi|62955616|ref|NM_001017822.1|' # has no reads |
150 output_dir = tempfile.mkdtemp() | 151 output_dir = tempfile.mkdtemp() |
151 parser = riboplot.create_parser() | 152 parser = riboplot.create_parser() |
152 args = parser.parse_args(['-b', RIBO_FILE, '-f', TRANSCRIPTOME_FASTA, '-t', transcript, '-o', output_dir]) | 153 args = parser.parse_args(['-b', RIBO_FILE, '-f', TRANSCRIPTOME_FASTA, '-t', transcript, '-o', output_dir]) |
153 self.assertRaises(ribocore.RiboPlotError, riboplot.main, args) | 154 self.assertRaises(ribocore.RiboPlotError, riboplot.main, args) |
154 for fname in ('riboplot.png', 'riboplot.svg', 'RiboCounts.csv'): | 155 for fname in ('riboplot.png', 'riboplot.svg', 'RiboCounts.csv'): |
155 self.assertFalse(os.path.exists(os.path.join(output_dir, fname))) | 156 self.assertFalse(os.path.exists(os.path.join(output_dir, fname))) |
156 shutil.rmtree(output_dir) | 157 shutil.rmtree(output_dir) |
157 | |
158 @unittest.skip('todo') | |
159 def test_get_ribo_counts(self): | |
160 """Get RiboSeq read counts""" | |
161 pass | |
162 | |
163 @unittest.skip('todo') | |
164 def test_write_ribo_counts(self): | |
165 """Write RiboSeq read counts as CSV.""" | |
166 pass |