filter_by_set

besca.tl.sig.filter_by_set(strs, universe_set)[source]

Remove strings from the list that are not in the universe set

Parameters
strs: a list or tuple or set of str

A sequence (ordered list) or unordered set of strings, which often are HGNC symbol and should match the signatures values. Empty characters around characters are ignored.

universe_set: a set of strings

a set of strings. The strings in strs that are not in this set are filtered.

filter_by_set: list of str

A list of gene names that are detected, in the same order as the input except for those that are filtered. In case the input is None or an empty list, an empty list is returned.

>>> import besca as bc
>>> detected = list('ABCDE')
>>> bc.tl.sig.filter_by_set(['D', 'E', 'A'], detected)
['D', 'E', 'A']
>>> bc.tl.sig.filter_by_set(['D', 'E', 'A', 'F'], detected)
['D', 'E', 'A']
>>> bc.tl.sig.filter_by_set(None, detected)
[]
>>> bc.tl.sig.filter_by_set([], detected)
[]