rnalysis.filtering.FoldChangeFilter.majority_vote_intersection

FoldChangeFilter.majority_vote_intersection(*others: Filter | set, majority_threshold: float = 0.5, return_type: Literal['set', 'str'] = 'set')

Returns a set/string of the features that appear in at least (majority_threhold * 100)% of the given Filter objects/sets. Majority-vote intersection with majority_threshold=0 is equivalent to Union. Majority-vote intersection with majority_threshold=1 is equivalent to Intersection.

Parameters:
  • others (Filter or set objects.) – Objects to calculate intersection with.

  • return_type ('set' or 'str' (default='set')) – If β€˜set’, returns a set of the intersecting WBGene indices. If β€˜str’, returns a string of the intersecting indices, delimited by a comma.

  • majority_threshold (float (default=0.5)) – The threshold that determines what counts as majority. Features will be returned only if they appear in at least (majority_threshold * 100)% of the given Filter objects/sets.

Return type:

set or str

Returns:

If inplace=False, returns a set/string of the features that uphold majority vote intersection between two given Filter objects/sets.

Examples:
>>> from rnalysis import filtering
>>> d = filtering.Filter("tests/test_files/test_deseq.csv")
>>> a_set = {'WBGene00000001','WBGene00000002','WBGene00000003'}
>>> b_set = {'WBGene00000002','WBGene00000004'}
>>> # calculate majority-vote intersection and return a set
>>> d.majority_vote_intersection(a_set, b_set, majority_threshold=2/3)
{'WBGene00000002', 'WBGene00000003', 'WBGene00000004'}