annotate preprocess_datasets/Affymetrix_Preprocessing_Functions.R @ 0:ebf6607b4e6a draft

Uploaded
author proteomisc
date Sat, 02 Dec 2023 14:15:26 +0000
parents
children 4b3faf457c37
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
1 AffymetrixPreprocessingFunction<-function(path="",rawdata,backgroundcorrection_method,normalization_method,summary_method,datasetsource="",listfullnames="")
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
2 {
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
3 colnames(exprs(rawdata))<-listfullnames
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
4 data.bg<-bg.correct(rawdata, method=backgroundcorrection_method)
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
5 data.norm<-normalize(data.bg, method=normalization_method)
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
6 data.sm<-threestep(data.norm, background=F, normalize=F,summary.method=summary_method)
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
7 data_matrix=exprs(data.sm)
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
8 sampleNames(data.sm)<-listfullnames
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
9 if(datasetsource=="extern"){
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
10 colnames(data_matrix)<-listfullnames
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
11 data.sm=ExpressionSet(data_matrix,phenoData=phenoData(data.sm),featureData=featureData(data.sm),
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
12 experimentData=experimentData(data.sm),annotation=annotation(data.sm),protocolData=protocolData(data.sm))
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
13 write.table(format(exprs(data.sm), justify="right"),sep="\t", quote=FALSE,
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
14 row.names=T, col.names=T,file="Matrix.Data.tsv")
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
15 }else{
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
16 colnames(data_matrix)<-designo$sample
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
17 data.sm=ExpressionSet(data_matrix,phenoData=phenoData(data.sm),featureData=featureData(data.sm),
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
18 experimentData=experimentData(data.sm),annotation=annotation(data.sm),protocolData=protocolData(data.sm))
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
19 write.table(format(exprs(data.sm), justify="right"),sep="\t", quote=FALSE,
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
20 row.names=T, col.names=T,file="Matrix.Data.tsv")
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
21 }
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
22 installed<-as.data.frame(installed.packages())
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
23 lbraries=paste(annotation(data.sm),"db",sep='.')
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
24 if(!lbraries%in%installed$Package){
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
25 biocLite(lbraries[!lbraries%in%installed$Package])}
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
26
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
27 suppressWarnings(suppressMessages(library(lbraries,character.only = TRUE)))
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
28
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
29 symbol<-getSYMBOL(rownames(exprs(data.sm)), annotation(data.sm))
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
30 return(list(data.bg=data.bg,data.norm=data.norm,data.sm=data.sm,matrix_data=exprs(data.sm),symbol=symbol))
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
31
ebf6607b4e6a Uploaded
proteomisc
parents:
diff changeset
32 }