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
# to run this using Docker from the command line on the stock Bioconductor image: | |
# docker run -it bioconductor/bioconductor_docker:latest R | |
BiocManager::install("cBioPortalData") | |
library(cBioPortalData) | |
#acc_tcga full data pack | |
system.time(accpack <- cBioDataPack("acc_tcga")) #~10 seconds | |
accpack |
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
# docker run -it bioconductor/bioconductor_docker:latest R | |
BiocManager::install("cBioPortalData") | |
library(cBioPortalData) | |
cBio <- cBioPortal() | |
system.time(acc <- cBioPortalData(cBio, studyId = "acc_tcga", genePanelId = "IMPACT341")) | |
acc |
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
# docker run -it bioconductor/bioconductor_docker:latest R | |
BiocManager::install("cBioPortalData") | |
library(cBioPortalData) | |
cBio <- cBioPortal() | |
system.time(gbm <- cBioPortalData(cBio, studyId = "gbm_tcga", genePanelId = "IMPACT341")) | |
gbm | |
# again | |
system.time(gbm <- cBioPortalData(cBio, studyId = "gbm_tcga", genePanelId = "IMPACT341")) |
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
source("https://raw.githubusercontent.com/waldronlab/bugSigSimple/master/R/simple.R") | |
x=readCurationSheet("https://github.com/waldronlab/bugSigSimple/blob/master/inst/extdata/Microbial%20signatures%20curation%20-%20signatures.tsv?raw=true") | |
length(unique(x$PMID)) | |
writeLines(unique(x$PMID), file("signaturesPMID.txt")) |
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(BiocManager) | |
dir.create("~/packagefiles") | |
unlink("installationresults.txt") | |
pkgs <- available.packages(contrib.url(BiocManager::repositories()["BioCsoft"])) | |
pkgs <- rownames(pkgs) | |
set.seed(1) | |
pkgs <- sample(pkgs) | |
## pkgs <- pkgs[!pkgs %in% installed.packages()] |
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( Biobase::package.version("curatedTCGAData") < "1.5.6" ){ | |
BiocManager::install("waldronlab/curatedTCGAData") | |
} | |
stopifnot(BiocManager::version() >= "3.9") | |
library(curatedTCGAData) #requires >=1.5.6 and bioc-devel | |
mae <- curatedTCGAData("UCEC", "Methylation_methyl27", dry.run = FALSE) #~2 seconds from cache | |
dm <- assay(mae, 1) | |
# benchmarking showing cubic increase with # rows |
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
# Masseroli et al 2018, https://doi.org/10.1093/bioinformatics/bty688 | |
# "In TCGA data of BRCA patients, find the DNA somatic mutations | |
# within the first 2000 bp outside of the genes that are both | |
# expressed with FPKM > 3 and have at least a methylation in the same patient | |
# biospecimen, and extract these mutations of the top 5% patients | |
# with the highest number of such mutations." | |
library(curatedTCGAData) | |
system.time(mae <- curatedTCGAData("ACC", c("Mutation", "RNASeq2GeneNorm", "Methylation"), dry.run = FALSE)) |
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(GenomicRanges) | |
library(RaggedExperiment) | |
sample1 <- GRanges( | |
c(A = "chr1:1-10:-", B = "chr1:8-14:+", C = "chr2:15-18:+"), | |
score = 3:5) | |
sample2 <- GRanges( | |
c(D = "chr1:1-10:-", E = "chr2:11-18:+"), | |
score = 1:2) | |
colDat <- DataFrame(id = 1:2) |
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(curatedTCGAData) | |
curatedTCGAData("OV") | |
mae <- curatedTCGAData("OV", assays=c("mRNAArray", "RNASeq2GeneNorm", "RNASeqGene"), dry.run = FALSE) | |
library(TCGAutils) | |
keep <- TCGAsampleSelect(colnames(mae), 11) | |
mae <- mae[, keep, ] | |
mae <- intersectColumns(mae) | |
mae <- intersectRows(mae) | |
library(org.Hs.eg.db) |
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
.cMAE <- function(mae, x, name="newelement"){ | |
el <- ExperimentList(tmp=x) | |
names(el)[1] <- name | |
c(mae, el) | |
} | |
.hasSymbols <- function(x){ | |
mean(c(FALSE, grepl("^[A-Z0-9]{1,6}|^C[0-9]orf[0-9]{1,4}", rownames(x))), na.rm=TRUE) > 0.9 | |
} | |
.isSummarizedExperiment <- function(x){ |