示例#1
0
    def test_get_sample_pipeline_log(self):
        """Get the sample pipeline logfile
        """
        sample = td.generate_sample()
        # Assert that an empty directory returns None
        self.assertIsNone(
            sq.get_sample_pipeline_log(self.rootdir, sample),
            "Getting a sample log from an empty directory did not return None")

        # Assert that non-relevant log files are not returned
        for n in range(5):
            utils.touch_file(
                os.path.join(self.rootdir,
                             "{}-bcbb.log".format(td.generate_sample())))
        self.assertIsNone(
            sq.get_sample_pipeline_log(self.rootdir, sample),
            "Getting a non-existing sample log did not return None")

        # Assert that the correct log file is returned when it exists
        utils.touch_file(
            os.path.join(self.rootdir, "{}-bcbb.log".format(sample)))
        self.assertEqual(
            os.path.join(self.rootdir, "{}-bcbb.log".format(sample)),
            sq.get_sample_pipeline_log(self.rootdir, sample),
            "Getting an existing sample log file did not return the expected file"
        )
示例#2
0
 def test_fastq_screen_finished(self):
     """Detecting finished state of fastq_screen
     """
     
     # Assert that an empty directory doesn't indicate finished state
     self.assertFalse(sq.fastq_screen_finished(self.rootdir),
                      "Fastq screen should not be considered finished without output files")
     
     # Create an output file and corresponding png but no rows in output
     sample_file = os.path.join(self.rootdir,"{}_fastq_screen.txt".format(td.generate_sample()))
     png_file = "{}.png".format(os.path.splitext(sample_file)[0])
     utils.touch_file(sample_file)
     utils.touch_file(png_file)
     self.assertFalse(sq.fastq_screen_finished(self.rootdir),
                      "Fastq screen should not be considered finished with empty output file")
     
     # Write some output and assert fastq_screen is detected as finished
     with open(sample_file,"w") as fh:
         for n in range(5):
             fh.write("{}\n".format(str(n)))
     self.assertTrue(sq.fastq_screen_finished(self.rootdir),
                      "Fastq screen should be considered finished with non-empty output file and corresponding png")
     
     # Remove the png and assert fastq_screen is not finished
     os.unlink(png_file)
     self.assertFalse(sq.fastq_screen_finished(self.rootdir),
                      "Fastq screen should not be considered finished with non-empty output file but without corresponding png")
示例#3
0
 def test_fastq_screen_finished(self):
     """Detecting finished state of fastq_screen
     """
     
     # Assert that an empty directory doesn't indicate finished state
     self.assertFalse(sq.fastq_screen_finished(self.rootdir),
                      "Fastq screen should not be considered finished without output files")
     
     # Create an output file and corresponding png but no rows in output
     sample_file = os.path.join(self.rootdir,"{}_fastq_screen.txt".format(td.generate_sample()))
     png_file = "{}.png".format(os.path.splitext(sample_file)[0])
     utils.touch_file(sample_file)
     utils.touch_file(png_file)
     self.assertFalse(sq.fastq_screen_finished(self.rootdir),
                      "Fastq screen should not be considered finished with empty output file")
     
     # Write some output and assert fastq_screen is detected as finished
     with open(sample_file,"w") as fh:
         for n in range(5):
             fh.write("{}\n".format(str(n)))
     self.assertTrue(sq.fastq_screen_finished(self.rootdir),
                      "Fastq screen should be considered finished with non-empty output file and corresponding png")
     
     # Remove the png and assert fastq_screen is not finished
     os.unlink(png_file)
     self.assertFalse(sq.fastq_screen_finished(self.rootdir),
                      "Fastq screen should not be considered finished with non-empty output file but without corresponding png")
示例#4
0
 def test_get_sample_pipeline_log(self):
     """Get the sample pipeline logfile
     """
     sample = td.generate_sample()
     # Assert that an empty directory returns None
     self.assertIsNone(sq.get_sample_pipeline_log(self.rootdir,sample),
                       "Getting a sample log from an empty directory did not return None")
     
     # Assert that non-relevant log files are not returned
     for n in range(5):
         utils.touch_file(os.path.join(self.rootdir,"{}-bcbb.log".format(td.generate_sample())))
     self.assertIsNone(sq.get_sample_pipeline_log(self.rootdir,sample),
                       "Getting a non-existing sample log did not return None")
     
     # Assert that the correct log file is returned when it exists
     utils.touch_file(os.path.join(self.rootdir,"{}-bcbb.log".format(sample)))
     self.assertEqual(os.path.join(self.rootdir,"{}-bcbb.log".format(sample)),sq.get_sample_pipeline_log(self.rootdir,sample),
                      "Getting an existing sample log file did not return the expected file")