|
a |
|
b/R/readBrainarrayTable.R |
|
|
1 |
#' Reads table from brainarray homepage |
|
|
2 |
#' |
|
|
3 |
#' @param custom_cdf A string giving the "target" to use. |
|
|
4 |
#' @param version A string giving the version. |
|
|
5 |
#' @return A \code{data.frame} of the info on the relevant brainarray webpage. |
|
|
6 |
#' @examples |
|
|
7 |
#' readBrainarrayTable("ENSG", version = "17.0.0")[1:10, 1:10] |
|
|
8 |
#' readBrainarrayTable("ENST", version = "18.0.0")[1:10, 1:10] |
|
|
9 |
#' readBrainarrayTable("ENSE", version = "19.0.0")[1:10, 1:10] |
|
|
10 |
#' readBrainarrayTable("ENSG")[1:10, 1:10] |
|
|
11 |
#' @importFrom XML readHTMLTable |
|
|
12 |
#' @keywords internal |
|
|
13 |
#' @export |
|
|
14 |
readBrainarrayTable <- function(custom_cdf, version = getLatestVersion()) { |
|
|
15 |
base_url <- |
|
|
16 |
paste0("http://brainarray.mbni.med.umich.edu/Brainarray/Database/", |
|
|
17 |
"CustomCDF/", version, "/" , custom_cdf) |
|
|
18 |
|
|
|
19 |
brain_dat <- readHTMLTable(paste0(base_url, ".asp"), skip.rows = 1, |
|
|
20 |
stringsAsFactors = FALSE)[[2]] |
|
|
21 |
|
|
|
22 |
# Remove first row if the same as rownames |
|
|
23 |
if (all(rownames(brain_dat) == brain_dat[, 1])) { |
|
|
24 |
brain_dat <- brain_dat[, -1] |
|
|
25 |
} |
|
|
26 |
colnames(brain_dat) <- |
|
|
27 |
c("Species", "Chip", "OriginalProbeCount", "CustomCDFName", |
|
|
28 |
"StatsOfCurrentVersionProbe%", "StatsOfCurrentVersionProbeset#", |
|
|
29 |
"StatsOfPreviousVersionProbe%","StatsOfPreviousVersionProbeset#", |
|
|
30 |
"%OfCommonProbesInVersionCurrent", |
|
|
31 |
"%OfCommonProbesInVersionPrevious", |
|
|
32 |
"%OfCommonProbesetsInVersionCurrent", |
|
|
33 |
"%OfCommonProbesetsInVersionPrevious", |
|
|
34 |
"%OfIdenticalProbesetsInVersionCurrent", |
|
|
35 |
"%OfIdenticalProbesetsInVersionPrevious", |
|
|
36 |
"RPackagesSource", "RPackagesWin32", "CDFSeqMapDesc") |
|
|
37 |
|
|
|
38 |
attr(brain_dat, "base_url") <- base_url |
|
|
39 |
return(brain_dat) |
|
|
40 |
} |
|
|
41 |
|
|
|
42 |
|