示例#1
0
 def test_predict_crispr(self):
     for fp, params, flags in zip(self.positive_fps, self.positive_params,
                                  self.positive_flags):
         prefix = self.positive_prefix
         res = predict_crispr(fp, self.temp_dir,
                              prefix,
                              gff=flags['gff'],
                              gffFull=flags['gffFull'],
                              spac=flags['spacers'], params=params)
         self.assertEqual(res['ExitStatus'], 0)
         if flags['gff']:
             suffix = 'gff'
         elif flags['gffFull']:
             suffix = 'gffFull'
         else:
             suffix = 'crisprs'
         fp = self.get_minced_path('.'.join([prefix, suffix]))
         with open(fp) as f:
             self.assertEqual(
                  # skip comment lines as some contain runtime info
                  [i for i in f.readlines()
                   if not i.startswith('Time')],
                  [j for j in res['output'].readlines()
                   if not j.startswith('Time')])
         # SPACERS flag produces an *additional* OUT_spacers.fa file
         # other flags produce OUT.FLAG outputs
         if flags['spacers']:
             suffix = 'spacers.fa'
             fp = self.get_minced_path('_'.join([prefix, suffix]))
             with open(fp) as f:
                 self.assertEqual(f.read(), res['spacers'].read())
         res['StdOut'].close()
         res['StdErr'].close()
示例#2
0
 def test_predict_crispr_wrong_input(self):
     for fp in self.negative_fps:
         with self.assertRaisesRegex(
                 ApplicationError,
                 r'Error constructing CommandLineAppResult.'):
             predict_crispr(fp, self.temp_dir, 'foo')