scverse / scanpy

Single-cell analysis in Python. Scales to >1M cells.
https://scanpy.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.88k stars 594 forks source link

What does y-axis in differential gene expression plot signify? #1778

Open sidrahmaryam opened 3 years ago

sidrahmaryam commented 3 years ago

Hello, I wanted to do differential gene expression on the clusters of my data. When I plotted them, I obtained the expressed genes. However, I wanted to know the significance of the number in y-axis on the right hand side.

I am attaching the screenshot of the image. image

Thank you

ivirshup commented 3 years ago

I don't think you'll be able to do this with the tracksplot. Were you looking for something more like a volcano plot?

I've used something like this snipped (using hvplots) for these:

import hvplot.pandas

def plot_volcano(dedf):
    dedf = dedf.copy()
    dedf = dedf[dedf["pvals"].notnull()]
    dedf.loc[dedf["logfoldchanges"] == np.inf, "logfoldchanges"] = 10
    dedf.loc[dedf["logfoldchanges"] == -np.inf, "logfoldchanges"] = -10
    return dedf.hvplot.scatter(
        "logfoldchanges",
        "pvals",
        xlim=(dedf["logfoldchanges"][dedf["logfoldchanges"].abs() != np.inf].min(), dedf["logfoldchanges"][dedf["logfoldchanges"].abs() != np.inf].max()),
        ylim=(dedf["pvals"][dedf["pvals"].abs() != np.inf].min(), dedf["pvals"][dedf["pvals"].abs() != np.inf].max() + .5),
        hover_cols=list(dedf.columns),
        logy=True,
        flip_yaxis=True
    )

plot_volcano(sc.get.rank_genes_groups(adata, ...))
sidrahmaryam commented 3 years ago

Hello, I actually wanted to know that in the plot that I have posted what does the numbers on right hand side signify. Like 5, 3, 3,.. and so on. Thanks

ivirshup commented 3 years ago

Ah, I believe that should just be expression level per row.

It looks like it formats pretty poorly due to the small area and fantasize though.