def __init__(self, handle, in_read=False, fmt=None, start=None, end=None): """Configure a barcode extractor. :arg stream handle: Handle to an NGS data file. :arg bool in_read: Inspect the read instead of the header. :arg str fmt: Header format. :arg int start: Start of the barcode. :arg int end: End of the barcode. """ self._start = start self._end = end if self._start: self._start -= 1 if not fmt: if not in_read: self._get_barcode = _get_barcode[guess_header_format(handle)] else: self._get_barcode = _get_barcode['unknown'] else: self._get_barcode = _get_barcode[fmt]
def test_guess_header_x(self): assert guess_header_format(self._input_x) == 'x'
def test_guess_header_unknown(self): assert guess_header_format(make_fake_file( '', '@name description\n')) == 'unknown'
def test_guess_header_normal(self): assert guess_header_format(self._input) == 'normal'