comparison RScript.r @ 32:dde5ec847549 draft

Uploaded
author davidvanzessen
date Tue, 02 Jun 2015 05:33:58 -0400
parents ce8bd23d0335
children 642b4593f0a4
comparison
equal deleted inserted replaced
31:ce8bd23d0335 32:dde5ec847549
287 lapply(patients, FUN=patientCountOnColumn, product = product, interval=interval, on="normalized_read_count") 287 lapply(patients, FUN=patientCountOnColumn, product = product, interval=interval, on="normalized_read_count")
288 288
289 cat("</table></html>", file=logfile, append=T) 289 cat("</table></html>", file=logfile, append=T)
290 290
291 scales = 10^(0:6) #(0:ceiling(log10(max(scatterplot_locus_data$normalized_read_count)))) 291 scales = 10^(0:6) #(0:ceiling(log10(max(scatterplot_locus_data$normalized_read_count))))
292 p = ggplot(single_patients, aes(Rearrangement, normalized_read_count)) + scale_y_log10(breaks=scales,labels=scales) 292 p = ggplot(single_patients, aes(Rearrangement, normalized_read_count)) + scale_y_log10(breaks=scales,labels=scales) + expand_limits(y=c(0,1000000))
293 p = p + geom_point(aes(colour=type), position="jitter") 293 p = p + geom_point(aes(colour=type), position="jitter")
294 p = p + xlab("In one or both samples") + ylab("Reads") 294 p = p + xlab("In one or both samples") + ylab("Reads")
295 p = p + facet_grid(.~Patient) + ggtitle("Scatterplot of the reads of the patients with a single sample") 295 p = p + facet_grid(.~Patient) + ggtitle("Scatterplot of the reads of the patients with a single sample")
296 png("singles_reads_scatterplot.png", width=640 * length(unique(single_patients$Patient)), height=1080) 296 png("singles_reads_scatterplot.png", width=640 * length(unique(single_patients$Patient)), height=1080)
297 print(p) 297 print(p)
298 dev.off() 298 dev.off()
299 299
300 p = ggplot(single_patients, aes(Rearrangement, Frequency)) 300 p = ggplot(single_patients, aes(Rearrangement, Frequency)) + scale_y_continuous(limits = c(0, 100)) + expand_limits(y=c(0,100))
301 p = p + geom_point(aes(colour=type), position="jitter") 301 p = p + geom_point(aes(colour=type), position="jitter")
302 p = p + xlab("In one or both samples") + ylab("Frequency") 302 p = p + xlab("In one or both samples") + ylab("Frequency")
303 p = p + facet_grid(.~Patient) + ggtitle("Scatterplot of the frequency of the patients with a single sample") 303 p = p + facet_grid(.~Patient) + ggtitle("Scatterplot of the frequency of the patients with a single sample")
304 png("singles_freq_scatterplot.png", width=640 * length(unique(single_patients$Patient)), height=1080) 304 png("singles_freq_scatterplot.png", width=640 * length(unique(single_patients$Patient)), height=1080)
305 print(p) 305 print(p)
446 } 446 }
447 p = NULL 447 p = NULL
448 if(nrow(scatterplot_locus_data) != 0){ 448 if(nrow(scatterplot_locus_data) != 0){
449 if(on == "normalized_read_count"){ 449 if(on == "normalized_read_count"){
450 scales = 10^(0:6) #(0:ceiling(log10(max(scatterplot_locus_data$normalized_read_count)))) 450 scales = 10^(0:6) #(0:ceiling(log10(max(scatterplot_locus_data$normalized_read_count))))
451 p = ggplot(scatterplot_locus_data, aes(type, normalized_read_count)) + scale_y_log10(breaks=scales,labels=scales) 451 p = ggplot(scatterplot_locus_data, aes(type, normalized_read_count)) + scale_y_log10(breaks=scales,labels=scales) + expand_limits(y=c(0,1000000))
452 } else { 452 } else {
453 p = ggplot(scatterplot_locus_data, aes(type, Frequency)) 453 p = ggplot(scatterplot_locus_data, aes(type, Frequency)) + scale_y_continuous(limits = c(0, 100)) + expand_limits(y=c(0,100))
454 } 454 }
455 p = p + geom_point(aes(colour=type), position="jitter") 455 p = p + geom_point(aes(colour=type), position="jitter")
456 p = p + xlab("In one or in multiple samples") + ylab(onShort) + ggtitle(paste(label1, label2, label3, onShort, product[iter, titleIndex])) 456 p = p + xlab("In one or in multiple samples") + ylab(onShort) + ggtitle(paste(label1, label2, label3, onShort, product[iter, titleIndex]))
457 } else { 457 } else {
458 p = ggplot(NULL, aes(x=c("In one", "In multiple"),y=0)) + geom_blank(NULL) + xlab("In two or in three of the samples") + ylab(onShort) + ggtitle(paste(label1, label2, label3, onShort, product[iter, titleIndex])) 458 p = ggplot(NULL, aes(x=c("In one", "In multiple"),y=0)) + geom_blank(NULL) + xlab("In two or in three of the samples") + ylab(onShort) + ggtitle(paste(label1, label2, label3, onShort, product[iter, titleIndex]))