# iPRISM User Guide

    # Load the package
    library(iPRISM)

## Introduction

Welcome to the vignette for the PRISM package. This document provides an overview of the package’s functionalities, including basic usage examples and detailed explanations of the main functions. The PRISM package includes the core function for the paper named PRISM: Predicting Response to cancer Immunotherapy through Systematic Modeling.

## Example 1: Correlation Plot with Cell Types and Pathways

The `cor_plot` function generates a correlation plot between cell types and pathways, displaying correlation coefficients as a heatmap and significant correlations as scatter points.

    # Read cell line and pathway information
    data(data.path, package = "iPRISM")
    data(data.cell, package = "iPRISM")

    # Draw the plot
    cor_plot(data1 = data.path, data2 = data.cell, sig.name1 = "path", sig.name2 = "cell")

## Example 2: Enrichment Analysis using Multiplex Networks

The `get_gsea_path` function constructs a multiplex network, performs random walk restart, and calculates gene scores. It then transforms the scores and applies GSEA using the provided gene sets.

    # Load example data
    data(Seeds, package = "iPRISM")
    data(ppi, package = "iPRISM")
    data(path_list, package = "iPRISM")

    # Shrink pathway list to the top 2 pathways
    path_list <- path_list[1:5]

    # Perform GSEA
    result <- get_gsea_path(seed = Seeds, network = ppi, pathlist = path_list, gsea.nperm = 100)
    #> Warning in asMethod(object): sparse->dense coercion: allocating vector of size
    #> 1.9 GiB
    print(result)
    #>                                                                       ES pval
    #> 2-LTR circle formation                                           0.67796 0.05
    #> 5-Phosphoribose 1-diphosphate biosynthesis                      -0.52301 0.38
    #> A tetrasaccharide linker sequence is required for GAG synthesis  0.61996 0.00
    #> ABC transporter disorders                                        0.55422 0.01
    #> ABC transporters in lipid homeostasis                           -0.31617 0.22
    #>                                                                       padj
    #> 2-LTR circle formation                                          0.08333333
    #> 5-Phosphoribose 1-diphosphate biosynthesis                      0.38000000
    #> A tetrasaccharide linker sequence is required for GAG synthesis 0.00000000
    #> ABC transporter disorders                                       0.02500000
    #> ABC transporters in lipid homeostasis                           0.27500000

## Example 3: Fit Logistic Regression Model

The `get_logiModel` function fits a logistic regression model as the paper highlighted, with an option for stepwise model selection.

    # Load example data
    data(data_sig, package = "iPRISM")

    # Fit logistic regression model
    b <- get_logiModel(data.sig = data_sig, pred.value = pred_value, step = TRUE)
    summary(b)
    #>
    #> Call:
    #> glm(formula = pred ~ `Downstream signaling of activated FGFR2` +
    #>     `Downstream signaling of activated FGFR3` + `Downstream signaling of activated FGFR4` +
    #>     `FGFR1 mutant receptor activation` + `FRS-mediated FGFR3 signaling` +
    #>     `IGF1R signaling cascade` + `Insulin receptor signalling cascade` +
    #>     `MAPK3 (ERK1) activation` + `Negative regulation of FGFR1 signaling` +
    #>     `Negative regulation of FGFR2 signaling` + `Negative regulation of FGFR4 signaling` +
    #>     `PI-3K cascade:FGFR2` + `PI-3K cascade:FGFR4` + `PI3K Cascade` +
    #>     `Senescence-Associated Secretory Phenotype (SASP)` + `Signaling by FGFR3 in disease` +
    #>     `VEGFR2 mediated cell proliferation`, family = "binomial",
    #>     data = data.sig)
    #>
    #> Coefficients:
    #>                                                     Estimate Std. Error z value
    #> (Intercept)                                          -29.309     10.083  -2.907
    #> `Downstream signaling of activated FGFR2`           2256.687   1178.118   1.916
    #> `Downstream signaling of activated FGFR3`            307.068     77.157   3.980
    #> `Downstream signaling of activated FGFR4`          -2258.365   1087.384  -2.077
    #> `FGFR1 mutant receptor activation`                    27.001     10.886   2.480
    #> `FRS-mediated FGFR3 signaling`                       -39.058     18.304  -2.134
    #> `IGF1R signaling cascade`                             62.010     31.597   1.963
    #> `Insulin receptor signalling cascade`                 76.707     31.676   2.422
    #> `MAPK3 (ERK1) activation`                            -21.778      8.678  -2.509
    #> `Negative regulation of FGFR1 signaling`             -50.247     25.410  -1.977
    #> `Negative regulation of FGFR2 signaling`           -1286.734    665.590  -1.933
    #> `Negative regulation of FGFR4 signaling`            1251.676    613.134   2.041
    #> `PI-3K cascade:FGFR2`                               -812.712    446.111  -1.822
    #> `PI-3K cascade:FGFR4`                                771.506    391.080   1.973
    #> `PI3K Cascade`                                      -117.160     37.365  -3.136
    #> `Senescence-Associated Secretory Phenotype (SASP)`    17.685     11.635   1.520
    #> `Signaling by FGFR3 in disease`                     -121.106     41.528  -2.916
    #> `VEGFR2 mediated cell proliferation`                 -16.990      7.006  -2.425
    #>                                                    Pr(>|z|)
    #> (Intercept)                                         0.00365 **
    #> `Downstream signaling of activated FGFR2`           0.05543 .
    #> `Downstream signaling of activated FGFR3`           6.9e-05 ***
    #> `Downstream signaling of activated FGFR4`           0.03781 *
    #> `FGFR1 mutant receptor activation`                  0.01312 *
    #> `FRS-mediated FGFR3 signaling`                      0.03286 *
    #> `IGF1R signaling cascade`                           0.04970 *
    #> `Insulin receptor signalling cascade`               0.01545 *
    #> `MAPK3 (ERK1) activation`                           0.01209 *
    #> `Negative regulation of FGFR1 signaling`            0.04799 *
    #> `Negative regulation of FGFR2 signaling`            0.05321 .
    #> `Negative regulation of FGFR4 signaling`            0.04121 *
    #> `PI-3K cascade:FGFR2`                               0.06849 .
    #> `PI-3K cascade:FGFR4`                               0.04852 *
    #> `PI3K Cascade`                                      0.00172 **
    #> `Senescence-Associated Secretory Phenotype (SASP)`  0.12851
    #> `Signaling by FGFR3 in disease`                     0.00354 **
    #> `VEGFR2 mediated cell proliferation`                0.01531 *
    #> ---
    #> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
    #>
    #> (Dispersion parameter for binomial family taken to be 1)
    #>
    #>     Null deviance: 163.343  on 120  degrees of freedom
    #> Residual deviance:  97.841  on 103  degrees of freedom
    #> AIC: 133.84
    #>
    #> Number of Fisher Scoring iterations: 6