Mercurial > repos > proteomisc > preprocess_dataset
view preprocess_datasets/Affymetrix_Preprocessing_Functions.R @ 34:225eddf25d7f draft
Uploaded
author | proteomisc |
---|---|
date | Mon, 11 Dec 2023 12:17:49 +0000 |
parents | b5eac045873c |
children |
line wrap: on
line source
AffymetrixPreprocessingFunction<-function(rawdata,backgroundcorrection_method,normalization_method,summary_method,datasetsource="",listfullnames="") { colnames(exprs(rawdata))<-listfullnames data.bg<-bg.correct(rawdata, method=backgroundcorrection_method) data.norm<-normalize(data.bg, method=normalization_method) data.sm<-threestep(data.norm, background=F, normalize=F,summary.method=summary_method) data_matrix=exprs(data.sm) sampleNames(data.sm)<-listfullnames if(datasetsource=="extern"){ colnames(data_matrix)<-listfullnames data.sm=ExpressionSet(data_matrix,phenoData=phenoData(data.sm),featureData=featureData(data.sm), experimentData=experimentData(data.sm),annotation=annotation(data.sm),protocolData=protocolData(data.sm)) write.table(format(exprs(data.sm), justify="right"),sep="\t", quote=FALSE, row.names=T, col.names=T,file="Matrix.Data.tsv") }else{ colnames(data_matrix)<-designo$sample data.sm=ExpressionSet(data_matrix,phenoData=phenoData(data.sm),featureData=featureData(data.sm), experimentData=experimentData(data.sm),annotation=annotation(data.sm),protocolData=protocolData(data.sm)) write.table(format(exprs(data.sm), justify="right"),sep="\t", quote=FALSE, row.names=T, col.names=T,file="Matrix.Data.tsv") } installed<-as.data.frame(installed.packages()) lbraries=paste(annotation(data.sm),"db",sep='.') if(!lbraries%in%installed$Package){ suppressWarnings(suppressMessages(require("BiocManager", quietly = TRUE))) suppressMessages(suppressWarnings(BiocManager::install(lbraries[!lbraries%in%installed$Package])))} suppressWarnings(suppressMessages(library(lbraries,character.only = TRUE))) symbol<-getSYMBOL(rownames(exprs(data.sm)), annotation(data.sm)) return(list(data.bg=data.bg,data.norm=data.norm,data.sm=data.sm,matrix_data=exprs(data.sm),symbol=symbol)) }