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

Wrong SNP being assigned purple colour #30

Open
yatest opened this issue Apr 5, 2024 · 1 comment
Open

Wrong SNP being assigned purple colour #30

yatest opened this issue Apr 5, 2024 · 1 comment

Comments

@yatest
Copy link

yatest commented Apr 5, 2024

The merge function in assign_color can flip the order of SNPs where one rsid is a substring of the other, e.g. rs123456 and rs1234567. In the following if statement, the line color[rsid == snp,'color'] = 'purple' should then colour the lead SNP (snp = "rs123456") purple; however, it colours rs1234567 purple instead.

The core issue is that the line color[rsid == snp,'color'] uses the input structure rsid (which is just a renaming of merged$rsid) to mask color, rather than color$rsid. Since rsid has the ordering of SNPs prior to the reordering by merge and color$rsid the ordering post merge, it changes the colour of the wrong SNP.

This can be fixed simply by changing color[rsid == snp,'color'] to color[color$rsid == snp,'color'].

I'm not sure if this only happens for SNPs with rsids that are substrings of other SNP rsids, or why the merge function does this at all, but this fix should ensure that any change in ordering during merge is irrelevant.

@llalluan
Copy link

llalluan commented Dec 3, 2024

it happened to me

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

2 participants