banner



How To Draw Volcano Plots Of Some Genes

Volcano plot in Python

Renesh Bedre 3 minute read

What is Volcano plot?

  • Volcano plot is a ii-dimensional (2D) scatter plot having a shape like a volcano.
  • Volcano plot used for visualization and identification of statistically significant gene expression changes from two different experimental conditions (eastward.chiliad. normal vs. treated) in terms of log fold change (X-axis) and negative log10 of p value (Y-axis). The higher the indicate on Y-axis, the lower is the p value.
  • The wider dispersion of data points in the volcano plot indicates significant changes in gene expression between the ii weather.

Applications

  • Easy to visualize the expression of thousands of genes obtained from omics enquiry (eg. Transcriptomics, genomics, proteomics, etc.) and pinpoint genes with significant changes

How to create Volcano plot in Python?

  • We will use bioinfokit v2.0.viii or later
  • Cheque bioinfokit documentation for installation and documentation (check how to install Python packages)
  • For generating a volcano plot, I have used gene expression data published in Bedre et al. 2022 to place statistically significantly induced or downregulated genes in response to salt stress in Spartina alterniflora (Read paper). Here's yous can download cistron expression dataset used for generating volcano plot: dataset

Note: If y'all have your ain dataset, you should import it as pandas dataframe. Learn how to import information using pandas

                              from                bioinfokit                import                analys                ,                visuz                # load dataset every bit pandas dataframe                                df                =                analys                .                get_data                (                'volcano'                ).                data                df                .                head                (                2                )                GeneNames                value1                value2                log2FC                p                -                value                0                LOC_Os09g01000                .                1                8862                32767                -                1.886539                1.250000e-55                1                LOC_Os12g42876                .                1                1099                117                3.231611                ane.050000e-55                visuz                .                GeneExpression                .                volcano                (                df                =                df                ,                lfc                =                'log2FC'                ,                pv                =                'p-value'                )                # plot will be saved in same directory (volcano.png) # set parameter show=Truthful, if you want view the prototype instead of saving                                          

Generated volcano plot by above lawmaking (green: upregulated and red: downregulated genes),

Basic volcano plot

Change background theme to night,

                              visuz                .                GeneExpression                .                volcano                (                df                =                df                ,                lfc                =                'log2FC'                ,                pv                =                'p-value'                ,                theme                =                'dark'                )                          

Basic volcano plot with dark background

Add legend to the plot and adjust the legend position,

                              visuz                .                GeneExpression                .                volcano                (                df                =                df                ,                lfc                =                'log2FC'                ,                pv                =                'p-value'                ,                plotlegend                =                True                ,                legendpos                =                'upper right'                ,                legendanchor                =                (                1.46                ,                ane                ))                          

Volcano plot with legend

Alter color of volcano plot

                              # alter colormap                                visuz                .                GeneExpression                .                volcano                (                df                =                df                ,                lfc                =                'log2FC'                ,                pv                =                'p-value'                ,                color                =                (                "#00239CFF"                ,                "grey"                ,                "#E10600FF"                ))                          

Volcano plot with red and blue color

Change log fold change and p value threshold,

                              visuz                .                GeneExpression                .                volcano                (                df                =                df                ,                lfc                =                'log2FC'                ,                pv                =                'p-value'                ,                lfc_thr                =                (                1                ,                2                ),                pv_thr                =                (                0.05                ,                0.01                ),                color                =                (                "#00239CFF"                ,                "gray"                ,                "#E10600FF"                ),                plotlegend                =                True                ,                legendpos                =                'upper right'                ,                legendanchor                =                (                1.46                ,                1                ))                          

Volcano plot with different p value threshold

Alter transparency of volcano plot

                              visuz                .                GeneExpression                .                volcano                (                df                =                df                ,                lfc                =                'log2FC'                ,                pv                =                'p-value'                ,                color                =                (                "#00239CFF"                ,                "greyness"                ,                "#E10600FF"                ),                valpha                =                0.5                )                          

Volcano plot with low transparency

Change the shape of the points

                              # add together star shape # check more shapes at https://matplotlib.org/3.1.ane/api/markers_api.html                                visuz                .                GeneExpression                .                volcano                (                df                =                df                ,                lfc                =                'log2FC'                ,                pv                =                'p-value'                ,                color                =                (                "#00239CFF"                ,                "grey"                ,                "#E10600FF"                ),                markerdot                =                '*'                )                          

Volcano plot with star shapes

Change the shape and size of the points

                              visuz                .                GeneExpression                .                volcano                (                df                =                df                ,                lfc                =                'log2FC'                ,                pv                =                'p-value'                ,                colour                =                (                "#00239CFF"                ,                "gray"                ,                "#E10600FF"                ),                markerdot                =                '*'                ,                dotsize                =                30                )                          

Volcano plot with star shapes and increased point size

Add gene labels (text mode) to the points,

                              # add cistron customized labels # note: here you need to provide column proper noun of cistron Ids (geneid parameter) # default simple text will exist added                                visuz                .                GeneExpression                .                volcano                (                df                =                df                ,                lfc                =                "log2FC"                ,                pv                =                "p-value"                ,                geneid                =                "GeneNames"                ,                genenames                =                (                "LOC_Os09g01000.1"                ,                "LOC_Os01g50030.1"                ,                "LOC_Os06g40940.3"                ,                "LOC_Os03g03720.1"                )                )                # if you want to label all DEGs defined lfc_thr and pv_thr, prepare genenames='deg'                                          

