## ----knitrSetup, include=FALSE------------------------------------------- library(knitr) opts_chunk$set(out.extra='style="display:block; margin: auto"', fig.align="center", tidy=FALSE) ## ----install, eval=FALSE------------------------------------------------- ## source("http://bioconductor.org/biocLite.R") ## biocLite("rcellminer") ## biocLite("rcellminerData") ## ----loadLibrary, message=FALSE, warning=FALSE--------------------------- library(rcellminer) library(rcellminerData) ## ----searchHelp, eval=FALSE, tidy=FALSE---------------------------------- ## help.search("rcellminer") ## ----plotCellminer------------------------------------------------------- # Get Cellminer data drugAct <- exprs(getAct(rcellminerData::drugData)) molData <- getMolDataMatrices() # Two drugs nsc <- c("3284", "739") plots <- c("drug", "drug") plotCellMiner(drugAct, molData, plots, nsc, NULL) # Just drug nsc <- "94600" plots <- c("drug") plotCellMiner(drugAct, molData, plots, nsc, NULL) # Just expression gene <- "TP53" plots <- c("exp") plotCellMiner(drugAct, molData, plots, NULL, gene) # Two genes # NOTE: subscript out of bounds Errors likely mean the gene is not present for that data type gene <- c("TP53", "MDM2") plots <- c("exp", "mut", "exp") plotCellMiner(drugAct, molData, plots, NULL, gene) # Gene and drug to plot nsc <- "94600" gene <- "TP53" plots <- c("mut", "drug", "cop") plotCellMiner(drugAct, molData, plots, nsc, gene) ## ----plotDrugSets-------------------------------------------------------- # Get CellMiner data drugAct <- exprs(getAct(rcellminerData::drugData)) # Select drugs using NSC IDs drugs <- "26273 39367 39368 105546 120958 255523 284751 289900 736740 743891 752330" drugs <- strsplit(drugs, " ")[[1]] drugAct <- drugAct[drugs,] mainLabel <- paste("Drug Set: 1, Drugs:", length(drugs), sep=" ") plotDrugSets(drugAct, drugs, mainLabel) ## ----plotStructures------------------------------------------------------ plotStructuresFromNscs("Topotecan", getSmiles("609699")) ## ----compareFingerPrints, results='hide', message=FALSE, warning=FALSE---- # Load sqldf library(sqldf) # Set up necessary data ## Compound annotations df <- as(featureData(getAct(rcellminerData::drugData)), "data.frame") ## Drug activities drugAct <- exprs(getAct(rcellminerData::drugData)) ## Molecular profiling data molData <- getMolDataMatrices() # Example filter on particular properties of the compounds tmpDf <- sqldf("SELECT NSC, SMILES FROM df WHERE SMILES != ''") # Compare against the 100 NSCs for demonstration ids <- head(tmpDf$NSC, 100) smiles <- head(tmpDf$SMILES, 100) # All public #ids <- tmpDf$nsc #smiles <- tmpDf$smiles drugOfInterest <- "MK2206" smilesOfInterest <- "C1CC(C1)(C2=CC=C(C=C2)C3=C(C=C4C(=N3)C=CN5C4=NNC5=O)C6=CC=CC=C6)N" # Make a vector of all the compounds to be pairwise compared ids <- c(drugOfInterest, ids) smiles <- c(smilesOfInterest, smiles) ## ----runComparison, results='hide', message=FALSE------------------------ # Run fingerprint comparison results <- compareFingerprints(ids, smiles) ## ----plotSimilarStructures----------------------------------------------- # Plot top 2 results resultsIdx <- sapply(names(results)[2:3], function(x) { which(tmpDf$NSC == x) }) resultsIds <- names(results)[2:3] resultsSmiles <- tmpDf$SMILES[resultsIdx] resultsIds <- c(drugOfInterest, resultsIds) resultsSmiles <- c(smilesOfInterest, resultsSmiles) plotStructuresFromNscs(resultsIds, resultsSmiles, titleCex=0.5, mainLabel="Fingerprint Results") ## ----plotCellMiner------------------------------------------------------- nscs <- names(results)[2:3] plotCellMiner(drugAct=drugAct, molData=molData, plots=rep("drug", length(nscs)), nscs, NULL) ## ----makeDrugInfoTable, results='hide', message=FALSE-------------------- drugAnnot <- as(featureData(getAct(rcellminerData::drugData)), "data.frame") knownMoaDrugs <- unique(c(getMoaToCompounds(), recursive = TRUE)) knownMoaDrugInfo <- data.frame(NSC=knownMoaDrugs, stringsAsFactors = FALSE) knownMoaDrugInfo$Name <- drugAnnot[knownMoaDrugInfo$NSC, "NAME"] knownMoaDrugInfo$MOA <- vapply(knownMoaDrugInfo$NSC, getMoaStr, character(1)) # Order drugs by mechanism of action. knownMoaDrugInfo <- knownMoaDrugInfo[order(knownMoaDrugInfo$MOA), ] ## ----computeGI50Data, results='hide', message=FALSE---------------------- negLogGI50Data <- getDrugActivityData(nscSet = knownMoaDrugInfo$NSC) gi50Data <- 10^(-negLogGI50Data) ## ----makeIntegratedTable, results='hide', message=FALSE------------------ knownMoaDrugAct <- as.data.frame(cbind(knownMoaDrugInfo, gi50Data), stringsAsFactors = FALSE) # This table can be written out to a file #write.table(knownMoaDrugAct, file="knownMoaDrugAct.txt", quote=FALSE, sep="\t", row.names=FALSE, col.names=TRUE, na="NA") ## ----sessionInfo--------------------------------------------------------- sessionInfo()