matchms.utils module

matchms.utils.filter_none(iterable: Iterable) Iterable[source]

Filter iterable to remove ‘None’ elements.

Args:

iterable (Iterable): Iterable to filter.

Returns:

Iterable: Filtered iterable.

matchms.utils.get_common_keys(first: List[str], second: List[str]) List[str][source]

Get common elements of two sets of strings in a case insensitive way.

Args:

first (List[str]): First list of strings. second (List[str]): List of strings to search for matches.

Returns:

List[str]: List of common elements without regarding case of first list.

matchms.utils.get_first_common_element(first: Iterable[str], second: Iterable[str]) str[source]

Get first common element from two lists. Returns ‘None’ if there are no common elements.

matchms.utils.load_known_key_conversions(key_conversions_file: str = None) dict[source]

Load dictionary of known key conversions. Makes sure that file loading is cached.