From 149b7b413cdfaf4d72c4eee7593646c106b08017 Mon Sep 17 00:00:00 2001 From: "Gun.io Whitespace Robot" Date: Mon, 31 Oct 2011 04:15:36 -0400 Subject: [PATCH] Remove whitespace [Gun.io WhitespaceBot] --- .gitignore | 20 ++++++++++++++++++++ pca_me.R | 2 +- poisson.R | 16 ++++++++-------- standardizeR.R | 26 +++++++++++++------------- 4 files changed, 42 insertions(+), 22 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ac8f968 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.o +*.so +*.pyc + +# Logs and databases # +###################### +*.log + +# OS generated files # +###################### +.DS_Store* +ehthumbs.db +Icon? +Thumbs.db diff --git a/pca_me.R b/pca_me.R index 1cd10bb..960893d 100644 --- a/pca_me.R +++ b/pca_me.R @@ -76,7 +76,7 @@ if (num_cases==0) end <- samples_in_test + count for (j in start:end) { - color[j:j, 1] <- as.character(samples[i:i, 2]) + color[j:j, 1] <- as.character(samples[i:i, 2]) } start <- end + 1 count <- count + samples_in_test diff --git a/poisson.R b/poisson.R index 9c73ba9..363bb2e 100644 --- a/poisson.R +++ b/poisson.R @@ -1,4 +1,4 @@ -# get from input +# get from input data <- commandArgs(trailingOnly=TRUE)[1] # get the file name with the counts mode <- commandArgs(trailingOnly=TRUE)[2] # do you want to use the raw counts or the percent of total reads? pertotal or count num_reads <- commandArgs(trailingOnly=TRUE)[3] # file with the number of reads @@ -10,16 +10,16 @@ data <- read.delim(data, header=T, sep="\t", row.names=1) names <- row.names(data) attach(data) -# define some variables +# define some variables row <- length(data[,1]) # number of functions or OTUs col <- length(data[1,]) # number of samples pvalc <- col + 2 qvalc <- col + 3 -treatment <- gl(2,4,col) # which samples are cases and controls ? +treatment <- gl(2,4,col) # which samples are cases and controls ? outcome <- gl(4,1,col) # which samples are paired ? -# make matricies -counts <- matrix(0, nrow=row, ncol=col) +# make matricies +counts <- matrix(0, nrow=row, ncol=col) pvalue <- array(0, dim=row) pertotal <- matrix(0, nrow=row, ncol=col) qvalue <- matrix(0, nrow=row, ncol=1) @@ -31,16 +31,16 @@ if (mode=="pertotal") for (i in 1:row) { for (j in 1:col) - { + { pertotal[i:i, j:j] <- (data[i:i, j:j]/num_reads[j:j, 1])*100 } - } + } data <- pertotal } # poisson! for (i in 1: row) -{ +{ counts[i,] <- t(data[i,]) model <- glmer(counts[i,] ~ treatment +(0+treatment|outcome),family=poisson()) pvalue[i] <- summary(model)@coefs[2,4] diff --git a/standardizeR.R b/standardizeR.R index 60e9b60..ff1edf0 100644 --- a/standardizeR.R +++ b/standardizeR.R @@ -40,7 +40,7 @@ if (method==0) for (i in 1:row) { for (j in 1:col) - { + { pertotal[i:i, j:j] <- ((data[i:i, j:j])/(reads[j,1]))*100 #pertotal_adj[i:i, j:j] <- pertotal[i:i, j:j]*1000000 #trans[i:i, j:j] <- log(pertotal_adj[i:i, j:j]+1, 2) @@ -57,7 +57,7 @@ if (method==1) for (i in 1:row) { for (j in 1:col) - { + { pertotal[i:i, j:j] <- ((data[i:i, j:j])/(reads[j,1]))*100 trans[i:i, j:j] <- log(pertotal[i:i, j:j]+1, 10) sdev_case[i,1] <- sd(trans[i:i, 1:num_cases]) @@ -74,7 +74,7 @@ if (method==2) for (i in 1:row) { for (j in 1:col) - { + { pertotal[i:i, j:j] <- ((data[i:i, j:j])/(reads[j,1]))*100 trans[i:i, j:j] <- log(pertotal[i:i, j:j]+1, 10) sdev[i,1] <- sd(trans[i:i, 1:col]) @@ -83,13 +83,13 @@ if (method==2) } } -## method 3: Log transform the raw counts. Calculate standard deviation and average for cases and controls, separately, across columns. +## method 3: Log transform the raw counts. Calculate standard deviation and average for cases and controls, separately, across columns. if (method==3) { for (i in 1:row) { for (j in 1:col) - { + { trans[i:i, j:j] <- log(data[i:i, j:j]+1, 2) sdev[1, j:j] <- sd(trans[1:row, j:j]) average[1, j:j] <- mean(trans[1:row, j:j]) @@ -97,13 +97,13 @@ if (method==3) } } -## method 4: Log transform the raw counts. Calculate standard deviation and average for cases and controls, together, across rows. +## method 4: Log transform the raw counts. Calculate standard deviation and average for cases and controls, together, across rows. if (method==4) { for (i in 1:row) { for (j in 1:col) - { + { trans[i:i, j:j] <- log(data[i:i, j:j]+1, 10) sdev[i,1] <- sd(trans[i:i, 1:col]) average[i,1] <- mean(trans[i:i, 1:col]) @@ -117,7 +117,7 @@ if (method==5) for (i in 1:row) { for (j in 1:col) - { + { pertotal[i:i, j:j] <- ((data[i:i, j:j])/(reads[j,1]))*100 } } @@ -198,7 +198,7 @@ if (method==5) stand <- pertotal } -#multiple sample scaling +#multiple sample scaling if (mss=="true") { allstand <- matrix(0, nrow=row*col, ncol=1) @@ -254,7 +254,7 @@ if (ttest=="notpaired") # if doing a ttest if (ttest!="none") { - #make more matricies + #make more matricies qvalues <- matrix(0, nrow=row, ncol=1) qval <- qvalue(ttest[,1])$qvalues qvalues <- as.matrix(qval) @@ -268,7 +268,7 @@ if (ttest!="none") table[, qvalc] <- qvalues print <- data.frame(table, row.names=annotations) print <- print[order(print[,ttestc], print[,qvalc]),] - + #plot some data boxplot(data, main="raw counts") boxplot(pertotal, main="raw percent of total reads") @@ -288,12 +288,12 @@ if (ttest!="none") #if not doing a ttest if (ttest=="none") -{ +{ #make the table table <- matrix(0, nrow=row, ncol=col) table[,1:col] <- as.matrix(stand) print <- data.frame(table, row.names=annotations) - + #plot some data boxplot(data, main="raw counts") boxplot(pertotal, main="raw percent of total reads")