make_design<-function(MA_matrix){
  matrix<-RG.MA(MA_matrix$dataNBA)
  colnames_matrix<-NULL
  tmp<-strsplit(colnames(MA_matrix$dataNBA),split=".",fixed = T)
  for(i in 1:ncol(MA_matrix$dataNBA)){
    colnames_matrix[i]<-paste(tmp[[i]][1],"R",sep=".")
    
    # .Red intensity
  }
  i=1;
  for(j in (ncol(MA_matrix$dataNBA)+1):((ncol(MA_matrix$dataNBA)*2))){
    
    colnames_matrix[j]<-paste(tmp[[i]][1],"G",sep=".")
    i<-i+1;
    # .Green intensity
  }
  matrix_data<-cbind(matrix$R,matrix$G)
  colnames(matrix_data)<-colnames_matrix
  rownames(matrix_data)<-rownames(MA_matrix$dataNBA)
  MA_matrix$matrix_data<-log2(matrix_data)
  groupe<-c(rep("case",ncol(matrix$R)),rep("control",ncol(matrix$G)))
  sample=colnames(matrix_data)
  designo<-data.frame(sample=sample,groupetype=rep(designo$group,2),group=groupe)
  MA_matrix$designo<-designo
  write.table(format(designo, justify="right"),sep="\t", quote=FALSE,
              row.names=T, col.names=T,file="design.txt")
  return(MA_matrix)
}
