src/scBONITA/singleCell.py
def makeBubblePlots(
        pvalues=pd.DataFrame(),
        adjPValueThreshold=0.05,
        wrap=25,
        height=8,
        width=10,
        palette="colorblind",
        saveAsPDF=True,
        outputFile="",
    ):

        """Uses a dataframe of pathway names and adjusted p-values (usually the output of scBONITA pathway analysis) to generate a bubbleplot showing the pathways and the -log10 of their adjusted p-values as calculated by scBONITA

        Parameters
        ----------

        pvalues: pandas DataFrame
            Usually the output of scBONITA pathway analysis A dataframe containing at least the following columns: "Adjusted P value", "Pathway Name", "log10pvals".
        adjPValueThreshold: float
            the adjusted p-value threshold below which dysregulated pathways are shown on the bubbleplot
        wrap: int
            wrap pathway names at this value on the y axis of the bubbleplot
        height: float
            height of image in inches
        width: float
            width of image in inches
        palette: str
            The matplotlib color palette to be used for the analysis plots. Consider using 'colorblind'. See matplotlib
            documentation for more options on color palettes.
        saveAsPDF: bool
            whether to save the bubbleplot as a PDF
        outputFile:
            name of output image file (optional)

        Returns
        -------
            None
        """
        pvalues.loc[:, "log10pvals"] = [
            -1 * np.log10(temp) for temp in pvalues.loc[:, "Adjusted P value"]
        ]
        pvalues = pvalues.loc[pvalues.loc[:, "Adjusted P value"].lt(adjPValueThreshold)]
        pvalues = pvalues.sort_values("Adjusted P value", ascending=0)
        pvalues["Pathway Name"] = pvalues["Pathway Name"].str.wrap(wrap)
        ax = sns.scatterplot(
            data=pvalues,
            s=200,
            x="log10pvals",
            y="Pathway Name",
            alpha=1,
            palette=palette,
        )
        plt.ylabel("Pathway Names")
        plt.xlabel("-log10 (adjusted p-value)")
        axes = plt.gca()
        axes.yaxis.grid(color="grey", linestyle=(0, (5, 10)), linewidth=0.5)
        if saveAsPDF:
            plt.savefig(outputFile, bbox_inches="tight", height=height, width=width)
            plt.show()
            plt.clf()
        else:
            plt.show()
            plt.clf()
        return None
Uses a dataframe of pathway names and adjusted p-values (usually the output of scBONITA pathway analysis) to generate a bubbleplot showing the pathways and the -log10 of their adjusted p-values as calculated by scBONITA

        Parameters
        ----------

        pvalues: pandas DataFrame
            Usually the output of scBONITA pathway analysis A dataframe containing at least the following columns: "Adjusted P value", "Pathway Name", "log10pvals".
        adjPValueThreshold: float
            the adjusted p-value threshold below which dysregulated pathways are shown on the bubbleplot
        wrap: int
            wrap pathway names at this value on the y axis of the bubbleplot
        height: float
            height of image in inches
        width: float
            width of image in inches
        palette: str
            The matplotlib color palette to be used for the analysis plots. Consider using 'colorblind'. See matplotlib
            documentation for more options on color palettes.
        saveAsPDF: bool
            whether to save the bubbleplot as a PDF
        outputFile:
            name of output image file (optional)

        Returns
        -------
            None
        
Uses a dataframe of pathway names and adjusted p-values (usually the output of scBONITA pathway analysis) to generate a bubbleplot showing the pathways and the -log10 of their adjusted p-values as calculated by scBONITA
Parameters



Returns

