Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
PTMsToPathways.Rproj
.github/
data-raw/
pkgdown/
docs/
_pkgdown.yml
scripts/
^vignettes/.*\.html$
^vignettes/.*\.txt$
^vignettes/.*\.Rout$
^vignettes/plots/
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
.Rbuildignore
.Rproj.user
.Rhistory
.RData
.temp
*.DS_Store
/PTMsToPathways_0.0.0.9000/
PTMsToPathways_0.0.0.9000.tar.gz
PTMsToPathways*.tar.gz

README.html

vignettes/*.html
vignettes/*.txt
vignettes/*.Rout
vignettes/plots/

docs/
/Meta/
inst/doc

*.Rcheck
28 changes: 17 additions & 11 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
Package: PTMsToPathways
Title: Filtered CoCluster Correlation Network Guide
Title: Post-Translational Modification Network and Pathway Analysis
Version: 0.99.0
Authors@R: c(
person("Mark", "Grimes", email = "first.last@example.com", role = c("aut", "cre")),
person("Mikhail", "Ukrainetz", email = "first.last@example.com", role = c("aut")),
person("Grant", "Smith", email = "first.last@example.com", role = c("aut")),
person("Madison", "Moffett", email = "first.last@example.com", role = c("aut")),
person("Nagashree", "Avabhrath", email = "first.last@example.com", role = c("aut")),
person("Lucia", "Williams", email = "first.last@example.com", role = c("aut"))
person("Mark", "Grimes", role = c("aut"), comment=c(ORCID = "0000-0003-2673-5892")),
person("Mikhail", "Ukrainetz", role = c("aut")),
person("Grant", "Smith", role = c("aut")),
person("Madison", "Moffett", role = c("aut")),
person("Nagashree", "Avabhrath", role = c("aut")),
person("Lucia", "Williams", email = "lucia.williams@umt.edu", role = c("aut", "cre"), comment=c(ORCID = "0000-0003-3785-0247"))
)
Description: A collection of functions in order to process mass spectrometry data of post-translational modifications into possible pathways.
Description: A collection of functions to integrate PTM proteomic data with
protein-protein interactions and cell signaling pathways.
These functions can be used to cluster PTMs to reveal patterns
in their expression under different experimental conditions. These clustering
patterns can then used to filter protein-protein interactions from external PPI
databases and pathway-pathway interactions. The resulting networks are
navigable data structures that reveal data-supported interactions among both
individual proteins and groups of proteins representing well-defined cell
signaling pathways.
License: GPL (>= 3)
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
Expand All @@ -29,18 +37,16 @@ Imports:
ggplot2,
rlang
Suggests:
BiocManager,
knitr,
rmarkdown,
testthat (>= 3.0.0)
VignetteBuilder:
knitr
Depends:
R (>= 4.5.0)
URL: https://um-applied-algorithms-lab.github.io/PTMsToPathways/
URL: https://um-applied-algorithms-lab.github.io/PTMsToPathways/, https://github.com/UM-Applied-Algorithms-Lab/PTMsToPathways
BugReports: https://github.com/UM-Applied-Algorithms-Lab/PTMsToPathways/issues/new
LazyData: true
LazyDataCompression: xz
Config/testthat/edition: 3
Additional_repositories: https://bioconductor.org/packages/3.21/bioc
biocViews: Software, Proteomics, PostTranslationalModifications, Pathways, Network
3 changes: 0 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,4 @@ export(setNodeColorToRowz)
export(setNodeMapping)
export(setNodeSizeColorIndependently)
export(strip.cy.goo)
importFrom(gplots,heatmap.2)
importFrom(grDevices,colorRampPalette)
importFrom(grDevices,hcl)
importFrom(rlang,.data)
11 changes: 4 additions & 7 deletions R/BRCAHelpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@
#' )
#' }
#'
#' @importFrom gplots heatmap.2
#' @importFrom grDevices hcl colorRampPalette
#'
graph.ptm.by.cluster <- function(
ptmtable,
common.clusters,
Expand Down Expand Up @@ -174,8 +171,8 @@ graph.ptm.by.cluster <- function(
## image() requires: nrow(z) == length(x)-1, ncol(z) == length(y)-1
write_heat_key <- function(filename, zlim = 3) {
n <- 256L # number of colour cells
cols <- colorRampPalette(c("#3333FF","#E6E6E6","#FFFF00"),
space = "rgb", interpolate = "linear")(n)
cols <- grDevices::colorRampPalette(c("#3333FF", "#E6E6E6", "#FFFF00"),
space = "rgb", interpolate = "linear")(n)
# breakpoints: length n+1 so the z matrix is (1 x n)
brks <- seq(-zlim, zlim, length.out = n + 1L)
z <- matrix(seq_len(n), nrow = 1L, ncol = n) # 1 x n
Expand Down Expand Up @@ -240,8 +237,8 @@ graph.ptm.by.cluster <- function(

# ---- colour setup --------------------------------------------------

heatcols <- colorRampPalette(c("#3333FF","#E6E6E6","#FFFF00"),
space="rgb", interpolate="linear")(255)
heatcols <- grDevices::colorRampPalette(c("#3333FF", "#E6E6E6", "#FFFF00"),
space = "rgb", interpolate = "linear")(255)
breaks <- seq(-zlim, zlim, length.out = 256)

cluster.palette <- make_cluster_colors(length(ordered.blocks))
Expand Down
19 changes: 19 additions & 0 deletions R/PTMsToPathways-package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#' PTMsToPathways: Filtered CoCluster Correlation Network Guide
#'
#' PTMsToPathways provides tools for turning mass spectrometry data on
#' post-translational modifications into clustered networks, co-cluster
#' correlation networks, and downstream pathway and Cytoscape-ready views.
#' The package includes example PTM tables, BRCA example networks, and helper
#' functions for building CCCNs, cluster-filtered PPIs, and pathway crosstalk
#' networks.
#'
#' Typical entry points are [MakeClusterList()], [MakeCorrelationNetwork()],
#' [BuildClusterFilteredNetwork()], [BuildPathwayCrosstalkNetwork()], and the
#' Cytoscape helpers in [GraphCfn()] and related functions.
#'
#' The package comes with many example datasets that can be seen in the vignettes.
#'
#' @name PTMsToPathways
#' @keywords package
#' @seealso [utils::browseVignettes()]
"_PACKAGE"
4 changes: 2 additions & 2 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ navbar:
- text: "Raw Data Processing"
href: articles/RawDataProcessing.html
- text: "Creating Networks"
href: articles/CreatingNetworks.html
href: articles/GettingStarted.html
- text: "Cytoscape Graphing"
href: articles/CytoscapeGraphing.html
- text: "BRCA Networks"
Expand All @@ -27,6 +27,6 @@ articles:
navbar: ~
contents:
- RawDataProcessing
- CreatingNetworks
- GettingStarted
- CytoscapeGraphing
- BRCANetworks
2 changes: 1 addition & 1 deletion data-raw/ex-creating-networks-data.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# create the full example data as in the vignette CreatingNetworks.
# create the full example data as in the getting started vignette/
# The randomness inherent in the clustering procedure, and the MakeClusterList parameters keep length
# and toolong, make it so that the data generated here may be slightly different than the existing example
# data, which would break tests. So we don't overwrite the existing data, but provide the code for reference.
Expand Down
50 changes: 50 additions & 0 deletions inst/scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# PTMsToPathways data provenance

This directory documents how package data and bundled extdata files are
prepared.

## Source-of-truth scripts

- `data-raw/function-key.R` reads `inst/extdata/FunctionKey.txt` and writes
`data/function_key.rda`.
- `data-raw/ex-pathways-list.R` reads the BioPlanet pathway table and writes
`data/ex_pathways_list.rda`.
- `data-raw/ex-creating-networks-data.R` derives the example clustering and
CCCN objects used in the Getting Started vignette.
- `data-raw/full-PCN-edgelist.R` documents the larger example PCN workflow.
- `data-raw/processed-brca.R` derives the BRCA example objects from the BRCA
phosphoproteomics table and local STRING/GeneMANIA/BioPlanet inputs.

## Bundled extdata sources

- `inst/extdata/AlldataPTMs.txt` is the larger PTM example used in the
Getting Started vignette. The source URL is documented in the vignette and
points to the package repository copy of the file.
- `inst/extdata/pathway.csv` is a BioPlanet pathway table used by
`ReadBioplanetFile()`; the public source is
https://tripod.nih.gov/bioplanet/download/pathway.csv.
- `inst/extdata/bioplanet_pathway_June2025.csv` is a package-local BioPlanet
snapshot used for vignette and data generation workflows.
- `inst/extdata/PhosphoDiscoData_mmc9.txt` is the BRCA phosphoproteomics input
table used in the BRCA vignette and `data-raw/processed-brca.R`.
- `inst/extdata/PhosDiscoModules_mmc11.txt` is the associated module annotation
table used in the BRCA vignette.
- `inst/extdata/FunctionKey.txt` is the annotation key used to generate
`function_key`.
- `inst/extdata/small_string_hs_hugo.tsv` is the preprocessed local STRING
example used to keep vignette and build-time examples offline. It is a subset
of the dataset available on [Zenodo](https://zenodo.org/record/1234567).
- `inst/extdata/Kinase_Substrate_Dataset.txt` is the kinase-substrate example
input used by `GetKinsub.edges()`.
- `inst/extdata/ex_genemania_interactions.txt` and `inst/extdata/ex_gm_results.txt`
are example GeneMANIA outputs used in the vignettes and tests.

## Regeneration notes

- The BRCA example objects are derived from the BRCA phosphoproteomics input,
then filtered through `MakeClusterList()`, `MakeCorrelationNetwork()`,
`GetSTRINGdb.edges()`, `GetGeneMANIA.edges()`, and
`BuildPathwayCrosstalkNetwork()`.
- Several generated data objects rely on randomized clustering. The example
scripts preserve the existing package data rather than overwriting it when the
stochastic outputs would differ.
40 changes: 40 additions & 0 deletions man/PTMsToPathways.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 29 additions & 18 deletions vignettes/BRCANetworks.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ head(ptmtable[, 1:5])
### Create Clusters and Co-Cluster Correlation Networks (CCCNs)

Next, we create clusters and networks from those clusters as in the
[Creating Networks vignette](CreatingNetworks.html). This takes about 10
[Creating Networks vignette](GettingStarted.html). This takes about 10
minutes on a laptop, so we provide both the code and the pre-computed
results for this step. To re-run the analysis, run, the following:

Expand All @@ -156,7 +156,7 @@ adj.consensus.matrix <- clusterlist.data[[2]]
ptm.correlation.matrix <- clusterlist.data[[3]]
```

These are required for the next step.
These are required to create the PTM and Gene co-cluster correlation networks.

```{r eval = TRUE}
CCCN.data <- MakeCorrelationNetwork(adj.consensus.matrix,
Expand Down Expand Up @@ -238,9 +238,10 @@ eval_brca[1:10, ]
### Build Cluster Filtered Networks (CFNs) and Pathway Crosstalk Networks (PCNs)

For PPI edges, the code below demonstrates how to get the STRING-db and
GeneMANIA edges from the static human PPI data downloaded as local files. [todo: instructions
to download once these are available.] Alternatively, the PPI data
can be obtained from STRINGdb and GeneMANIA websites as demonstrated in the [Creating Networks vignette](CreatingNetworks.html).
GeneMANIA edges from the static human PPI data downloaded as local files. These
files are available on [Zenodo](https://zenodo.org/records/20631767).
Alternatively, the PPI data
can be obtained from STRINGdb and GeneMANIA websites as demonstrated in the [getting started with P2P vignette](GettingStarted.html).

```{r eval = FALSE}
string_db_filepath <- "your/filepath/here.tsv"
Expand Down Expand Up @@ -271,7 +272,7 @@ head(stringdb.edges)
The GeneMANIA human PPI edge file contains the following types of interactions:
"Genetic Interactions", "Pathway", "Physical Interactions", and "Predicted."

We choose all but "Genetic Interactions" to include using gm.interaction.types in the following function.
We choose all but "Genetic Interactions" to include using the `gm.interaction.types` parameter in the following function.

```{r eval = FALSE}
genemania_db_filepath <- "your/filepath/here.tsv"
Expand All @@ -291,13 +292,17 @@ genemania.edges <- BRCA_genemania.edges
head(genemania.edges)
```

Next, we retrieve kinase-substrate edges, then obain the cluster filtered network, retaining PPIs only for proteins whose PTMs co-cluster, as demonstrated in the [Creating Networks vignette](CreatingNetworks.html).
Next, we retrieve kinase-substrate edges, then obain the cluster filtered
network, retaining PPIs only for proteins whose PTMs co-cluster, as demonstrated
in the [getting started vignette](GettingStarted.html).

```{r eval = TRUE}
file_path <- system.file("extdata", "Kinase_Substrate_Dataset.txt", package = "PTMsToPathways")
kinsub.edges <- GetKinsub.edges(file_path, gene.cccn.nodes)
```

# Now we can build the CFN.
Now we can build the CFN.
```{r eval = TRUE}
network.list <- BuildClusterFilteredNetwork(gene.cccn.edges,
stringdb.edges,
genemania.edges,
Expand Down Expand Up @@ -350,7 +355,8 @@ dim(PD_module.df) # should be 1017 rows
head(PD_module.df)
```

We note that there are differences from the PTM table imported above. We will work with those sites that match between ptmtable and PD_module.df
We note that there are differences from the PTM table imported above. We will
work with those sites that match between `ptmtable` and `PD_module.df`.

```{r eval = TRUE}
length(intersect(newphos$variable_sites_names, PD_module.df$variableSites)) # 530
Expand Down Expand Up @@ -413,18 +419,19 @@ length(mod63.clust.ptms)
```

P2P provides functions to prepare visualizations of these PTMs in
Cytoscape. This code graphs the CFN/CCCN from all these PTMs:
[Cytoscape](https://cytoscape.org/). First, we create a dataframe of
node information that can be used with `RCy3` functions to create a network in Cytoscape.

```{r eval = TRUE}
funckey <- function_key
funckey <- function_key
cfn.cccn <- ptms_to_cfn(mod63.clust.ptms, cfn = cfn.merged, ptm.cccn.edges = ptm.cccn.edges, ptmtable = ptmtable, pepsep = ";")
cfn_cccn.nodes <- make.cytoscape.node.file(cfn.cccn, funckey, ptmtable,
include.gene.data = TRUE,
include.coclustered.PTMs = TRUE,
ptm.cccn.edges = ptm.cccn.edges)
```

To graph in Cytoscape:
To graph in Cytoscape, use the P2P function `GraphCfn`:

```{r eval = FALSE}
g1 <- GraphCfn(cfn.edges = cfn.cccn, cfn.nodes = cfn_cccn.nodes,
Expand Down Expand Up @@ -459,13 +466,12 @@ cfn_cccn.nodes.cdksubs <- cfn_cccn.nodes[cfn_cccn.nodes$Gene.Name %in% cdk1.subs
```

Two ways to select for CDK1 substrates are presented. Method 1: Using
RCy3.
`RCy3`.

```{r eval = FALSE}
library(RCy3)
selectNodes(cfn_cccn.nodes.cdksubs$id, by = "id", preserve=FALSE)
selectEdgesConnectingSelectedNodes()
createSubnetwork(nodes = getSelectedNodes(), edges = getSelectedEdges(), nodes.by.col = "id", edges.by.col = "name")
RCy3::selectNodes(cfn_cccn.nodes.cdksubs$id, by = "id", preserve=FALSE)
Cy3::selectEdgesConnectingSelectedNodes()
RCy3::createSubnetwork(nodes = RCy3::getSelectedNodes(), edges = RCy3::getSelectedEdges(), nodes.by.col = "id", edges.by.col = "name")
```

Method 2: Using P2P functions.
Expand Down Expand Up @@ -510,7 +516,6 @@ mutant); X21BR010 (PIK3CA missense mutant); and X05BR045 (TP53 nonsense
and MLLT4 frameshift mutants).

```{r eval = FALSE}
library(RCy3)
setNodeColorToRatios(plotcol="X03BR011")
setNodeColorToRowz(plotcol="X03BR011") # This exaggerates the node size and shape somewhat.
setNodeColorToRatios(plotcol="X21BR010")
Expand All @@ -522,3 +527,9 @@ setNodeColorToRowz(plotcol="X05BR045")
Note that different samples have dramatically different differences in
PTMs that are up or down, which is reflected also in total in gene
nodes.

### Session Info

```{r eval = TRUE}
sessionInfo()
```
Loading
Loading