clintval / sample-sheet

Parse Illumina sample sheets with Python
https://sample-sheet.rtfd.io
MIT License
49 stars 15 forks source link

test_to_picard_basecalling_params_output_files fails on MacOS #116

Open dsommer opened 2 years ago

dsommer commented 2 years ago

Running the test suite on the master branch fails on MacOS. I am running MacOS Monterey 12.2.1 on a INTEL mac with python 3.7.

pytest Error:

E           AssertionError: 'BARC[68 chars]TC\t/System/Volumes/Data/home/user/49-tissue.e[278 chars]\t\n' != 'BARC[68 chars]TC\t/home/user/49-tissue.exp001/49-tissue.GAAC[218 chars]\t\n'
E           Diff is 748 characters long. Set self.maxDiff to None to see it.

Full Error:

>tox
...cut
________________________________________ TestSampleSheet.test_to_picard_basecalling_params_output_files _________________________________________

self = <test_sample_sheet.TestSampleSheet testMethod=test_to_picard_basecalling_params_output_files>

    def test_to_picard_basecalling_params_output_files(self):
        """Test ``to_picard_basecalling_params()`` output files"""
        bam_prefix = '/home/user'
        lanes = [1, 2]
        with TemporaryDirectory() as temp_dir:
            sample1 = Sample(
                {
                    'Sample_ID': 49,
                    'Sample_Name': '49-tissue',
                    'Library_ID': 'exp001',
                    'Description': 'Lorum ipsum!',
                    'index': 'GAACT',
                    'index2': 'AGTTC',
                }
            )
            sample2 = Sample(
                {
                    'Sample_ID': 23,
                    'Sample_Name': '23-tissue',
                    'Library_ID': 'exp001',
                    'Description': 'Test description!',
                    'index': 'TGGGT',
                    'index2': 'ACCCA',
                }
            )

            sample_sheet = SampleSheet()
            sample_sheet.add_sample(sample1)
            sample_sheet.add_sample(sample2)
            sample_sheet.to_picard_basecalling_params(
                directory=temp_dir, bam_prefix=bam_prefix, lanes=lanes
            )

            prefix = Path(temp_dir)
            assert_true((prefix / 'barcode_params.1.txt').exists())
            assert_true((prefix / 'barcode_params.2.txt').exists())
            assert_true((prefix / 'library_params.1.txt').exists())
            assert_true((prefix / 'library_params.2.txt').exists())

            barcode_params = (
                'barcode_sequence_1\tbarcode_sequence_2\tbarcode_name\tlibrary_name\n'  # noqa
                'GAACT\tAGTTC\tGAACTAGTTC\texp001\n'  # noqa
                'TGGGT\tACCCA\tTGGGTACCCA\texp001\n'
            )  # noqa

            library_params = (
                'BARCODE_1\tBARCODE_2\tOUTPUT\tSAMPLE_ALIAS\tLIBRARY_NAME\tDS\n'  # noqa
                'GAACT\tAGTTC\t/home/user/49-tissue.exp001/49-tissue.GAACTAGTTC.{lane}.bam\t49-tissue\texp001\tLorum ipsum!\n'  # noqa
                'TGGGT\tACCCA\t/home/user/23-tissue.exp001/23-tissue.TGGGTACCCA.{lane}.bam\t23-tissue\texp001\tTest description!\n'  # noqa
                'N\tN\t/home/user/unmatched.{lane}.bam\tunmatched\tunmatchedunmatched\t\n'
            )  # noqa

            self.assertMultiLineEqual(
                (prefix / 'barcode_params.1.txt').read_text(), barcode_params
            )
            self.assertMultiLineEqual(
                (prefix / 'barcode_params.2.txt').read_text(), barcode_params
            )
            self.assertMultiLineEqual(
                (prefix / 'library_params.1.txt').read_text(),
>               library_params.format(lane=1),
            )
E           AssertionError: 'BARC[68 chars]TC\t/System/Volumes/Data/home/user/49-tissue.e[278 chars]\t\n' != 'BARC[68 chars]TC\t/home/user/49-tissue.exp001/49-tissue.GAAC[218 chars]\t\n'
E           Diff is 748 characters long. Set self.maxDiff to None to see it.

tests/test_sample_sheet.py:535: AssertionError