Volcano plot with point labels

Add gene labels (box style) to the points,

                              visuz                .                GeneExpression                .                volcano                (                df                =                df                ,                lfc                =                "log2FC"                ,                pv                =                "p-value"                ,                geneid                =                "GeneNames"                ,                genenames                =                (                "LOC_Os09g01000.1"                ,                "LOC_Os01g50030.1"                ,                "LOC_Os06g40940.3"                ,                "LOC_Os03g03720.i"                ),                gstyle                =                ii                )                          

Volcano plot with box style point labels

Add gene names instead of gene Ids,

                              # add cistron customized labels # annotation: here you need to provide column name of gene Ids (geneid parameter) # equally the dataset only accept geneids, you need to provide tuple of gene Id and corresponding gene names                                visuz                .                GeneExpression                .                volcano                (                df                =                df                ,                lfc                =                "log2FC"                ,                pv                =                "p-value"                ,                geneid                =                "GeneNames"                ,                genenames                =                ({                "LOC_Os09g01000.i"                :                "EP"                ,                "LOC_Os01g50030.i"                :                "CPuORF25"                ,                "LOC_Os06g40940.iii"                :                "GDH"                ,                "LOC_Os03g03720.ane"                :                "G3PD"                }),                gstyle                =                2                )                          

Volcano plot with different IDs

Add threshold lines,

                              visuz                .                GeneExpression                .                volcano                (                df                =                df                ,                lfc                =                "log2FC"                ,                pv                =                "p-value"                ,                geneid                =                "GeneNames"                ,                genenames                =                ({                "LOC_Os09g01000.1"                :                "EP"                ,                "LOC_Os01g50030.ane"                :                "CPuORF25"                ,                "LOC_Os06g40940.iii"                :                "GDH"                ,                "LOC_Os03g03720.1"                :                "G3PD"                }),                gstyle                =                two                ,                sign_line                =                Truthful                )                          

Volcano plot with threshold lines

Alter X and Y range ticks, font size and name for tick labels

                              visuz                .                GeneExpression                .                volcano                (                df                =                df                ,                lfc                =                "log2FC"                ,                pv                =                "p-value"                ,                geneid                =                "GeneNames"                ,                genenames                =                ({                "LOC_Os09g01000.1"                :                "EP"                ,                "LOC_Os01g50030.1"                :                "CPuORF25"                ,                "LOC_Os06g40940.3"                :                "GDH"                ,                "LOC_Os03g03720.1"                :                "G3PD"                }),                gstyle                =                two                ,                sign_line                =                True                ,                xlm                =                (                -                half-dozen                ,                6                ,                ane                ),                ylm                =                (                0                ,                61                ,                five                ),                figtype                =                'svg'                ,                axtickfontsize                =                x                ,                axtickfontname                =                'Verdana'                )                          

Volcano plot with change in ticks range for x and y axis

In addition to these parameters, the parameters for figure type (figtype), X and Y centrality ticks range (xlm, ylm), centrality labels (axxlabel, axylabel),
axis labels font size (axlabelfontsize), and axis tick labels font size and name (axtickfontsize, axtickfontname) tin can be provided.

To create a inverted volcano plot,

                              # you can utilise interactive python panel, jupyter or python code # I am using interactive python console                                from                bioinfokit                import                visuz                # here you can modify default parameters.  # Read documentation at https://github.com/reneshbedre/bioinfokit                                visuz                .                GeneExpression                .                involcano                (                df                =                df                ,                lfc                =                "log2FC"                ,                pv                =                "p-value"                )                          

Generated inverted volcano plot by adding above code,

Basic inverted volcano plot

Change color inverted volcano plot

                              # modify colormap                                visuz                .                GeneExpression                .                involcano                (                df                =                df                ,                lfc                =                "log2FC"                ,                pv                =                "p-value"                ,                color                =                (                "#00239CFF"                ,                "greyness"                ,                "#E10600FF"                ))                          

Inverted volcano plot with red and blue colors

Add together factor names instead of gene Ids,

                              # add gene customized labels # annotation: here you demand to provide cavalcade name of factor Ids (geneid parameter) # as the dataset simply have geneids, y'all need to provide tuple of gene Id and respective gene names                                visuz                .                GeneExpression                .                involcano                (                df                =                df                ,                lfc                =                "log2FC"                ,                pv                =                "p-value"                ,                geneid                =                "GeneNames"                ,                genenames                =                ({                "LOC_Os09g01000.1"                :                "EP"                ,                "LOC_Os01g50030.one"                :                "CPuORF25"                ,                "LOC_Os06g40940.3"                :                "GDH"                ,                "LOC_Os03g03720.1"                :                "G3PD"                }),                gstyle                =                2                )                          

inverted volcano plot with labels

In addition to these parameters, the parameters for figure type (figtype), axis labels (axxlabel, axylabel), centrality labels font size (axlabelfontsize), and centrality tick labels font size and name (axtickfontsize, axtickfontname) can be provided.

If you lot take any questions, comments or recommendations, please email me at reneshbe@gmail.com

If you relish reading and learn from this article, you tin back up me on

Buy Me A Coffee

This work is licensed under a Creative Commons Attribution 4.0 International License

Source: https://www.reneshbedre.com/blog/volcano.html

Posted by: burrowsbegather45.blogspot.com

0 Response to "How To Draw Volcano Plots Of Some Genes"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel