27
|
1 AffymetrixPreprocessingFunction<-function(rawdata,backgroundcorrection_method,normalization_method,summary_method,datasetsource="",listfullnames="")
|
|
2 {
|
|
3 colnames(exprs(rawdata))<-listfullnames
|
|
4 data.bg<-bg.correct(rawdata, method=backgroundcorrection_method)
|
|
5 data.norm<-normalize(data.bg, method=normalization_method)
|
|
6 data.sm<-threestep(data.norm, background=F, normalize=F,summary.method=summary_method)
|
|
7 data_matrix=exprs(data.sm)
|
|
8 sampleNames(data.sm)<-listfullnames
|
|
9 if(datasetsource=="extern"){
|
|
10 colnames(data_matrix)<-listfullnames
|
|
11 data.sm=ExpressionSet(data_matrix,phenoData=phenoData(data.sm),featureData=featureData(data.sm),
|
|
12 experimentData=experimentData(data.sm),annotation=annotation(data.sm),protocolData=protocolData(data.sm))
|
|
13 write.table(format(exprs(data.sm), justify="right"),sep="\t", quote=FALSE,
|
|
14 row.names=T, col.names=T,file="Matrix.Data.tsv")
|
|
15 }else{
|
|
16 colnames(data_matrix)<-designo$sample
|
|
17 data.sm=ExpressionSet(data_matrix,phenoData=phenoData(data.sm),featureData=featureData(data.sm),
|
|
18 experimentData=experimentData(data.sm),annotation=annotation(data.sm),protocolData=protocolData(data.sm))
|
|
19 write.table(format(exprs(data.sm), justify="right"),sep="\t", quote=FALSE,
|
|
20 row.names=T, col.names=T,file="Matrix.Data.tsv")
|
|
21 }
|
|
22 installed<-as.data.frame(installed.packages())
|
|
23 lbraries=paste(annotation(data.sm),"db",sep='.')
|
|
24 if(!lbraries%in%installed$Package){
|
|
25 suppressWarnings(suppressMessages(require("BiocManager", quietly = TRUE)))
|
|
26 suppressMessages(suppressWarnings(BiocManager::install(lbraries[!lbraries%in%installed$Package])))}
|
|
27
|
|
28 suppressWarnings(suppressMessages(library(lbraries,character.only = TRUE)))
|
|
29
|
|
30 symbol<-getSYMBOL(rownames(exprs(data.sm)), annotation(data.sm))
|
|
31 return(list(data.bg=data.bg,data.norm=data.norm,data.sm=data.sm,matrix_data=exprs(data.sm),symbol=symbol))
|
|
32
|
|
33 }
|