Esempio n. 1
0
def _samples_from_input_files(src_re, filter_suffix="", **kwargs):
    """Generate sample names from input files.

    src_re (IOTarget): IOTarget object corresponding to the source
                         regular expression
    filter_suffix (str): only use given suffix to filter for input
                         file names. Useful if many result files exist
                         for a sample

    Returns:
      samples (list): list of dictionaries, where the keys of each
        dictionary correspond to read group identifiers

    """
    smllogger.debug("Getting sample information from input files")
    inputs = find_files(regexp=src_re.pattern + filter_suffix, use_full_path=True, **kwargs)
    return [src_re.search(f, return_instance=True).concat_groupdict for f in inputs]
Esempio n. 2
0
 def test_find_files_search(self, walk, mocker):
     """Find files using search"""
     mock_walk = mocker.patch('os.walk')
     mock_walk.return_value = walk
     f = find_files(regexp=".fastq", search=True)
     assert f == ['./1_121023_FLOWCELL_FOO.fastq.gz', './foo/1_121023_FLOWCELL_BAR.fastq.gz']
Esempio n. 3
0
 def test_find_fastq_files(self, walk, mocker):
     """Find fastq files using match"""
     mock_walk = mocker.patch('os.walk')
     mock_walk.return_value = walk
     f = find_files(regexp="\w+.fastq.gz")
     assert f == ['./1_121023_FLOWCELL_FOO.fastq.gz', './foo/1_121023_FLOWCELL_BAR.fastq.gz']