def test_os_sep(self, mocker):
     mock_re = mocker.patch('snakemakelib.sample.regexp.re.match')
     mock_re.return_value = None
     rg = ReadGroup("(?P<SM>[a-zA-Z0-9]+)/(?P<PU>[A-Za-z0-9]+)/(?P<PU1>[0-9])_(?P<DT>[0-9]+)_(?P<PU2>[A-Z0-9]+XX)_(?P=SM)")
     rg.parse("/data/projects/J.Doe_00_01/P001_101/121015_BB002BBBXX/1_121015_BB002BBBXX_P001_101_1.fastq.gz", "")
     (args, kw) = mock_re.call_args
     assert args[0].startswith('(?:[\\.\\w\\/]+)?\\/')
 def test_rg_disallowed_key(self):
     """Test setting a read group object with a key not present in allowed keys"""
     with pytest.raises(DisallowedKeyException):
         rg = ReadGroup("(?P<PU1>[0-9])_(?P<DATE>[0-9]+)_(?P<PU2>[A-Z0-9]+XX)_(?P<SM>P[0-9]+_[0-9]+)")
         s = (rg.parse("../data/projects/J.Doe_00_01/P001_101/121015_BB002BBBXX/1_121015_BB002BBBXX_P001_101_1.fastq.gz"))
 def test_rg_parse_illumina_like(self):
     """Test parsing illumina-like-based file names"""
     rg = ReadGroup("(?P<SM>[a-zA-Z0-9_]+)/(?P<DT>[0-9]+)_(?P<PU2>[A-Z0-9]+XX)/(?P<PU1>[0-9])_(?P=DT)_(?P=PU2)_(?P=SM)")
     rg.parse("../data/projects/J.Doe_00_01/P001_101/121015_BB002BBBXX/1_121015_BB002BBBXX_P001_101_1.fastq.gz")
     assert "--date 2012-10-15 --identifier 1_121015_BB002BBBXX_P001_101 --platform-unit 1_BB002BBBXX --sample P001_101" == str(rg)