diff --git a/PCAWG/mCNV_calling.R b/PCAWG/mCNV_calling.R index 1a6cc20..d1605db 100644 --- a/PCAWG/mCNV_calling.R +++ b/PCAWG/mCNV_calling.R @@ -586,7 +586,7 @@ for (h in 0:(2 * len + 1)) { - png(filename=CNV_name_to_write, width = 640, height = 640) + png(filename=CNV_name_to_write, type = "cairo", width = 640, height = 640) plot(trans_values, ylim=c(0, max(trans_values) + 0.5), ylab="Copy Number", xlab="Samples from the largest cohort", main=CNV_name) abline(h=location) diff --git a/PCAWG/mCNV_mature_genotyping.R b/PCAWG/mCNV_mature_genotyping.R index 1e50c19..9d4050e 100644 --- a/PCAWG/mCNV_mature_genotyping.R +++ b/PCAWG/mCNV_mature_genotyping.R @@ -303,7 +303,7 @@ for (h in 0:(2 * len + 1)) { - png(filename=CNV_name_to_write, width = 640, height = 640) + png(filename=CNV_name_to_write, type = "cairo", width = 640, height = 640) plot(trans_values, ylim=c(0, max(trans_values) + 0.5), ylab="Copy Number", xlab="Samples from the largest cohort", main=CNV_name) abline(h=location) diff --git a/PCAWG/normalization.R b/PCAWG/normalization.R index fe84efb..675171e 100644 --- a/PCAWG/normalization.R +++ b/PCAWG/normalization.R @@ -202,7 +202,7 @@ rect.hclust(hc, k=num_of_clusters, border="red") plotDataFile <- function(x, functionType) { - png("data.file.png", width = 2500, height = 1600, pointsize=32) + png("data.file.png", type = "cairo", width = 2500, height = 1600, pointsize=32) if (identical(functionType, plot)) { functionType(x, pch=19, col=rgb(0,0,0,0.1)) } else { diff --git a/PCAWG/rCNV_calling_snp1.R b/PCAWG/rCNV_calling_snp1.R index e210b6e..bb3c37a 100644 --- a/PCAWG/rCNV_calling_snp1.R +++ b/PCAWG/rCNV_calling_snp1.R @@ -472,7 +472,7 @@ for (h in 0:(2 * len + 1)) { pr = F if (pr) { - png(filename=CNV_name_to_write, width = 640, height = 640) + png(filename=CNV_name_to_write, type = "cairo", width = 640, height = 640) plot_st <- max(1,st - length_of_repr) plot_fn <- min(ncol(resid), fn + length_of_repr) diff --git a/clinCNV.R b/clinCNV.R old mode 100755 new mode 100644 diff --git a/generalHelpers.R b/generalHelpers.R old mode 100755 new mode 100644 diff --git a/germline/helpersGermline.R b/germline/helpersGermline.R index 93f79b6..5e1571d 100644 --- a/germline/helpersGermline.R +++ b/germline/helpersGermline.R @@ -228,7 +228,7 @@ Determine.gender <- function(normalized.coverage.corrected.gc, probes) { clusters <- clKmeans$cluster clusters[clusters == 1] <- "F" clusters[clusters == 2] <- "M" - png(filename=paste0(opt$out, paste0("/genders.png")), width=800, height=800) + png(filename=paste0(opt$out, paste0("/genders.png")), type = "cairo", width=800, height=800) plot(matrix_of_values, col = clKmeans$cluster, xlab="Y Chromsome", ylab="X Chromosome", pch=19, cex=2) points(clKmeans$centers, col = 1:2, pch = 8, cex = 10) dev.off() @@ -480,7 +480,7 @@ returnClustering <- function(minNumOfElemsInCluster) { print(paste("You ask to clusterise intro clusters of size", minNumOfElemsInCluster, "but size of the cohort is", ncol(normal), "which is not enough. We continue without clustering.")) setwd(opt$out) - png(filename="clusteringSolution.png", width=1024, height=1024) + png(filename="clusteringSolution.png", type = "cairo", width=1024, height=1024) plot(x, y, xlab="Coordinate 1", ylab="Coordinate 2", main="Isometric MDS", type="n") text(x, y, labels = colnames(normal), cex=.7, col=clustering + 1) @@ -567,7 +567,7 @@ returnClustering <- function(minNumOfElemsInCluster) { setwd(opt$out) - png(filename="clusteringSolution.png", width=1024, height=1024) + png(filename="clusteringSolution.png", type = "cairo", width=1024, height=1024) plot(x, y, xlab="Coordinate 1", ylab="Coordinate 2", main="Isometric MDS", type="n") text(x, y, labels = row.names(distMatrix), cex=.7, col=clustering + 1) @@ -621,7 +621,7 @@ returnTreeForCorrelation <- function(coverage.normalised.local, sdsOfGermlineSam trainingDataset = trainingDataset[-which(distnacesClose > 1000),] if (nrow(trainingDataset) > 100 & nrow(unique(trainingDataset)) > 10) { fit <- ctree(covariancesClose ~ (distnacesClose) + (sumOfLengths) + minLength + maxLength, data=trainingDataset, control=ctree_control(mincriterion = 0.99)) - png(filename="treeOnCorrelationOfCoverage.png", width=4000, height=1800) + png(filename="treeOnCorrelationOfCoverage.png", type = "cairo", width=4000, height=1800) plot(fit) dev.off() } else { @@ -885,7 +885,7 @@ returnClustering2 <- function(minNumOfElemsInCluster) { print(paste("You ask to clusterise intro clusters of size", minNumOfElemsInCluster, "but size of the cohort is", ncol(normal), "which is not enough. We continue without clustering.")) setwd(opt$out) - png(filename="clusteringSolution.png", width=1024, height=1024) + png(filename="clusteringSolution.png", type = "cairo", width=1024, height=1024) plot(x, y, xlab="Coordinate 1", ylab="Coordinate 2", main="UMAP", type="n") text(x, y, labels = colnames(normal), cex=.7, col=clustering + 1) @@ -935,7 +935,7 @@ returnClustering2 <- function(minNumOfElemsInCluster) { palleteToPlot = rainbow(max(clustering)) colsToPlot = sapply(1:length(clustering), function(i){palleteToPlot[clustering[i]]}) setwd(opt$out) - png(filename="clusteringSolution.png", width=1024, height=1024) + png(filename="clusteringSolution.png", type = "cairo", width=1024, height=1024) plot(x, y, xlab="Coordinate 1", ylab="Coordinate 2", main="UMAP", type="n") text(x, y, labels = row.names(distMatrix), cex=.7, col=colsToPlot) diff --git a/germline/mCNVhelpers.R b/germline/mCNVhelpers.R index 05f5f98..92099aa 100644 --- a/germline/mCNVhelpers.R +++ b/germline/mCNVhelpers.R @@ -342,7 +342,7 @@ findFinalState <- function(coverageNeededToCheck, toyBedFilePolymorphCurrent, mu diagnosticPlot = (length(which(copy_number != as.numeric(names(sort(table(copy_number),decreasing=TRUE)[1])))) >= 0.05 * length(copy_number)) if (diagnosticPlot == T & plotting) { fileName = paste(numberOfClusterAnalysed, toyBedFilePolymorphCurrent[1,1], toyBedFilePolymorphCurrent[1,2], toyBedFilePolymorphCurrent[nrow(toyBedFilePolymorphCurrent),3], sep="_") - png(paste0(folder_name_mcnv, fileName, ".png"), width=length(copy_number) * 3, height=800) + png(paste0(folder_name_mcnv, fileName, ".png"), type = "cairo", width=length(copy_number) * 3, height=800) plot(coverageSummarised ** 2 * bestDivisor, col="black", pch=21,bg=coloursP[(copy_number + 1)]) abline(h=bestLoc ** 2 * bestDivisor) dev.off() diff --git a/mergeFilesFromFolder.R b/mergeFilesFromFolder.R old mode 100755 new mode 100644 diff --git a/somatic/bafSegmentation.R b/somatic/bafSegmentation.R index a3f0d29..17d09c2 100644 --- a/somatic/bafSegmentation.R +++ b/somatic/bafSegmentation.R @@ -253,7 +253,7 @@ determineAllowedChroms <- function(healthySample, tumorSample, healthySampleName subDir = paste0(tumorSampleName, "_", healthySampleName) dir.create(file.path(folderBAF, "result", subDir)) setwd(file.path(folderBAF, "result", subDir)) - png(paste0(tumorSampleName, "_", healthySampleName, ".png"), width=1400, height=600) + png(paste0(tumorSampleName, "_", healthySampleName, ".png"), type = "cairo", width=1400, height=600) op <- par(mar=c(11,4,4,2)) x <- barplot(evaluated, col=colVec, main=paste(tumorSampleName, healthySampleName, "expected proportion of BAF with p < 0.05:", round(pvalueShift, digits=3)), ylim=c(0,1), xaxt="n") text(x-2.5, par("usr")[3] - 0.15, labels = plotLabels, srt = 45, pos = 1, xpd = TRUE) @@ -262,7 +262,7 @@ determineAllowedChroms <- function(healthySample, tumorSample, healthySampleName abline(h=0.1, lwd=2, col="red") dev.off() - png("overdispersion.png", width=1024, height=1024) + png("overdispersion.png", type = "cairo", width=1024, height=1024) plot(overdispersionFactorsNornm ~ overdispersionFactorsTum, main="Dispersion over Binomial") dev.off() diff --git a/somatic/helpersSomatic.R b/somatic/helpersSomatic.R index 2440216..cc70782 100644 --- a/somatic/helpersSomatic.R +++ b/somatic/helpersSomatic.R @@ -145,7 +145,7 @@ formilngLogFoldChange <- function(pairs, normalCov, tumorCov, currentBedFile, ge predictions <- runmed(shiftsChrom, k = 51) shifts[whichChrom] = predictions } - png(paste0(opt$out, "/plot_with_shifts.png"), width=2000, height=1000) + png(paste0(opt$out, "/plot_with_shifts.png"), type = "cairo", width=2000, height=1000) plot(shifts) lines(shifts, col="red", lwd=3) dev.off() @@ -443,7 +443,7 @@ makeBarplot <- function(allPotentialPurities, found_CNVs_total, sample_name) { } datasetForBarplot = (datasetForBarplot / 10**6) maxheight = max(datasetForBarplot) - png(paste0(sample_name, "_clonalityBarplot.png"), width=2400, height=640) + png(paste0(sample_name, "_clonalityBarplot.png"), type = "cairo", width=2400, height=640) bp <- barplot(datasetForBarplot, col=c("brown","blue","darkblue","red") , font.axis=2, beside=T, main=paste("Presence of clones in tumor", sample_name, ", estimated purity: ", max(as.numeric(found_CNVs_total[,6]))), ylim=c(0, 1.05 * maxheight), xlab="Subclones investigated", ylab="Length, MB") for (z in 1:ncol(datasetForBarplotNumber)) { for (v in 1:nrow(datasetForBarplotNumber)) { @@ -1063,7 +1063,7 @@ plotLikelihoodLandscape <- function(datasetOfPuritiesCopies, addressOfPlot, foun local_purities, local_majorBAF, local_minorBAF, left_borders, right_borders, ends_of_chroms, local_majorBAF_second, local_minorBAF_second, local_purities_second) { colorsForCN = c(rgb(1,0,0,0.9), rgb(0.6470588, 0.1647059, 0.1647059, 0.9), rgb(0,0,1,0.9)) - png(filename=addressOfPlot, width=2500, height=1000) + png(filename=addressOfPlot, type = "cairo", width=2500, height=1000) linesOnBarplot = list() orderOfNames = c(paste0("chr", 1:22), "chrX", "chrY") diff --git a/somatic/somaticCallingProcedure.R b/somatic/somaticCallingProcedure.R index 70fd3a0..448ef6d 100644 --- a/somatic/somaticCallingProcedure.R +++ b/somatic/somaticCallingProcedure.R @@ -721,8 +721,7 @@ somaticCalling <- function(matrixOfLogFold) { if (!finalIteration) { do.call(file.remove, list(list.files(paste0(folder_name, sample_name), full.names = TRUE))) } - png(filename = paste0(sample_name, "_clonality.png"), - width = 640, height = 640) + png(filename = paste0(sample_name, "_clonality.png"), type = "cairo", width = 640, height = 640) heatmap((matrixOfClonalityForPlotting), scale="none", Rowv = NA, Colv = NA, col=hmcols, main=sample_name) dev.off()