Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug in UpSet not showing the right intercetion subset size when ploting with from_contents() #288

@mkkoshkina

Description

@mkkoshkina

I have a dictionary provided in the minimal reproducible example below. The biggest intersection subset in it is size 4 between 'AUT01-DN02' and 'AUT01-DN03'. However, this subset is not shown on the plot, even with sort_by='cardinality', which is supposed to sort by subset size. But, when the upsetplot is plotted from the dictionary only containing these two entries, the right intersection size shows up.

I'm not entirely sure what causes this behavior, maybe I'm missing out on something.

Minimal reproducible example:

`
import matplotlib.pyplot as plt
import upsetplot

full_dict = {'AUT01-DN13': {'HLA-A02:05',
'HLA-A11:01',
'HLA-B40:02',
'HLA-B58:01',
'HLA-C02:02',
'HLA-C07:01'},
'OVA01-DN281': {'HLA-A11:01',
'HLA-A26:01',
'HLA-B08:01',
'HLA-B35:01',
'HLA-C04:01',
'HLA-C07:02'},
'AUT01-DN05': {'HLA-A01:01',
'HLA-A11:01',
'HLA-B07:02',
'HLA-B49:01',
'HLA-C07:01',
'HLA-C07:02'},
'AUT01-DN03': {'HLA-A01:01',
'HLA-A11:01',
'HLA-B15:01',
'HLA-B35:01',
'HLA-C03:03',
'HLA-C04:01'},
'AUT01-DN02': {'HLA-A11:01',
'HLA-A68:01',
'HLA-B15:01',
'HLA-B35:03',
'HLA-C03:03',
'HLA-C04:01'},
'AUT01-DN12': {'HLA-A02:01',
'HLA-A11:01',
'HLA-B15:01',
'HLA-B35:01',
'HLA-C03:04',
'HLA-C04:01'},
'AUT01-DN08': {'HLA-A32:01',
'HLA-A68:01',
'HLA-B15:01',
'HLA-B44:02',
'HLA-C03:03',
'HLA-C07:04'},
'THY01-DN4': {'HLA-A02:01',
'HLA-A26:08',
'HLA-B15:01',
'HLA-B44:02',
'HLA-C03:04',
'HLA-C05:01'},
'AUT01-DN17': {'HLA-A03:01',
'HLA-A24:02',
'HLA-B35:03',
'HLA-B45:01',
'HLA-C04:01',
'HLA-C16:01'},
'AUT01-DN09': {'HLA-A24:02',
'HLA-A30:01',
'HLA-B13:02',
'HLA-B35:08',
'HLA-C04:01',
'HLA-C06:02'},
'AUT01-DN14': {'HLA-A02:01',
'HLA-A68:02',
'HLA-B14:02',
'HLA-B27:05',
'HLA-C02:02',
'HLA-C08:02'},
'THY01-DN3': {'HLA-A24:02',
'HLA-A25:01',
'HLA-B18:01',
'HLA-B41:01',
'HLA-C12:03',
'HLA-C17:01'},
'AUT01-DN11': {'HLA-A01:01',
'HLA-A69:01',
'HLA-B37:01',
'HLA-B49:01',
'HLA-C06:02',
'HLA-C07:01'},
'THY01-DN5': {'HLA-A01:01',
'HLA-A03:01',
'HLA-B07:02',
'HLA-B07:06',
'HLA-C07:02',
'HLA-C15:05'},
'AUT01-DN04': {'HLA-A02:01',
'HLA-A23:01',
'HLA-B27:05',
'HLA-B50:01',
'HLA-C02:02',
'HLA-C06:02'},
'THY01-DN1': {'HLA-A03:01',
'HLA-A29:02',
'HLA-B07:02',
'HLA-B44:03',
'HLA-C07:02',
'HLA-C16:01'},
'AUT01-DN15': {'HLA-A01:01',
'HLA-A02:01',
'HLA-B08:01',
'HLA-B44:02',
'HLA-C07:01',
'HLA-C07:04'},
'AUT01-DN16': {'HLA-A01:01',
'HLA-A24:02',
'HLA-B08:01',
'HLA-B41:01',
'HLA-C07:01',
'HLA-C17:01'},
'THY01-DN6': {'HLA-A01:01',
'HLA-A25:01',
'HLA-B13:02',
'HLA-B39:01',
'HLA-C06:02',
'HLA-C12:03'},
'OVA01-DN278': {'HLA-A02:01', 'HLA-B44:02', 'HLA-C05:01'}}

show intersection of size 4

print(full_dict['AUT01-DN03'] & full_dict['AUT01-DN02'])
full_contents = from_contents(full_dict)
ax_dict = UpSet(full_contents, sort_by='cardinality').plot()
plt.show()
full_dict_example

however, for

part_dict = {'AUT01-DN03': {'HLA-A01:01',
'HLA-A11:01',
'HLA-B15:01',
'HLA-B35:01',
'HLA-C03:03',
'HLA-C04:01'},
'AUT01-DN02': {'HLA-A11:01',
'HLA-A68:01',
'HLA-B15:01',
'HLA-B35:03',
'HLA-C03:03',
'HLA-C04:01'}}
part_contents = from_contents(part_dict)
ax_dict = UpSet(part_contents, sort_by='cardinality').plot()
plt.show()
part_dict_example

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions