Mercurial > repos > drosofff > repenrich
comparison edgeR_repenrich.R @ 3:1805b262c12d draft
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/repenrich commit ca572343d2a24d645dedd6c5d2cb352115ed8bf3
author | drosofff |
---|---|
date | Tue, 30 May 2017 10:34:53 -0400 |
parents | 54a3f3a195d6 |
children |
comparison
equal
deleted
inserted
replaced
2:aed130b47d36 | 3:1805b262c12d |
---|---|
145 normalizedAbundance <- data.frame(Tag=rownames(cpm)) | 145 normalizedAbundance <- data.frame(Tag=rownames(cpm)) |
146 normalizedAbundance <- cbind(normalizedAbundance, cpm) | 146 normalizedAbundance <- cbind(normalizedAbundance, cpm) |
147 write.table(normalizedAbundance, file=opt$countsfile, sep="\t", col.names=TRUE, row.names=FALSE, quote=FALSE) | 147 write.table(normalizedAbundance, file=opt$countsfile, sep="\t", col.names=TRUE, row.names=FALSE, quote=FALSE) |
148 } | 148 } |
149 | 149 |
150 # test | |
151 print(counts) | |
152 print(cpm) | |
153 | |
154 # Conduct fitting of the GLM | 150 # Conduct fitting of the GLM |
155 yfit <- glmFit(y, design) | 151 yfit <- glmFit(y, design) |
156 | 152 |
157 # Initialize result matrices to contain the results of the GLM | 153 # Initialize result matrices to contain the results of the GLM |
158 results <- matrix(nrow=dim(counts)[1],ncol=0) | 154 results <- matrix(nrow=dim(counts)[1],ncol=0) |
159 logfc <- matrix(nrow=dim(counts)[1],ncol=0) | 155 logfc <- matrix(nrow=dim(counts)[1],ncol=0) |
160 | 156 |
161 # Make the comparisons for the GLM | 157 # Make the comparisons for the GLM |
162 my.contrasts <- makeContrasts( | 158 my.contrasts <- makeContrasts( |
163 paste0(opt$levelNameB,"_",opt$levelNameA," = ", opt$levelNameB, " - ", opt$levelNameA), | 159 paste0(opt$levelNameA,"_",opt$levelNameB," = ", opt$levelNameA, " - ", opt$levelNameB), |
164 levels = design | 160 levels = design |
165 ) | 161 ) |
166 | 162 |
167 # Define the contrasts used in the comparisons | 163 # Define the contrasts used in the comparisons |
168 allcontrasts = paste0(opt$levelNameB," vs ",opt$levelNameA) | 164 allcontrasts = paste0(opt$levelNameA," vs ",opt$levelNameB) |
169 | 165 |
170 # Conduct a for loop that will do the fitting of the GLM for each comparison | 166 # Conduct a for loop that will do the fitting of the GLM for each comparison |
171 # Put the results into the results objects | 167 # Put the results into the results objects |
172 lrt <- glmLRT(yfit, contrast=my.contrasts[,1]) | 168 lrt <- glmLRT(yfit, contrast=my.contrasts[,1]) |
173 plotSmear(lrt, de.tags=rownames(y)) | 169 plotSmear(lrt, de.tags=rownames(y)) |