comparison RScript.r @ 45:2c6d04fa10f4 draft

Uploaded
author davidvanzessen
date Mon, 25 Nov 2013 08:30:26 -0500
parents af2834de221c
children a2db27f58627
comparison
equal deleted inserted replaced
44:20763d15d641 45:2c6d04fa10f4
27 27
28 28
29 test = read.table(inFile, sep="\t", header=TRUE, fill=T) 29 test = read.table(inFile, sep="\t", header=TRUE, fill=T)
30 30
31 test = test[test$Sample != "",] 31 test = test[test$Sample != "",]
32
33 if("Replicate" %in% colnames(test))
34 {
35 test$SRID = do.call(paste, c(test["Sample", "Replicate"], sep = "-"))
36 }
32 37
33 test$Top.V.Gene = gsub("[*]([0-9]+)", "", test$Top.V.Gene) 38 test$Top.V.Gene = gsub("[*]([0-9]+)", "", test$Top.V.Gene)
34 test$Top.D.Gene = gsub("[*]([0-9]+)", "", test$Top.D.Gene) 39 test$Top.D.Gene = gsub("[*]([0-9]+)", "", test$Top.D.Gene)
35 test$Top.J.Gene = gsub("[*]([0-9]+)", "", test$Top.J.Gene) 40 test$Top.J.Gene = gsub("[*]([0-9]+)", "", test$Top.J.Gene)
36 41
124 return() 129 return()
125 } 130 }
126 img = ggplot() + 131 img = ggplot() +
127 geom_tile(data=dat, aes(x=factor(reorder(Top.D.Gene, chr.orderD)), y=factor(reorder(Top.V.Gene, chr.orderV)), fill=relLength)) + 132 geom_tile(data=dat, aes(x=factor(reorder(Top.D.Gene, chr.orderD)), y=factor(reorder(Top.V.Gene, chr.orderV)), fill=relLength)) +
128 theme(axis.text.x = element_text(angle = 90, hjust = 1)) + 133 theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
129 scale_fill_gradient(low="gold", high="blue", na.value="white") + 134 scale_fill_gradient(low="gold", high="blue", na.value="white", limits=c(0,1)) +
130 ggtitle(paste(unique(dat$Sample), " (N=" , sum(dat$Length, na.rm=T) ,")", sep="")) + 135 ggtitle(paste(unique(dat$Sample), " (N=" , sum(dat$Length, na.rm=T) ,")", sep="")) +
131 xlab("D genes") + 136 xlab("D genes") +
132 ylab("V Genes") 137 ylab("V Genes")
133 138
134 png(paste("HeatmapVD_", unique(dat[3])[1,1] , ".png", sep=""), width=150+(15*length(Dchain$v.name)), height=100+(15*length(Vchain$v.name))) 139 png(paste("HeatmapVD_", unique(dat[3])[1,1] , ".png", sep=""), width=150+(15*length(Dchain$v.name)), height=100+(15*length(Vchain$v.name)))
159 return() 164 return()
160 } 165 }
161 img = ggplot() + 166 img = ggplot() +
162 geom_tile(data=dat, aes(x=factor(reorder(Top.J.Gene, chr.orderJ)), y=factor(reorder(Top.V.Gene, chr.orderV)), fill=relLength)) + 167 geom_tile(data=dat, aes(x=factor(reorder(Top.J.Gene, chr.orderJ)), y=factor(reorder(Top.V.Gene, chr.orderV)), fill=relLength)) +
163 theme(axis.text.x = element_text(angle = 90, hjust = 1)) + 168 theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
164 scale_fill_gradient(low="gold", high="blue", na.value="white") + 169 scale_fill_gradient(low="gold", high="blue", na.value="white", limits=c(0,1)) +
165 ggtitle(paste(unique(dat$Sample), " (N=" , sum(dat$Length, na.rm=T) ,")", sep="")) + 170 ggtitle(paste(unique(dat$Sample), " (N=" , sum(dat$Length, na.rm=T) ,")", sep="")) +
166 xlab("J genes") + 171 xlab("J genes") +
167 ylab("V Genes") 172 ylab("V Genes")
168 173
169 png(paste("HeatmapVJ_", unique(dat[3])[1,1] , ".png", sep=""), width=150+(15*length(Jchain$v.name)), height=100+(15*length(Vchain$v.name))) 174 png(paste("HeatmapVJ_", unique(dat[3])[1,1] , ".png", sep=""), width=150+(15*length(Jchain$v.name)), height=100+(15*length(Vchain$v.name)))
191 return() 196 return()
192 } 197 }
193 img = ggplot() + 198 img = ggplot() +
194 geom_tile(data=dat, aes(x=factor(reorder(Top.J.Gene, chr.orderJ)), y=factor(reorder(Top.D.Gene, chr.orderD)), fill=relLength)) + 199 geom_tile(data=dat, aes(x=factor(reorder(Top.J.Gene, chr.orderJ)), y=factor(reorder(Top.D.Gene, chr.orderD)), fill=relLength)) +
195 theme(axis.text.x = element_text(angle = 90, hjust = 1)) + 200 theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
196 scale_fill_gradient(low="gold", high="blue", na.value="white") + 201 scale_fill_gradient(low="gold", high="blue", na.value="white", limits=c(0,1)) +
197 ggtitle(paste(unique(dat$Sample), " (N=" , sum(dat$Length, na.rm=T) ,")", sep="")) + 202 ggtitle(paste(unique(dat$Sample), " (N=" , sum(dat$Length, na.rm=T) ,")", sep="")) +
198 xlab("J genes") + 203 xlab("J genes") +
199 ylab("D Genes") 204 ylab("D Genes")
200 205
201 png(paste("HeatmapDJ_", unique(dat[3])[1,1] , ".png", sep=""), width=150+(15*length(Jchain$v.name)), height=100+(15*length(Dchain$v.name))) 206 png(paste("HeatmapDJ_", unique(dat[3])[1,1] , ".png", sep=""), width=150+(15*length(Jchain$v.name)), height=100+(15*length(Dchain$v.name)))