comparison preprocess_datasets/Affymetrix_Preprocessing_Functions.R @ 0:ebf6607b4e6a draft

Uploaded
author proteomisc
date Sat, 02 Dec 2023 14:15:26 +0000
parents
children 4b3faf457c37
comparison
equal deleted inserted replaced
-1:000000000000 0:ebf6607b4e6a
1 AffymetrixPreprocessingFunction<-function(path="",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 biocLite(lbraries[!lbraries%in%installed$Package])}
26
27 suppressWarnings(suppressMessages(library(lbraries,character.only = TRUE)))
28
29 symbol<-getSYMBOL(rownames(exprs(data.sm)), annotation(data.sm))
30 return(list(data.bg=data.bg,data.norm=data.norm,data.sm=data.sm,matrix_data=exprs(data.sm),symbol=symbol))
31
32 }