Previous changeset 7:7ce82833977c (2017-12-12) |
Commit message:
Uploaded |
modified:
RScript.r |
b |
diff -r 7ce82833977c -r eb2aa7cffca3 RScript.r --- a/RScript.r Tue Dec 12 04:53:20 2017 -0500 +++ b/RScript.r Wed Dec 13 06:00:44 2017 -0500 |
[ |
@@ -420,7 +420,9 @@ } else { p = ggplot(NULL, aes(x=c("In one", "In Both"),y=0)) + geom_blank(NULL) + xlab("In one or both of the samples") + ylab(onShort) + ggtitle(paste(patient1[1,"Patient"], patient1[1,"Sample"], patient2[1,"Sample"], onShort, product[iter, "Titles"])) } - png(paste(patient1[1,"Patient"], "_", patient1[1,"Sample"], "_", patient2[1,"Sample"], "_", onShort, "_", product[iter, "Titles"],"_scatter.png", sep="")) + file_name = paste(patient1[1,"Patient"], "_", patient1[1,"Sample"], "_", patient2[1,"Sample"], "_", onShort, "_", product[iter, "Titles"],"_scatter.png", sep="") + print(paste("Writing figure:", file_name)) + png(file_name) print(p) dev.off() if(sum(both) > 0){ @@ -450,7 +452,9 @@ plt = plt + geom_text(aes(ymax=max(Both), x=cut_off_value,y=Both,label=Both), angle=90, hjust=0) plt = plt + xlab("Reads per locus") + ylab("Count") + ggtitle("Number of clones in both") plt = plt + theme(plot.margin = unit(c(1,8.8,0.5,1.5), "lines")) - png(paste(patient, "_", onShort, ".png", sep=""), width=1920, height=1080) + file_name = paste(patient, "_", onShort, ".png", sep="") + print(paste("Writing figure:", file_name)) + png(file_name, width=1920, height=1080) print(plt) dev.off() #(t,r,b,l) @@ -460,7 +464,10 @@ plt = plt + geom_text(aes(ymax=max(percentage), x=cut_off_value,y=percentage,label=percentage), angle=90, hjust=0) plt = plt + xlab("Reads per locus") + ylab("Count") + ggtitle("% clones in both left and right") plt = plt + theme(plot.margin = unit(c(1,8.8,0.5,1.5), "lines")) - png(paste(patient, "_percent_", onShort, ".png", sep=""), width=1920, height=1080) + + file_name = paste(patient, "_percent_", onShort, ".png", sep="") + print(paste("Writing figure:", file_name)) + png(file_name, width=1920, height=1080) print(plt) dev.off() @@ -474,7 +481,9 @@ plt = plt + geom_text(data=patientResult[patientResult$variable == oneSample,], aes(ymax=max(value), x=cut_off_value,y=relativeValue,label=value), angle=90, position=position_dodge(width=0.9), hjust=0, vjust=-0.2) plt = plt + geom_text(data=patientResult[patientResult$variable == twoSample,], aes(ymax=max(value), x=cut_off_value,y=relativeValue,label=value), angle=90, position=position_dodge(width=0.9), hjust=0, vjust=0.8) plt = plt + xlab("Reads per locus") + ylab("Count") + ggtitle(paste("Number of clones in only ", oneSample, " and only ", twoSample, sep="")) - png(paste(patient, "_", onShort, "_both.png", sep=""), width=1920, height=1080) + file_name = paste(patient, "_", onShort, "_both.png", sep="") + print(paste("Writing figure:", file_name)) + png(file_name, width=1920, height=1080) print(plt) dev.off() } @@ -506,7 +515,9 @@ p = p + geom_point(aes(colour=type), position="jitter") p = p + xlab("In one or both samples") + ylab("Reads") p = p + facet_grid(.~Patient) + ggtitle("Scatterplot of the reads of the patients with a single sample") - png("singles_reads_scatterplot.png", width=640 * length(unique(single_patients$Patient)) + 100, height=1080) + file_name = "singles_reads_scatterplot.png" + print(paste("Writing figure:", file_name)) + png(file_name, width=640 * length(unique(single_patients$Patient)) + 100, height=1080) print(p) dev.off() @@ -515,7 +526,9 @@ p = p + geom_point(aes(colour=type), position="jitter") p = p + xlab("In one or both samples") + ylab("Frequency") p = p + facet_grid(.~Patient) + ggtitle("Scatterplot of the frequency of the patients with a single sample") - png("singles_freq_scatterplot.png", width=640 * length(unique(single_patients$Patient)) + 100, height=1080) + file_name = "singles_freq_scatterplot.png" + print(paste("Writing figure:", file_name)) + png(file_name, width=640 * length(unique(single_patients$Patient)) + 100, height=1080) print(p) dev.off() } else { @@ -948,7 +961,9 @@ } else { 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])) } - png(paste(label1, "_", label2, "_", label3, "_", onShort, "_", product[iter, titleIndex],"_scatter.png", sep="")) + file_name = paste(label1, "_", label2, "_", label3, "_", onShort, "_", product[iter, titleIndex],"_scatter.png", sep="") + print(paste("Writing figure:", file_name)) + png(file_name) print(p) dev.off() } @@ -982,7 +997,9 @@ plt = plt + geom_text(aes(ymax=max(All), x=cut_off_value,y=All,label=All), angle=90, hjust=0) plt = plt + xlab("Reads per locus") + ylab("Count") + ggtitle("Number of clones in All") plt = plt + theme(plot.margin = unit(c(1,8.8,0.5,1.5), "lines")) - png(paste(label1, "_", label2, "_", label3, "_", onShort, "_total_all.png", sep=""), width=1920, height=1080) + file_name = paste(label1, "_", label2, "_", label3, "_", onShort, "_total_all.png", sep="") + print(paste("Writing figure:", file_name)) + png(file_name, width=1920, height=1080) print(plt) dev.off() @@ -1000,7 +1017,9 @@ plt = plt + geom_text(data=patientResult[patientResult$variable == twoSample,], aes(ymax=max(value), x=cut_off_value,y=relativeValue,label=value), angle=90, position=position_dodge(width=0.9), hjust=0, vjust=0.4, size=fontSize) plt = plt + geom_text(data=patientResult[patientResult$variable == threeSample,], aes(ymax=max(value), x=cut_off_value,y=relativeValue,label=value), angle=90, position=position_dodge(width=0.9), hjust=0, vjust=1.5, size=fontSize) plt = plt + xlab("Reads per locus") + ylab("Count") + ggtitle("Number of clones in only one sample") - png(paste(label1, "_", label2, "_", label3, "_", onShort, "_indiv_all.png", sep=""), width=1920, height=1080) + file_name = paste(label1, "_", label2, "_", label3, "_", onShort, "_indiv_all.png", sep="") + print(paste("Writing figure:", file_name)) + png(file_name, width=1920, height=1080) print(plt) dev.off() } |