Mercurial > repos > davidvanzessen > clonal_sequences_in_paired_samples
comparison RScript.r @ 70:9643b1fd9c45 draft default tip
Uploaded
author | davidvanzessen |
---|---|
date | Thu, 26 May 2016 09:37:48 -0400 |
parents | c532b3f8dc97 |
children |
comparison
equal
deleted
inserted
replaced
69:c532b3f8dc97 | 70:9643b1fd9c45 |
---|---|
404 p = NULL | 404 p = NULL |
405 print(paste("nrow scatterplot_locus_data", nrow(scatterplot_locus_data))) | 405 print(paste("nrow scatterplot_locus_data", nrow(scatterplot_locus_data))) |
406 if(nrow(scatterplot_locus_data) != 0){ | 406 if(nrow(scatterplot_locus_data) != 0){ |
407 if(on == "normalized_read_count"){ | 407 if(on == "normalized_read_count"){ |
408 scales = 10^(0:6) #(0:ceiling(log10(max(scatterplot_locus_data$normalized_read_count)))) | 408 scales = 10^(0:6) #(0:ceiling(log10(max(scatterplot_locus_data$normalized_read_count)))) |
409 p = ggplot(scatterplot_locus_data, aes(factor(reorder(type, type.order)), normalized_read_count, group=link)) + geom_line() + scale_y_log10(breaks=scales,labels=scales) + expand_limits(y=c(0,10^6)) + scale_x_discrete(breaks=levels(scatterplot_data$type), labels=levels(scatterplot_data$type), drop=FALSE) | 409 #p = ggplot(scatterplot_locus_data, aes(factor(reorder(type, type.order)), normalized_read_count, group=link)) + geom_line() + scale_y_log10(breaks=scales,labels=scales) + expand_limits(y=c(0,10^6)) + scale_x_discrete(breaks=levels(scatterplot_data$type), labels=levels(scatterplot_data$type), drop=FALSE) |
410 print(paste("scatterplot_locus_data:")) | |
411 print(head(scatterplot_locus_data)) | |
412 p = ggplot(scatterplot_locus_data, aes(factor(reorder(type, type.order)), normalized_read_count, group=link)) + geom_line() + scale_y_log10(breaks=scales,labels=scales, limits=c(0,10^6)) + scale_x_discrete(breaks=levels(scatterplot_data$type), labels=levels(scatterplot_data$type), drop=FALSE) | |
410 } else { | 413 } else { |
411 p = ggplot(scatterplot_locus_data, aes(factor(reorder(type, type.order)), Frequency, group=link)) + geom_line() + scale_y_log10(limits=c(0.0001,100), breaks=c(0.0001, 0.001, 0.01, 0.1, 1, 10, 100), labels=c("0.0001", "0.001", "0.01", "0.1", "1", "10", "100")) + scale_x_discrete(breaks=levels(scatterplot_data$type), labels=levels(scatterplot_data$type), drop=FALSE) | 414 p = ggplot(scatterplot_locus_data, aes(factor(reorder(type, type.order)), Frequency, group=link)) + geom_line() + scale_y_log10(limits=c(0.0001,100), breaks=c(0.0001, 0.001, 0.01, 0.1, 1, 10, 100), labels=c("0.0001", "0.001", "0.01", "0.1", "1", "10", "100")) + scale_x_discrete(breaks=levels(scatterplot_data$type), labels=levels(scatterplot_data$type), drop=FALSE) |
412 } | 415 } |
413 p = p + geom_point(aes(colour=type), position="dodge") | 416 p = p + geom_point(aes(colour=type), position="dodge") |
414 p = p + xlab("In one or both samples") + ylab(onShort) + ggtitle(paste(patient1[1,patientIndex], patient1[1,sampleIndex], patient2[1,sampleIndex], onShort, product[iter, titleIndex])) | 417 p = p + xlab("In one or both samples") + ylab(onShort) + ggtitle(paste(patient1[1,patientIndex], patient1[1,sampleIndex], patient2[1,sampleIndex], onShort, product[iter, titleIndex])) |
916 if(sum(in_three)> 0){ | 919 if(sum(in_three)> 0){ |
917 scatterplot_locus_data[in_three,]$type = "In three" | 920 scatterplot_locus_data[in_three,]$type = "In three" |
918 } | 921 } |
919 not_in_one = scatterplot_locus_data$type != "In one" | 922 not_in_one = scatterplot_locus_data$type != "In one" |
920 if(sum(not_in_one) > 0){ | 923 if(sum(not_in_one) > 0){ |
921 scatterplot_locus_data[not_in_one,]$type = "In multiple" | 924 #scatterplot_locus_data[not_in_one,]$type = "In multiple" |
922 } | 925 } |
923 p = NULL | 926 p = NULL |
924 if(nrow(scatterplot_locus_data) != 0){ | 927 if(nrow(scatterplot_locus_data) != 0){ |
925 if(on == "normalized_read_count"){ | 928 if(on == "normalized_read_count"){ |
926 scales = 10^(0:6) #(0:ceiling(log10(max(scatterplot_locus_data$normalized_read_count)))) | 929 scales = 10^(0:6) #(0:ceiling(log10(max(scatterplot_locus_data$normalized_read_count)))) |
927 p = ggplot(scatterplot_locus_data, aes(type, normalized_read_count)) + scale_y_log10(breaks=scales,labels=scales) + expand_limits(y=c(0,1000000)) | 930 p = ggplot(scatterplot_locus_data, aes(type, normalized_read_count)) + scale_y_log10(breaks=scales,labels=scales) + expand_limits(y=c(0,1000000)) |
928 } else { | 931 } else { |
929 p = ggplot(scatterplot_locus_data, aes(type, Frequency)) + scale_y_log10(limits=c(0.0001,100), breaks=c(0.0001, 0.001, 0.01, 0.1, 1, 10, 100), labels=c("0.0001", "0.001", "0.01", "0.1", "1", "10", "100")) + expand_limits(y=c(0,100)) | 932 p = ggplot(scatterplot_locus_data, aes(type, Frequency)) + scale_y_log10(limits=c(0.0001,100), breaks=c(0.0001, 0.001, 0.01, 0.1, 1, 10, 100), labels=c("0.0001", "0.001", "0.01", "0.1", "1", "10", "100")) + expand_limits(y=c(0,100)) |
930 #p = ggplot(scatterplot_locus_data, aes(type, Frequency)) + scale_y_continuous(limits = c(0, 100)) + expand_limits(y=c(0,100)) | 933 #p = ggplot(scatterplot_locus_data, aes(type, Frequency)) + scale_y_continuous(limits = c(0, 100)) + expand_limits(y=c(0,100)) |
931 } | 934 } |
989 png(paste(label1, "_", label2, "_", label3, "_", onShort, "_indiv_all.png", sep=""), width=1920, height=1080) | 992 png(paste(label1, "_", label2, "_", label3, "_", onShort, "_indiv_all.png", sep=""), width=1920, height=1080) |
990 print(plt) | 993 print(plt) |
991 dev.off() | 994 dev.off() |
992 } | 995 } |
993 | 996 |
994 if(F & nrow(triplets) != 0){ | 997 if(nrow(triplets) != 0){ |
995 | 998 |
996 cat("<tr><td>Starting triplet analysis</td></tr>", file=logfile, append=T) | 999 cat("<tr><td>Starting triplet analysis</td></tr>", file=logfile, append=T) |
997 | 1000 |
998 triplets$uniqueID = "ID" | 1001 triplets$uniqueID = "ID" |
999 | 1002 |