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

Incorrect position of hit in gseaplot2 like #222 #248

Closed
136s opened this issue Feb 19, 2024 · 5 comments · Fixed by #249
Closed

Incorrect position of hit in gseaplot2 like #222 #248

136s opened this issue Feb 19, 2024 · 5 comments · Fixed by #249

Comments

@136s
Copy link
Contributor

136s commented Feb 19, 2024

Setup

I am reporting a problem with GSEApy version, Python version, and operating
system as follows:

import sys; print(sys.version)
import platform; print(platform.python_implementation()); print(platform.platform())
import gseapy; print(gseapy.__version__)

3.11.0 | packaged by conda-forge | (main, Oct 25 2022, 06:12:32) [MSC v.1929 64 bit (AMD64)]
CPython
Windows-10-10.0.19045-SP0
1.1.1

Expected behaviour

In gseaplot2, the vline of hits should exist at the x coordinate where the line of RES is increasing.

Actual behaviour

gseaplot2

The x-coordinates of the increasing RES line do not correspond to the x-coordinates of the vline.
In the following code, hits are the following arrays, for example, but the rightmost orange and blue hit is at the same position (100).

[[3, 5, 6, 8, 14, 16, 18, 21, 23, 36, 47, 60, 66, 69, 77, 94],
 [2, 7, 9, 11, 12, 19, 20, 26, 30, 33, 37, 46, 50, 63, 70, 80, 92]]

Steps to reproduce

import gseapy as gp
import pandas as pd

rnk_url = "https://raw.githubusercontent.com/zqfang/GSEApy/master/tests/data/temp.rnk"
rnk = pd.read_table(rnk_url, header=None, index_col=0)
pre_res = gp.prerank(rnk=rnk.head(100), gene_sets="KEGG_2016", seed=6)

terms = pre_res.res2d.Term[:2]
hits = [pre_res.results[t]["hits"] for t in terms]
runes = [pre_res.results[t]["RES"] for t in terms]
fig = gp.gseaplot2(terms=terms, RESs=runes, hits=hits, ofname="gseaplot2.svg")
@136s
Copy link
Contributor Author

136s commented Feb 20, 2024

Hi, I tried to fix this bug. I am not sure if the fix is correct, so please check if you want.

Prior to the fix, pseudo vlines ranged from 0 to the number of terms -1, and when drawing real vlines, they were drawn broadly for each term. Therefore, fix #249 aligns the position of the hit track with the position of the mountain curve increment.
However, I can't figure out why the left edge of the pseudo vlines is off unless it is set to 1 instead of 0.

This is the new output from this fix.
gseaplot2

@zqfang
Copy link
Owner

zqfang commented Feb 23, 2024

I think I know what happend here now. but the left edge should be start at 0.

zqfang added a commit that referenced this issue Feb 23, 2024
align gene hits track in TracePlot (fixes #248)
zqfang pushed a commit that referenced this issue Feb 23, 2024
@zqfang
Copy link
Owner

zqfang commented Feb 23, 2024

the left edge should start with 0, to make all hits with x range

image

@136s
Copy link
Contributor Author

136s commented Feb 26, 2024

Sorry, I misunderstood the position of the mountain curve and hit track to be off by 1.
I have confirmed with GSEA 4.3.3 that your correction (the left edge should start with 0) is correct.

enplot_HIPPO_SIGNALING_PATHWAY_HOMO_SAPIENS_HSA04390_1
enplot_RAS_SIGNALING_PATHWAY_HOMO_SAPIENS_HSA04014_3

@zqfang
Copy link
Owner

zqfang commented Feb 28, 2024

No worries. I should not have make the mistake in the first place

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

Successfully merging a pull request may close this issue.

2 participants