src/fastq_filter/__init__.py
def filter_string_to_filters(filter_string: str
                             ) -> List[Callable[[dnaio.Sequence], bool]]:
    """Convert a filter string such as 'min_length:50|mean_quality:20 into
    a list of filter functions that can be used by Python's builtin filter
    function."""
    filters: List[Callable[[dnaio.Sequence], bool]] = []
    for single_filter_string in filter_string.split('|'):
        filter_name, filter_argstring = single_filter_string.split(':')
        try:
            filter_function, filter_argtypes, _ = FILTERS[filter_name]
        except KeyError:
            raise ValueError(f"Unknown filter: {filter_name}. Choose one of:"
                             f" {' '.join(FILTERS.keys())}")
        # Convert the strings from the command line in the appropriate types
        filter_args = [filter_argtypes[pos](arg) for pos, arg
                       in enumerate(filter_argstring.split(','))]

        filters.append(functools.partial(filter_function, *filter_args))
    return filters
Convert a filter string such as 'min_length:50|mean_quality:20 into
    a list of filter functions that can be used by Python's builtin filter
    function.
Convert a filter string such as 'min_length:50|mean_quality:20 into
a list of filter functions that can be used by Python's builtin filter
function.
Convert a filter string such as ' min_length : 50|mean_quality : 20 into a list of filter functions that can be used by Python ' s builtin filter function .
def filter_string_to_filters(filter_string: str
                             ) -> List[Callable[[dnaio.Sequence], bool]]:
    filters: List[Callable[[dnaio.Sequence], bool]] = []
    for single_filter_string in filter_string.split('|'):
        filter_name, filter_argstring = single_filter_string.split(':')
        try:
            filter_function, filter_argtypes, _ = FILTERS[filter_name]
        except KeyError:
            raise ValueError(f"Unknown filter: {filter_name}. Choose one of:"
                             f" {' '.join(FILTERS.keys())}")
        filter_args = [filter_argtypes[pos](arg) for pos, arg
                       in enumerate(filter_argstring.split(','))]
        filters.append(functools.partial(filter_function, *filter_args))
    return filters
def filter_string_to_filters ( filter_string : str ) -> List [ Callable [ [ dnaio . Sequence ] , bool ] ] : filters : List [ Callable [ [ dnaio . Sequence ] , bool ] ] = [ ] for single_filter_string in filter_string . split ( '|' ) : filter_name , filter_argstring = single_filter_string . split ( ':' ) try : filter_function , filter_argtypes , _ = FILTERS [ filter_name ] except KeyError : raise ValueError ( f"Unknown filter: {filter_name}. Choose one of:" f" {' '.join(FILTERS.keys())}" ) filter_args = [ filter_argtypes [ pos ] ( arg ) for pos , arg in enumerate ( filter_argstring . split ( ',' ) ) ] filters . append ( functools . partial ( filter_function , * filter_args ) ) return filters
Convert a filter string such as 'min_length:50|mean_quality:20 into
a list of filter functions that can be used by Python's builtin filter
function.
Convert a filter string such as ' min_length : 50|mean_quality : 20 into a list of filter functions that can be used by Python ' s builtin filter function .
"""Convert a filter string such as 'min_length:50|mean_quality:20 into
    a list of filter functions that can be used by Python's builtin filter
    function.""" # Convert the strings from the command line in the appropriate types
filter_string
str