comparison tests/test_riboplot.py @ 14:628f82e72d72

Version as released on PyPI 0.1.0
author Vimalkumar Velayudhan <vimal@biotechcoder.com>
date Wed, 26 Aug 2015 16:37:10 +0100
parents 61c47a1d6a7a
children
comparison
equal deleted inserted replaced
13:8a87a2c44d09 14:628f82e72d72
8 8
9 # use testing configuration 9 # use testing configuration
10 CONFIG = riboplot.CONFIG = riboplot.config.TestingConfig() 10 CONFIG = riboplot.CONFIG = riboplot.config.TestingConfig()
11 logging.disable(logging.CRITICAL) 11 logging.disable(logging.CRITICAL)
12 12
13 RIBO_FILE = os.path.join(CONFIG.DATA_DIR, '5hRPFsorted.bam') 13 RIBO_FILE = os.path.join(CONFIG.TEST_DATA_DIR, '5hRPFsorted.bam')
14 RNA_FILE = os.path.join(CONFIG.DATA_DIR, '5hmRNAsorted.bam') 14 RNA_FILE = os.path.join(CONFIG.TEST_DATA_DIR, '5hmRNAsorted.bam')
15 TRANSCRIPT_NAME = 'gi|148357119|ref|NM_001098396.1|' 15 TRANSCRIPT_NAME = 'gi|148357119|ref|NM_001098396.1|'
16 TRANSCRIPTOME_FASTA = os.path.join(CONFIG.DATA_DIR, 'zebrafish.fna') 16 TRANSCRIPTOME_FASTA = os.path.join(CONFIG.TEST_DATA_DIR, 'zebrafish.fna')
17 TRANSCRIPTOME_FASTA_MINUS1 = os.path.join(CONFIG.DATA_DIR, 'zebrafish_minus1.fna') 17 UNRELATED_BAM = os.path.join(CONFIG.TEST_DATA_DIR, 'unrelated.bam')
18 18
19 19
20 class CheckArgumentsTestCase(unittest.TestCase): 20 class CheckArgumentsTestCase(unittest.TestCase):
21 """Check if all arguments sent on the command line are valid.""" 21 """Check if all arguments sent on the command line are valid."""
22 parser = riboplot.create_parser() 22 parser = riboplot.create_parser()
95 args.ribo_file, args.transcriptome_fasta, 'hello') 95 args.ribo_file, args.transcriptome_fasta, 'hello')
96 96
97 def test_missing_transcript_in_bam(self): 97 def test_missing_transcript_in_bam(self):
98 """If a transcript is missing in BAM, an error is raised.""" 98 """If a transcript is missing in BAM, an error is raised."""
99 # testing with an unrelated BAM file 99 # testing with an unrelated BAM file
100 args = self.parser.parse_args(['-b', '/home/vimal/tmp/empty_tp/RiboSeq.bam', '-f', TRANSCRIPTOME_FASTA, 100 args = self.parser.parse_args(['-b', UNRELATED_BAM, '-f', TRANSCRIPTOME_FASTA,
101 '-t', TRANSCRIPT_NAME]) 101 '-t', TRANSCRIPT_NAME])
102 self.assertRaises(ribocore.ArgumentError, ribocore.check_required_arguments, args.ribo_file, 102 self.assertRaises(ribocore.ArgumentError, ribocore.check_required_arguments, args.ribo_file,
103 args.transcriptome_fasta, args.transcript_name) 103 args.transcriptome_fasta, args.transcript_name)
104 104
105 105