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
34 changes: 0 additions & 34 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,45 +1,11 @@
# Generated by roxygen2: do not edit by hand

export("%w/o%")
export(BuildClusterFilteredNetwork)
export(BuildPathwayCrosstalkNetwork)
export(EvaluateClusters)
export(GetGeneMANIA.edges)
export(GetKinsub.edges)
export(GetSTRINGdb.edges)
export(GraphCfn)
export(MakeClusterList)
export(MakeCorrelationNetwork)
export(MakeDBInput)
export(NodeEdgeKey)
export(ReadBioplanetFile)
export(StandardizeGeneSymbols)
export(connectNodes.all)
export(cytoscape.graph.PCN.pathways)
export(filter.edges.0)
export(filter.edges.1)
export(filter.edges.between)
export(fix.excel)
export(get.co.clustered.ptms)
export(getCyEdgeNames)
export(graph.ptm.by.cluster)
export(harmonize_cfs)
export(make.cytoscape.node.file)
export(make.gene.data.from.ptmtable)
export(make.genepep.edges)
export(merge2cols)
export(mergeEdges)
export(name.peptide)
export(outersect)
export(ptms_to_cfn)
export(remove.autophos)
export(setCorrEdgeAppearance)
export(setEdgeWidths)
export(setNodeColorToRatios)
export(setNodeColorToRowz)
export(setNodeMapping)
export(setNodeSizeColorIndependently)
export(strip.cy.goo)
importFrom(gplots,heatmap.2)
importFrom(grDevices,colorRampPalette)
importFrom(grDevices,hcl)
65 changes: 32 additions & 33 deletions R/BuildClusterFilteredNetwork.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,42 @@
#' @examples
#' Example_Output <- BuildClusterFilteredNetwork(ex.gene.cccn, ex.stringdb.edges, ex.gm.edges)
#' utils::head(Example_Output)

BuildClusterFilteredNetwork <- function(gene.cccn.edges, stringdb.edges = NULL, genemania.edges = NULL, kinsub.edges = NULL, db.filepaths = c(NULL)) {

# Combine PPIs from different databases
# First Normalize Weights
if (!is.null(stringdb.edges)) {
stringdb.edges$Weight <- 100 * stringdb.edges$Weight / max(stringdb.edges$Weight, na.rm = TRUE) } # this returns a range of 0 to 100
if (!is.null(genemania.edges)) {
genemania.edges$Weight <- 100 * genemania.edges$Weight / max(genemania.edges$Weight, na.rm = TRUE) } # this returns a range of 0 to 100

# Note: if additional PPI data is desired, duplicate the normalization of Weights above and add the additional edge file(s) here (and in the function header)
# Done see below

# Combine gathered PPI edges into one data frame
combined.PPIs <- rbind(stringdb.edges, genemania.edges, kinsub.edges)

if(!is.null(db.filepaths)){
for(path in db.filepaths){
db.edges <- utils::read.table(path)
db.edges$Weight <- 100 * db.edges$Weight / max(db.edges$Weight, na.rm = TRUE) # return a range of 0 to 100
combined.PPIs <- rbind(combined.PPIs, db.edges) # add it to combined.PPIs

# Combine PPIs from different databases
# First Normalize Weights
if (!is.null(stringdb.edges)) {
stringdb.edges$Weight <- 100 * stringdb.edges$Weight / max(stringdb.edges$Weight, na.rm = TRUE)
} # this returns a range of 0 to 100
if (!is.null(genemania.edges)) {
genemania.edges$Weight <- 100 * genemania.edges$Weight / max(genemania.edges$Weight, na.rm = TRUE)
} # this returns a range of 0 to 100

# Note: if additional PPI data is desired, duplicate the normalization of Weights above and add the additional edge file(s) here (and in the function header)
# Done see below

# Combine gathered PPI edges into one data frame
combined.PPIs <- rbind(stringdb.edges, genemania.edges, kinsub.edges)

if (!is.null(db.filepaths)) {
for (path in db.filepaths) {
db.edges <- utils::read.table(path)
db.edges$Weight <- 100 * db.edges$Weight / max(db.edges$Weight, na.rm = TRUE) # return a range of 0 to 100
combined.PPIs <- rbind(combined.PPIs, db.edges) # add it to combined.PPIs
}
}
}

cfn1 <- merge(gene.cccn.edges[,c("source", "target")], combined.PPIs, by=c("source", "target"))
cfn1 <- merge(gene.cccn.edges[, c("source", "target")], combined.PPIs, by = c("source", "target"))

# Undirected edges may be reversed in their order so merge the other way around.
reversed <- combined.PPIs
reversed <- reversed[ , c("target", "source", setdiff(names(gene.cccn.edges), c("source", "target")))]
colnames(reversed)[seq_len(2)] <- c("source", "target") # Rename for merge compatibility
cfn2 <- merge(reversed[,c("source", "target")], combined.PPIs, by=c("source", "target"))
# Undirected edges may be reversed in their order so merge the other way around.
reversed <- combined.PPIs
reversed <- reversed[, c("target", "source", setdiff(names(gene.cccn.edges), c("source", "target")))]
colnames(reversed)[seq_len(2)] <- c("source", "target") # Rename for merge compatibility
cfn2 <- merge(reversed[, c("source", "target")], combined.PPIs, by = c("source", "target"))

# Combine both (removing redundant rows if needed)
cfn <- rbind(cfn1, cfn2)
cfn <- unique(cfn)
# Combine both (removing redundant rows if needed)
cfn <- rbind(cfn1, cfn2)
cfn <- unique(cfn)

return(list(combined.PPIs, cfn))
return(list(combined.PPIs, cfn))
}
#______________________________________________________________________________________________________________________________
# ______________________________________________________________________________________________________________________________
Loading
Loading