rnalysis.filtering.Filter.union

Filter.union(*others: Filter | set, return_type: Literal['set', 'str'] = 'set')

Returns a set/string of the union of features between multiple Filter objects/sets (the features that exist in at least one of the Filter objects/sets).

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

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

Return type:

set or str

Returns:

a set/string of the WBGene indices that exist in at least one of the Filter objects.

Examples:
>>> from rnalysis import filtering
>>> d = filtering.Filter("tests/test_files/test_deseq.csv")
>>> counts = filtering.Filter('tests/test_files/counted.csv')
>>> # calculate union and return a set
>>> d.union(counts)
{'WBGene00000017', 'WBGene00000021', 'WBGene00044022', 'WBGene00077504', 'WBGene00000012',
'WBGene00000024', 'WBGene00007079', 'WBGene00000010', 'WBGene00000020', 'WBGene00000005', 'WBGene00007069',
'WBGene00007063', 'WBGene00007067', 'WBGene00077503', 'WBGene00007078', 'WBGene00000026', 'WBGene00000029',
'WBGene00000002', 'WBGene00000003', 'WBGene00000006', 'WBGene00007064', 'WBGene00077502', 'WBGene00044951',
'WBGene00000007', 'WBGene00000008', 'WBGene00000019', 'WBGene00007077', 'WBGene00000004', 'WBGene00007066',
'WBGene00007076', 'WBGene00000013', 'WBGene00014997', 'WBGene00000023', 'WBGene00043990', 'WBGene00007074',
'WBGene00000025', 'WBGene00000011', 'WBGene00043987', 'WBGene00007071', 'WBGene00000015', 'WBGene00000018',
'WBGene00043989', 'WBGene00043988', 'WBGene00000014', 'WBGene00000016', 'WBGene00000027', 'WBGene00000028',
'WBGene00007075', 'WBGene00000022', 'WBGene00000009'}