inst/tests/test_function.R

# This script is used to test functions

####### update_refData #########
update_refData("HUGO")
update_refData("platform")
update_refData("ALL")

data("hugo")
data("platformMap")
rm(hugo, platformMap); gc()
###############################

###### affyPreprocess ########
GEO_IDs <- c("GSE19188", "GSE10072",
             "GSE31210", "GSE7670" ,
             "GSE68465", "GSE27716",
             "GSE17475", "GSE43580",
             "GSE50081", "GSE37745", "GSE28571")
dir_list <- paste0("./inst/tests/iGCC/cel_files/", GEO_IDs)
Studynames <- basename(dir_list)
Study_Res  <- list()
i <- 1
# test affyPreprocess.oligo
Study_Res[[Studynames[i]]] <- affyPreprocess.oligo(dir_list[i])
hist(Study_Res[[1]])

# test affyPreprocess.affy
Study_Res[[Studynames[i]]] <- affyPreprocess.affy(dir_list[i]) # machine memory is small, need test later
hist(Study_Res[[1]])

gse <- getGEO(GEO_IDs[i], destdir = "./inst/tests/iGCC/matrixSeries")
View(fData(gse[[1]]))
##########################

######### creat_Exprset ##########
names(gse) <- GEO_IDs[1]
colnames(fData(gse[[1]])) <- make.names(colnames(fData(gse[[1]])))
Study_Res_New <- create_Exprset(Mat = gse, Res = Study_Res, id = GEO_IDs[1], features = c("ID", "Gene.Title", "Gene.Symbol"),rev_nams = c("ADC", "healthy"), keepSource = "characteristics_ch1.1", Gender = "characteristics_ch1.4", Survival_status = "characteristics_ch1.3", Survival_time = "characteristics_ch1.2")
View(fData(Study_Res_New))
################################

###### ArrayBuildfData ########
identifier <- "SYMBOL"
# identifier <- "ENTREZ_ID"
data(hugo) # load hugo gene symbol dataframe
# database id you want, most useful is gene symbols and entrez ids
if(identifier == "SYMBOL"){
    Features <- as.character(unique(hugo[, "symbol"]))
}else if(identifier == "ENTREZ_ID"){
    Features <- as.character(unique(hugo[, "entrez_id"]))
}

res <- ArrayBuildfData(exprz = Study_Res_New, name = GEO_IDs[i], identifier = "SYMBOL")
##### To Now, all functions except ArrayMerge have been tested.
##### ArrayMerge works well and maybe can be optimized in the future.
rm(list = ls());gc()
##############################
ShixiangWang/iProfile documentation built on May 11, 2019, 6:25 p.m.