None
Uses a dataframe of pathway names and adjusted p - values ( usually the output of scBONITA pathway analysis ) to generate a bubbleplot showing the pathways and the - log10 of their adjusted p - values as calculated by scBONITA Parameters Returns None
def makeBubblePlots(
        pvalues=pd.DataFrame(),
        adjPValueThreshold=0.05,
        wrap=25,
        height=8,
        width=10,
        palette="colorblind",
        saveAsPDF=True,
        outputFile="",
    ):
        pvalues.loc[:, "log10pvals"] = [
            -1 * np.log10(temp) for temp in pvalues.loc[:, "Adjusted P value"]
        ]
        pvalues = pvalues.loc[pvalues.loc[:, "Adjusted P value"].lt(adjPValueThreshold)]
        pvalues = pvalues.sort_values("Adjusted P value", ascending=0)
        pvalues["Pathway Name"] = pvalues["Pathway Name"].str.wrap(wrap)
        ax = sns.scatterplot(
            data=pvalues,
            s=200,
            x="log10pvals",
            y="Pathway Name",
            alpha=1,
            palette=palette,
        )
        plt.ylabel("Pathway Names")
        plt.xlabel("-log10 (adjusted p-value)")
        axes = plt.gca()
        axes.yaxis.grid(color="grey", linestyle=(0, (5, 10)), linewidth=0.5)
        if saveAsPDF:
            plt.savefig(outputFile, bbox_inches="tight", height=height, width=width)
            plt.show()
            plt.clf()
        else:
            plt.show()
            plt.clf()
        return None
def makeBubblePlots ( pvalues = pd . DataFrame ( ) , adjPValueThreshold = 0.05 , wrap = 25 , height = 8 , width = 10 , palette = "colorblind" , saveAsPDF = True , outputFile = "" , ) : pvalues . loc [ : , "log10pvals" ] = [ - 1 * np . log10 ( temp ) for temp in pvalues . loc [ : , "Adjusted P value" ] ] pvalues = pvalues . loc [ pvalues . loc [ : , "Adjusted P value" ] . lt ( adjPValueThreshold ) ] pvalues = pvalues . sort_values ( "Adjusted P value" , ascending = 0 ) pvalues [ "Pathway Name" ] = pvalues [ "Pathway Name" ] . str . wrap ( wrap ) ax = sns . scatterplot ( data = pvalues , s = 200 , x = "log10pvals" , y = "Pathway Name" , alpha = 1 , palette = palette , ) plt . ylabel ( "Pathway Names" ) plt . xlabel ( "-log10 (adjusted p-value)" ) axes = plt . gca ( ) axes . yaxis . grid ( color = "grey" , linestyle = ( 0 , ( 5 , 10 ) ) , linewidth = 0.5 ) if saveAsPDF : plt . savefig ( outputFile , bbox_inches = "tight" , height = height , width = width ) plt . show ( ) plt . clf ( ) else : plt . show ( ) plt . clf ( ) return None
Uses a dataframe of pathway names and adjusted p-values (usually the output of scBONITA pathway analysis) to generate a bubbleplot showing the pathways and the -log10 of their adjusted p-values as calculated by scBONITA
Parameters
Uses a dataframe of pathway names and adjusted p - values ( usually the output of scBONITA pathway analysis ) to generate a bubbleplot showing the pathways and the - log10 of their adjusted p - values as calculated by scBONITA Parameters
"""Uses a dataframe of pathway names and adjusted p-values (usually the output of scBONITA pathway analysis) to generate a bubbleplot showing the pathways and the -log10 of their adjusted p-values as calculated by scBONITA

        Parameters
        ----------

        pvalues: pandas DataFrame
            Usually the output of scBONITA pathway analysis A dataframe containing at least the following columns: "Adjusted P value", "Pathway Name", "log10pvals".
        adjPValueThreshold: float
            the adjusted p-value threshold below which dysregulated pathways are shown on the bubbleplot
        wrap: int
            wrap pathway names at this value on the y axis of the bubbleplot
        height: float
            height of image in inches
        width: float
            width of image in inches
        palette: str
            The matplotlib color palette to be used for the analysis plots. Consider using 'colorblind'. See matplotlib
            documentation for more options on color palettes.
        saveAsPDF: bool
            whether to save the bubbleplot as a PDF
        outputFile:
            name of output image file (optional)

        Returns
        -------
            None
        """
pvalues
adjPValueThreshold
wrap
height
width
palette
saveAsPDF
outputFile