Mercurial > repos > testtool > geo_data
view getGEO/test-data/.Rhistory @ 65:ad054b925eda draft
Uploaded
author | testtool |
---|---|
date | Thu, 11 May 2017 06:31:45 -0400 |
parents | 7aab6e28c62e |
children |
line wrap: on
line source
what == "Beta" & (min(exprs(gset)[, 1], na.rm = TRUE) < 0 | max(exprs(gset)[, 1], na.rm = TRUE) > 1) ??getLocations sampleNames(gset) <- gset$title if (platform != "GPL13534") warning(sprintf("%s is not the platform ID associated with IlluminaHumanMethylation450k. Should be GPL13534.", platform)) if (what == "Beta" & (min(exprs(gset)[, 1], na.rm = TRUE) < 0 | max(exprs(gset)[, 1], na.rm = TRUE) > 1)) warning("Values outside [0,1] detected. 'what' argument should not be Beta.") ann <- .getAnnotationString(c(array = array, annotation = annotation)) if (!require(ann, character.only = TRUE)) stop(sprintf("cannot load annotation package %s", ann)) getGenomicRatioSetFromGEO object <- get(platform) platform gr <- getLocations(gset, mergeManifest = mergeManifest, orderByLocation = TRUE) gr <- getLocations(gset) gset gr <- getLocations(platform) ??getLocations locusNames <- names(gset) sampleNames(gset) <- gset$title common <- intersect(locusNames, fData(gset)$Name) if (length(common) == 0) stop("No rowname matches. 'rownames' need to match IlluminaHumanMethylation450k probe names.") ind1 <- match(common, fData(gset)$Name) ind2 <- match(common, locusNames) preprocessing <- c(rg.norm = paste0("See GEO ", GSE, " for details")) if (what == "Beta") { out <- GenomicRatioSet(gr = gr[ind2, ], Beta = exprs(gset)[ind1, , drop = FALSE], M = NULL, CN = NULL, pData = pData(gset), annotation = c(array = array, annotation = annotation), preprocessMethod = preprocessing) } what out <- GenomicRatioSet(gr = gr[ind2, ], Beta = exprs(gset)[ind1, , drop = FALSE], M = NULL, CN = NULL, pData = pData(gset), annotation = c(array = array, annotation = annotation), preprocessMethod = preprocessing) out <- GenomicRatioSet(gr = gset[ind2, ], Beta = exprs(gset)[ind1, , drop = FALSE], M = NULL, CN = NULL, pData = pData(gset), annotation = c(array = array, annotation = annotation), preprocessMethod = preprocessing) ind2 ind1 common sampleNames(gset) class(gmSet) out <- GenomicRatioSet(gr = gmset, Beta = exprs(gset)[ind1, , drop = FALSE], M = NULL, CN = NULL, pData = pData(gset), annotation = c(array = array, annotation = annotation), preprocessMethod = preprocessing) if (length(TAB$ID) > 1) { mysamples <- do.call("data.table", lapply(TAB$ID[-1], function(x) Table(getGEO(x, getGPL = FALSE))[, -1])) gmSet <- data.table(IlmnIDTable[, -1], mysamples) } else { gmSet <- Table(getGEO(TAB$ID, getGPL = FALSE)) } out <- GenomicRatioSet(gr = gmset, Beta = exprs(gset)[ind1, , drop = FALSE], M = NULL, CN = NULL, pData = pData(gset), annotation = c(array = array, annotation = annotation), preprocessMethod = preprocessing) out <- GenomicRatioSet(gr = gmSet, Beta = exprs(gset)[ind1, , drop = FALSE], M = NULL, CN = NULL, pData = pData(gset), annotation = c(array = array, annotation = annotation), preprocessMethod = preprocessing) ??GenomicRatioSet sampleNames(gset) common class(gset) ??GenomicRatioSet GenomicRatioSet getGenomicRatioSetFromGEO GSE <- "GSE51547" function (GSE = NULL, path = NULL, array = "IlluminaHumanMethylation450k", annotation = .default.450k.annotation, what = c("Beta", "M"), mergeManifest = FALSE, i = 1) { what <- match.arg(what) if (is.null(GSE) && is.null(path)) stop("Either GSE or path must be supplied.") if (!is.null(GSE)) gset <- GEOquery::getGEO(GSE) else gset <- GEOquery::getGEO(filename = file.path(path, list.files(path, pattern = ".soft"))) if (length(gset) == 0) stop("Empty list retrieved from GEO.") if (length(gset) > 1) { warning("More than one ExpressionSet found:\n", names(gset), "\nUsing entry ", i) gset <- gset[[i]] } else gset <- gset[[1]] platform <- annotation(gset) if (platform != "GPL13534") warning(sprintf("%s is not the platform ID associated with IlluminaHumanMethylation450k. Should be GPL13534.", platform)) if (what == "Beta" & (min(exprs(gset)[, 1], na.rm = TRUE) < 0 | max(exprs(gset)[, 1], na.rm = TRUE) > 1)) warning("Values outside [0,1] detected. 'what' argument should not be Beta.") ann <- .getAnnotationString(c(array = array, annotation = annotation)) if (!require(ann, character.only = TRUE)) stop(sprintf("cannot load annotation package %s", ann)) object <- get(ann) gr <- getLocations(object, mergeManifest = mergeManifest, orderByLocation = TRUE) locusNames <- names(gr) sampleNames(gset) <- gset$title common <- intersect(locusNames, fData(gset)$Name) if (length(common) == 0) stop("No rowname matches. 'rownames' need to match IlluminaHumanMethylation450k probe names.") ind1 <- match(common, fData(gset)$Name) ind2 <- match(common, locusNames) preprocessing <- c(rg.norm = paste0("See GEO ", GSE, " for details")) if (what == "Beta") { out <- GenomicRatioSet(gr = gr[ind2, ], Beta = exprs(gset)[ind1, , drop = FALSE], M = NULL, CN = NULL, pData = pData(gset), annotation = c(array = array, annotation = annotation), preprocessMethod = preprocessing) } else { out <- GenomicRatioSet(gr = gr[ind2, ], Beta = NULL, M = exprs(gset)[ind1, , drop = FALSE], CN = NULL, pData = pData(gset), annotation = c(array = array, annotation = annotation), preprocessMethod = preprocessing) } return(out) } out function (GSE = NULL, path = NULL, array = "IlluminaHumanMethylation450k", annotation = .default.450k.annotation, what = c("Beta", "M"), mergeManifest = FALSE, i = 1) { what <- match.arg(what) if (is.null(GSE) && is.null(path)) stop("Either GSE or path must be supplied.") if (!is.null(GSE)) gset <- GEOquery::getGEO(GSE) else gset <- GEOquery::getGEO(filename = file.path(path, list.files(path, pattern = ".soft"))) if (length(gset) == 0) stop("Empty list retrieved from GEO.") if (length(gset) > 1) { warning("More than one ExpressionSet found:\n", names(gset), "\nUsing entry ", i) gset <- gset[[i]] } GSE <- "GSE51547" function (GSE = NULL, path = NULL, array = "IlluminaHumanMethylation450k", annotation = .default.450k.annotation, what = c("Beta", "M"), mergeManifest = FALSE, i = 1) { what <- match.arg(what) if (is.null(GSE) && is.null(path)) stop("Either GSE or path must be supplied.") if (!is.null(GSE)) gset <- GEOquery::getGEO(GSE) else gset <- GEOquery::getGEO(filename = file.path(path, list.files(path, pattern = ".soft"))) if (length(gset) == 0) stop("Empty list retrieved from GEO.") if (length(gset) > 1) { warning("More than one ExpressionSet found:\n", names(gset), "\nUsing entry ", i) gset <- gset[[i]] } else gset <- gset[[1]] platform <- annotation(gset) if (platform != "GPL13534") warning(sprintf("%s is not the platform ID associated with IlluminaHumanMethylation450k. Should be GPL13534.", platform)) if (what == "Beta" & (min(exprs(gset)[, 1], na.rm = TRUE) < 0 | max(exprs(gset)[, 1], na.rm = TRUE) > 1)) warning("Values outside [0,1] detected. 'what' argument should not be Beta.") ann <- .getAnnotationString(c(array = array, annotation = annotation)) if (!require(ann, character.only = TRUE)) stop(sprintf("cannot load annotation package %s", ann)) object <- get(ann) gr <- getLocations(object, mergeManifest = mergeManifest, orderByLocation = TRUE) locusNames <- names(gr) sampleNames(gset) <- gset$title common <- intersect(locusNames, fData(gset)$Name) if (length(common) == 0) stop("No rowname matches. 'rownames' need to match IlluminaHumanMethylation450k probe names.") ind1 <- match(common, fData(gset)$Name) ind2 <- match(common, locusNames) preprocessing <- c(rg.norm = paste0("See GEO ", GSE, " for details")) if (what == "Beta") { out <- GenomicRatioSet(gr = gr[ind2, ], Beta = exprs(gset)[ind1, , drop = FALSE], M = NULL, CN = NULL, pData = pData(gset), annotation = c(array = array, annotation = annotation), preprocessMethod = preprocessing) } else { out <- GenomicRatioSet(gr = gr[ind2, ], Beta = NULL, M = exprs(gset)[ind1, , drop = FALSE], CN = NULL, pData = pData(gset), annotation = c(array = array, annotation = annotation), preprocessMethod = preprocessing) } return(out) } function (GSE = NULL, path = NULL, array = "IlluminaHumanMethylation450k", annotation = .default.450k.annotation, what = c("Beta", "M"), mergeManifest = FALSE, i = 1) { what <- match.arg(what) if (is.null(GSE) && is.null(path)) stop("Either GSE or path must be supplied.") if (!is.null(GSE)) gset <- GEOquery::getGEO(GSE) else gset <- GEOquery::getGEO(filename = file.path(path, list.files(path, pattern = ".soft"))) if (length(gset) == 0) stop("Empty list retrieved from GEO.") if (length(gset) > 1) { warning("More than one ExpressionSet found:\n", names(gset), "\nUsing entry ", i) gset <- gset[[i]] } else gset <- gset[[1]] platform <- annotation(gset) if (platform != "GPL13534") warning(sprintf("%s is not the platform ID associated with IlluminaHumanMethylation450k. Should be GPL13534.", platform)) if (what == "Beta" & (min(exprs(gset)[, 1], na.rm = TRUE) < 0 | max(exprs(gset)[, 1], na.rm = TRUE) > 1)) warning("Values outside [0,1] detected. 'what' argument should not be Beta.") ann <- .getAnnotationString(c(array = array, annotation = annotation)) if (!require(ann, character.only = TRUE)) stop(sprintf("cannot load annotation package %s", ann)) object <- get(ann) gr <- getLocations(object, mergeManifest = mergeManifest, orderByLocation = TRUE) locusNames <- names(gr) sampleNames(gset) <- gset$title common <- intersect(locusNames, fData(gset)$Name) if (length(common) == 0) stop("No rowname matches. 'rownames' need to match IlluminaHumanMethylation450k probe names.") ind1 <- match(common, fData(gset)$Name) ind2 <- match(common, locusNames) preprocessing <- c(rg.norm = paste0("See GEO ", GSE, " for details")) if (what == "Beta") { out <- GenomicRatioSet(gr = gr[ind2, ], Beta = exprs(gset)[ind1, , drop = FALSE], M = NULL, CN = NULL, pData = pData(gset), annotation = c(array = array, annotation = annotation), preprocessMethod = preprocessing) } else { out <- GenomicRatioSet(gr = gr[ind2, ], Beta = NULL, M = exprs(gset)[ind1, , drop = FALSE], CN = NULL, pData = pData(gset), annotation = c(array = array, annotation = annotation), preprocessMethod = preprocessing) } return(out) } return(out) } what <- match.arg(what) if (length(gset) == 0) stop("Empty list retrieved from GEO.") if (length(gset) > 1) { warning("More than one ExpressionSet found:\n", names(gset), "\nUsing entry ", i) gset <- gset[[i]] } else gset <- gset[[1]] platform <- annotation(gset) if (platform != "GPL13534") warning(sprintf("%s is not the platform ID associated with IlluminaHumanMethylation450k. Should be GPL13534.", platform)) if (what == "Beta" & (min(exprs(gset)[, 1], na.rm = TRUE) < 0 | max(exprs(gset)[, 1], na.rm = TRUE) > 1)) warning("Values outside [0,1] detected. 'what' argument should not be Beta.") what platform <- annotation(gset) if (platform != "GPL13534") warning(sprintf("%s is not the platform ID associated with IlluminaHumanMethylation450k. Should be GPL13534.", platform)) if (what == "Beta" & (min(exprs(gset)[, 1], na.rm = TRUE) < 0 | max(exprs(gset)[, 1], na.rm = TRUE) > 1)) warning("Values outside [0,1] detected. 'what' argument should not be Beta.") ann <- .getAnnotationString(c(array = array, annotation = annotation)) if (!require(ann, character.only = TRUE)) stop(sprintf("cannot load annotation package %s", ann)) object <- get(ann) gr <- getLocations(object, mergeManifest = mergeManifest, orderByLocation = TRUE) ann <- .getAnnotationString(c(array = array, annotation = annotation)) ann <- .getAnnotationString(c(array = array, annotation = annotation)) ??getLocations getAnnotation(gset, what = "everything", lociNames = NULL, orderByLocation = FALSE, dropNonMapping = FALSE) ann <- getAnnotation(gset) GEODataTable IlmnIDTable matrix<- as.matrix(gmSet) matrix gr<- GRanges(matrix) IlmnIDTable GEODataTable getGenomicRatioSetFromGEO require("minfi", quietly = TRUE) args <- commandArgs(trailingOnly = TRUE) GSE = args[1] output = args[2] function (GSE = NULL, path = NULL, array = "IlluminaHumanMethylation450k", annotation = .default.450k.annotation, what = c("Beta", "M"), mergeManifest = FALSE, i = 1) { what <- match.arg(what) if (is.null(GSE) && is.null(path)) stop("Either GSE or path must be supplied.") if (!is.null(GSE)) gset <- GEOquery::getGEO(GSE) else gset <- GEOquery::getGEO(filename = file.path(path, list.files(path, pattern = ".soft"))) if (length(gset) == 0) stop("Empty list retrieved from GEO.") if (length(gset) > 1) { warning("More than one ExpressionSet found:\n", names(gset), "\nUsing entry ", i) gset <- gset[[i]] } else gset <- gset[[1]] platform <- annotation(gset) if (platform != "GPL13534") warning(sprintf("%s is not the platform ID associated with IlluminaHumanMethylation450k. Should be GPL13534.", platform)) if (what == "Beta" & (min(exprs(gset)[, 1], na.rm = TRUE) < 0 | max(exprs(gset)[, 1], na.rm = TRUE) > 1)) warning("Values outside [0,1] detected. 'what' argument should not be Beta.") ann <- .getAnnotationString(c(array = array, annotation = annotation)) if (!require(ann, character.only = TRUE)) stop(sprintf("cannot load annotation package %s", ann)) object <- get(ann) gr <- getLocations(object, mergeManifest = mergeManifest, orderByLocation = TRUE) locusNames <- names(gr) sampleNames(gset) <- gset$title common <- intersect(locusNames, fData(gset)$Name) if (length(common) == 0) stop("No rowname matches. 'rownames' need to match IlluminaHumanMethylation450k probe names.") ind1 <- match(common, fData(gset)$Name) ind2 <- match(common, locusNames) preprocessing <- c(rg.norm = paste0("See GEO ", GSE, " for details")) if (what == "Beta") { out <- GenomicRatioSet(gr = gr[ind2, ], Beta = exprs(gset)[ind1, , drop = FALSE], M = NULL, CN = NULL, pData = pData(gset), annotation = c(array = array, annotation = annotation), preprocessMethod = preprocessing) } else { out <- GenomicRatioSet(gr = gr[ind2, ], Beta = NULL, M = exprs(gset)[ind1, , drop = FALSE], CN = NULL, pData = pData(gset), annotation = c(array = array, annotation = annotation), preprocessMethod = preprocessing) } save(out,output) } getwd() GSE <- "GSE51547" output <- ("out.Rdata") require("BiocGenerics", quietly = TRUE) require("data.table", quietly = TRUE) require("GEOquery", quietly = TRUE) require("rtracklayer", quietly = TRUE) require("FDb.InfiniumMethylation.hg19", quietly = TRUE) require("minfi", quietly = TRUE) GSE <- "GSE51547" output <- ("out.Rdata") function (GSE = NULL, path = NULL, array = "IlluminaHumanMethylation450k", annotation = .default.450k.annotation, what = c("Beta", "M"), mergeManifest = FALSE, i = 1) { what <- match.arg(what) if (is.null(GSE) && is.null(path)) stop("Either GSE or path must be supplied.") if (!is.null(GSE)) gset <- GEOquery::getGEO(GSE) else gset <- GEOquery::getGEO(filename = file.path(path, list.files(path, pattern = ".soft"))) if (length(gset) == 0) stop("Empty list retrieved from GEO.") if (length(gset) > 1) { warning("More than one ExpressionSet found:\n", names(gset), "\nUsing entry ", i) gset <- gset[[i]] } else gset <- gset[[1]] platform <- annotation(gset) if (platform != "GPL13534") warning(sprintf("%s is not the platform ID associated with IlluminaHumanMethylation450k. Should be GPL13534.", platform)) if (what == "Beta" & (min(exprs(gset)[, 1], na.rm = TRUE) < 0 | max(exprs(gset)[, 1], na.rm = TRUE) > 1)) warning("Values outside [0,1] detected. 'what' argument should not be Beta.") ann <- .getAnnotationString(c(array = array, annotation = annotation)) if (!require(ann, character.only = TRUE)) stop(sprintf("cannot load annotation package %s", ann)) object <- get(ann) gr <- getLocations(object, mergeManifest = mergeManifest, orderByLocation = TRUE) locusNames <- names(gr) sampleNames(gset) <- gset$title common <- intersect(locusNames, fData(gset)$Name) if (length(common) == 0) stop("No rowname matches. 'rownames' need to match IlluminaHumanMethylation450k probe names.") ind1 <- match(common, fData(gset)$Name) ind2 <- match(common, locusNames) preprocessing <- c(rg.norm = paste0("See GEO ", GSE, " for details")) if (what == "Beta") { out <- GenomicRatioSet(gr = gr[ind2, ], Beta = exprs(gset)[ind1, , drop = FALSE], M = NULL, CN = NULL, pData = pData(gset), annotation = c(array = array, annotation = annotation), preprocessMethod = preprocessing) } else { out <- GenomicRatioSet(gr = gr[ind2, ], Beta = NULL, M = exprs(gset)[ind1, , drop = FALSE], CN = NULL, pData = pData(gset), annotation = c(array = array, annotation = annotation), preprocessMethod = preprocessing) } save(out,output) } out what function (GSE = NULL, path = NULL, array = "IlluminaHumanMethylation450k", annotation = .default.450k.annotation, what = c("Beta", "M"), mergeManifest = FALSE, i = 1) what <- match.arg(what) if (length(gset) == 0) stop("Empty list retrieved from GEO.") if (length(gset) > 1) { warning("More than one ExpressionSet found:\n", names(gset), "\nUsing entry ", i) gset <- gset[[i]] if (length(gset) == 0) { stop("Empty list retrieved from GEO.") } if (length(gset) > 1) { warning("More than one ExpressionSet found:\n", names(gset), "\nUsing entry ", i)} if (length(gset) == 0) stop("Empty list retrieved from GEO.") if (length(gset) > 1) { warning("More than one ExpressionSet found:\n", names(gset), "\nUsing entry ", i) gset <- gset[[i]]} gset else gset <- gset[[1]] gset <- gset[[1]] gset gset <- gset[[i]]} gset <- getGEO(GSE) 1gset <- gset[[i]] if (length(gset) == 0) stop("Empty list retrieved from GEO.") if (length(gset) > 1) { warning("More than one ExpressionSet found:\n", names(gset), "\nUsing entry ", i) 1gset <- gset[[i]] if (length(gset) == 0) stop("Empty list retrieved from GEO.") if (length(gset) > 1) { warning("More than one ExpressionSet found:\n", names(gset), "\nUsing entry ", i) 1gset <- gset[[i]] if (length(gset) == 0) stop("Empty list retrieved from GEO.") if (length(gset) > 1) { warning("More than one ExpressionSet found:\n", names(gset), "\nUsing entry ", i) gset <- gset[[i]] if (length(gset) == 0) stop("Empty list retrieved from GEO.") if (length(gset) > 1) { warning("More than one ExpressionSet found:\n", names(gset), "\nUsing entry ", i) gset <- gset[[i]]} if (length(gset) == 0) stop("Empty list retrieved from GEO.") if (length(gset) > 1) { warning("More than one ExpressionSet found:\n", names(gset), "\nUsing entry ", i) gset <- gset[[i]]} if (length(gset) == 0) { stop("Empty list retrieved from GEO.") if (length(gset) > 1) { warning("More than one ExpressionSet found:\n", names(gset), "\nUsing entry ", i) gset <- gset[[i]]}} if (length(gset) == 0) { stop("Empty list retrieved from GEO.") if (length(gset) > 1) { warning("More than one ExpressionSet found:\n", names(gset), "\nUsing entry ", i) gset <- gset[[i]]}}} # else gset class(gset) ann <- .getAnnotationString(c(array = array, annotation = annotation)) .getAnnotationString getAnnotationString ??annotation ann <- .getAnnotationString(c(array = array, annotation = annotation)) if (!require(ann, character.only = TRUE)) stop(sprintf("cannot load annotation package %s", ann)) object <- get(ann)