%\VignetteIndexEntry{pcxnData}
\documentclass{article}
\usepackage{Sweave}
\usepackage{amsmath}
\usepackage{amscd}
\usepackage[tableposition=top]{caption}
\usepackage{ifthen}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage[usenames]{color}
\definecolor{midnightblue}{rgb}{0.098,0.098,0.439}
\fvset{listparameters={\setlength{\topsep}{0pt}}}
\renewenvironment{Schunk}{\vspace{\topsep}}{\vspace{\topsep}}
\setkeys{Gin}{width=\textwidth}
\begin{document}
\SweaveOpts{concordance=TRUE}
\title{About pcxnData}
\author{Sokratis Kariotis, Yered Pita-Juarez, Winston Hide, Wenbin Wei}
\maketitle

\section{Description}
The pcxnData package contains correlation coefficients and p values between
pre-defined gene sets within MSigDB H hallmark gene sets, MSigDB C2 CP 
(Canonical pathways), MSigDB C5 GO BP gene sets and Pathprint respectively. In 
addition to the unadjusted pathway correlations, this package provides those 
that were adjusted to account for the shared genes between pathway pairs

\section{Using pcxnData with pcxn package}

The data in this package are primarily used by the pcxn package. For the 
following examples to work, the pcxn package needs to be installed. 
For further explanations of some of the functions mentioned in the examples 
please refer to pcxn. 

<<>>=
# Use the pcxn library
library(pcxn)
library(pcxnData)

# Load  the data
ds = c("cp_gs_v5.1", "gobp_gs_v5.1", "h_gs_v5.1","pathprint.Hs.gs",
    "pathCor_CPv5.1_dframe","pathCor_GOBPv5.1_dframe","pathCor_Hv5.1_dframe",
    "pathCor_pathprint_v1.2.3_dframe","pathCor_CPv5.1_unadjusted_dframe",
    "pathCor_GOBPv5.1_unadjusted_dframe","pathCor_Hv5.1_unadjusted_dframe",
    "pathCor_pathprint_v1.2.3_unadjusted_dframe")

data(list = ds)

# Explore the static extendable network by focusing on single pathways and their
# 10 most correlated neighbours in the pathprint collection
pcxn.obj <- pcxn_explore(collection = "pathprint",
                    query_geneset = "Alzheimer's disease (KEGG)",
                    adj_overlap = FALSE,
                    top = 10,
                    min_abs_corr = 0.05,
                    max_pval = 0.05)

# Analyse relationships between groups of pathways shown to be enriched in the
# collection by gene set enrichment
pcxn.obj <- pcxn_analyze(collection = "pathprint",
            phenotype_0_genesets = c("ABC transporters (KEGG)",
                                    "ACE Inhibitor Pathway (Wikipathways)",
                                    "AR down reg. targets (Netpath)"),
            phenotype_1_genesets = c("DNA Repair (Reactome)"),
            adj_overlap = FALSE,
            top = 10,
            min_abs_corr = 0.05,
            max_pval = 0.05 )

# Generate the heatmap for any pcxn object generated by the
# explore or analyze function
hm <- pcxn_heatmap(pcxn.obj , cluster_method = "complete")

# Get the gene members (Entrez Ids and symbols) of any pathway/geneset in the
# data
gene_members <- pcxn_gene_members(pathway_name = "Alzheimer's disease (KEGG)")

@
\end{document}