diff preprocess_datasets/Make_matrix_two_channels.R @ 27:b5eac045873c draft

Uploaded
author proteomisc
date Mon, 04 Dec 2023 12:41:06 +0000
parents ebf6607b4e6a
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/preprocess_datasets/Make_matrix_two_channels.R	Mon Dec 04 12:41:06 2023 +0000
@@ -0,0 +1,28 @@
+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)
+}