Esempio n. 1
0
    def test_no_read_files_in_list(self):
        """
        The file list in the sample sheet is invalid
        :return:
        """
        directory = path.join(path_to_module, "fake_dir_data")
        file_path = path.join(directory, "no_read_files.csv")

        with self.assertRaises(SampleSheetError):
            res = sample_parser._parse_samples(file_path)
Esempio n. 2
0
    def test_no_forward_read(self):
        """
        No Valid files were found with names given in sample sheet
        :return:
        """
        directory = path.join(path_to_module, "fake_dir_data")
        file_path = path.join(directory, "no_forward.csv")

        with self.assertRaises(SampleSheetError):
            res = sample_parser._parse_samples(file_path)
Esempio n. 3
0
    def test_no_reverse_read_with_comma(self):
        """
        The file list in the sample sheet is invalid
        :return:
        """
        directory = path.join(path_to_module, "fake_dir_data")
        file_path = path.join(directory, "no_reverse_with_comma.csv")

        res = sample_parser._parse_samples(file_path)
        # This should have an empty file reverse
        self.assertEqual(res[0]["File_Reverse"], "")
Esempio n. 4
0
    def test_valid(self):
        """
        Given a valid sample sheet, parse correctly
        :return:
        """
        sheet_file = path.join(path_to_module, "fake_dir_data",
                               "SampleList_simple.csv")

        file_name_1 = "file_1.fastq.gz"
        file_name_2 = "file_2.fastq.gz"

        res = sample_parser._parse_samples(sheet_file)

        # Check we have 1 sample
        self.assertEqual(len(res), 1)
        # Check if data is correct
        self.assertEqual(res[0].sample_name, "my-sample-1")
        self.assertEqual(res[0].get_uploadable_dict()["sample_project"], "75")
        self.assertEqual(res[0].get_uploadable_dict()["File_Forward"], file_name_1)
        self.assertEqual(res[0].get_uploadable_dict()["File_Reverse"], file_name_2)