This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An example of programmatically coloring nodes/edges of an existing Cytoscape network with R | |
library(RCytoscape) | |
library(RColorBrewer) | |
# Generate demo Cytoscape network | |
cy <- CytoscapeConnection() | |
cw <- new.CytoscapeWindow("demo", graph=makeSimpleGraph(), overwriteWindow=TRUE) | |
displayGraph(cw) | |
layoutNetwork(cw) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Install/update necessary packages from CRAN, Bioconductor, GitHub, or local sources | |
#' | |
#' @param file a file with packages; overrides packages parameter | |
#' @param packages a vector of strings with names of packages from CRAN, Bioconductor, GitHub | |
#' @param updatePackages whether to update existing packages (Default: FALSE) | |
#' @param dryRun whether to test for missing packages (Default: FALSE) | |
#' | |
#' @example | |
#' \dontrun { | |
#' source("https://gist.githubusercontent.com/cannin/6b8c68e7db19c4902459/raw/installPackages.R") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert R vector into a call object and then convert the "call" object to a character string | |
# This was useful for converting a vector back into code when generating knitr reports using brew | |
tmp <- c("A", "B", "C") | |
deparse(do.call(call, as.list(c("c", tmp)))) | |
# [1] "c(\"A\", \"B\", \"C\")" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Extract calls to functions | |
#' | |
#' Extracts function and file names for functions from a set of files | |
#' | |
#' @param path a directory path to files to be examined | |
#' @param regexp a regular expression to find function calls | |
#' @param fileRegexp a regular expression for files to be examined (e.g. '.R$') | |
#' @param verbose a boolean whether to print debugging information | |
#' | |
#' @return a data.frame with two columns: 'function', the name of the function and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setRepositories(ind=1:6) | |
options(repos="http://cran.rstudio.com/") | |
if(!require(devtools)) install.packages("devtools") | |
if(!require(testthat)) install.packages("testthat") | |
if(Sys.getenv("TEST_DIR") != "") { | |
testDir <- Sys.getenv("TEST_DIR") | |
} else { | |
testDir <- "inst/tests" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!require("devtools")) install.packages("devtools") | |
library(devtools) | |
if (!require("shinyapps")) devtools::install_github("rstudio/shinyapps") | |
library(shinyapps) | |
# Set working directory to root directory of package | |
#setwd(TOP_LEVEL_PACKAGE_DIRECTORY) | |
# Copy data from data folder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PARAMETERS | |
#cfg <- '{"url":"https://devbotcc:[email protected]/mil2041/netboxr.git", "quick":true, "dependencies":true}' | |
#pkg <- "netboxr" | |
#url <- Sys.getenv("URL") | |
pkg <- Sys.getenv("PKG") | |
cfg <- Sys.getenv("CFG") | |
# FUNCTIONS | |
processTap <- function(inputFile) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(devtools) | |
install(".") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//BASIC TRAVERSAL | |
// Get names for all elements in a BioPAX OWL file and then for just Proteins | |
import org.biopax.paxtools.io.BioPAXIOHandler; | |
import org.biopax.paxtools.io.SimpleIOHandler; | |
import org.biopax.paxtools.model.Model; | |
import org.biopax.paxtools.model.BioPAXElement; | |
import org.biopax.paxtools.model.level3.Protein; | |
// Load a sample test BioPAX File via Simple IO Handler | |
InputStream f = new FileInputStream(new File("data/biopax3-short-metabolic-pathway.owl")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pathway commons | |
pathwaycommons.url=http://www.pathwaycommons.org/pc2/ | |
# BioGene | |
biogene.url=http://cbio.mskcc.org/biogene/ | |
biogene.format=json | |
# iHop | |
ihop.url=http://www.ihop-net.org/UniPub/iHOP/ |
OlderNewer