# HG changeset patch # User ynewton # Date 1355775938 18000 # Node ID f3fe0f64fe91f47882110423b2203239adda48f4 # Parent 8389b0c211aead9240d6a193a14bf5f376f42126 Uploaded diff -r 8389b0c211ae -r f3fe0f64fe91 normalize.r --- a/normalize.r Thu Dec 13 11:19:57 2012 -0500 +++ b/normalize.r Mon Dec 17 15:25:38 2012 -0500 @@ -1,5 +1,7 @@ #!/usr/bin/Rscript +#Yulia Newton, last updated 20121217 v.3 + #usage, options and doc goes here argspec <- c("normalize.r - takes any flat file and normalizes the rows or the columns using various normalizations (median_shift, mean_shift, t_statistic (z-score), exp_fit, normal_fit, weibull_0.5_fit, weibull_1_fit, weibull_1.5_fit, weibull_5_fit). Requires a single header line and a single cloumn of annotation. Usage: @@ -216,6 +218,12 @@ rownames(normals_numeric) <- normals[,1][2:length(normals[,1])] colnames(normals_numeric) <- normals[1,][2:length(normals[1,])] + #select only the intersection of the rows between the two matrices: + normals_numeric <- normals_numeric[rownames(normals_numeric) %in% rownames(data_matrix),] + data_matrix <- data_matrix[rownames(data_matrix) %in% rownames(normals_numeric),] + normals_numeric <- normals_numeric[order(rownames(normals_numeric)),] + data_matrix <- data_matrix[order(rownames(data_matrix)),] + combined_matrix <- cbind(data_matrix, normals_numeric) tumor_indices <- c(1:length(data_matrix[1,])) normals_indices <- c(length(tumor_indices)+1:length(normals_numeric[1,]))