Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
CrystalColeCrystal opened this issue Nov 4, 2024 · 0 comments

Comments

@CrystalColeCrystal
Copy link

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

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant