AgilentTwoChannelsPreprocessingFunction<- function(data,methodBC,methodNWA,methodNBA)
{
  RG <<- suppressWarnings(suppressMessages(backgroundCorrect(data,method=methodBC, offset= 16)))
  MA <<- suppressWarnings(suppressMessages(normalizeWithinArrays(RG, method=methodNWA,bc.method="none")))
  rownames(MA$A)=rownames(MA$M)=MA$gene$ProbeName
  MA<-MA[rm.na(rownames(MA$M)),]
  MAb <<- suppressWarnings(suppressMessages(normalizeBetweenArrays(MA, method=methodNBA)))
  data_mt<-NaRV.omit(as.data.frame(MAb$M))
  MAb$M=(data_mt)
  MAb$A=NaRV.omit(as.data.frame(MAb$A))
  MAb$genes=(MAb$genes[(MAb$genes$ProbeName %in% c(rownames(MAb$A),rownames(MAb$M))),])
  RG.pq <<- RG.MA(MA)
  MAb$E=MAb$E[rownames(MAb$E) %in% MAb$genes$ProbeName,]
  MA.avg <- suppressWarnings(suppressMessages(avereps(MAb,ID=row.names(MAb$E))))
  data_matrix=NaRV.omit(MA.avg$M)
  colnames(data_matrix)<-designo$sample
  write.table(format(data_matrix, justify="right"),sep="\t", quote=FALSE,
            row.names=T, col.names=T,file="Matrix.Data.tsv")
  Prepro_object1<-list(dataBG=RG,dataNWA=RG.pq,dataNBA=MA.avg,matrix_data=as.matrix(data_matrix),symbol=(MA.avg$genes$GeneName))
  Prepro_object1=make_design(MA_matrix=Prepro_object1)
  return(Prepro_object1)
}
