From b06e4faaa447cc9a67d490e5bd105572fd229d41 Mon Sep 17 00:00:00 2001 From: Axel Gschwind Date: Mon, 8 Oct 2018 13:41:06 +0200 Subject: [PATCH] Removed some redudante output messages, reviewed code for unneccessary comments --- somatic/firstStep.R | 19 +++---------------- somatic/generalHelpers.R | 24 ------------------------ somatic/helpersSomatic.R | 4 ---- 3 files changed, 3 insertions(+), 44 deletions(-) diff --git a/somatic/firstStep.R b/somatic/firstStep.R index 728ae4c..9a549f7 100644 --- a/somatic/firstStep.R +++ b/somatic/firstStep.R @@ -64,18 +64,6 @@ option_list = list( opt_parser = OptionParser(option_list=option_list); opt = parse_args(opt_parser); -### TESTING PART -# opt$bed = "/Users/gdemidov/Tuebingen/somatic_CNVs/Somatic/ssSC_v2.annotated.bed" -# opt$tumor = "/Users/gdemidov/Tuebingen/somatic_CNVs/Somatic/tumor2.cov" -# opt$normal = "/Users/gdemidov/Tuebingen/somatic_CNVs/Somatic/normal2.cov" -# opt$colNum = 4 -# opt$pair = "/Users/gdemidov/Tuebingen/somatic_CNVs/Somatic/pairs.txt" -# opt$out = "/Users/gdemidov/Tuebingen/clinCNV_dev/results" -# opt$folderWithScript = "/Users/gdemidov/Tuebingen/clinCNV_dev/ClinCNV/somatic" -# opt$reanalyseCohort = F -# opt$bedOfftarget = "/Users/gdemidov/Tuebingen/somatic_CNVs/Somatic/offtaget_annotated_ssSC_v2_2015_01_26.bed" -# opt$tumorOfftarget = "/Users/gdemidov/Tuebingen/somatic_CNVs/Somatic/offtarget2.txt" -# opt$normalOfftarget = "/Users/gdemidov/Tuebingen/somatic_CNVs/Somatic/offtarget2.txt" ### PLOTTING OF PICTURES (DOES NOT REALLY NECESSARY IF YOU HAVE IGV SEGMENTS) plottingOfPNGs = F @@ -656,9 +644,6 @@ for (sam_no in 1:ncol(matrixOfLogFold)) { } - - - if(opt$debug) { print(found_CNVs) print(l) @@ -711,7 +696,9 @@ for (sam_no in 1:ncol(matrixOfLogFold)) { fileConn<-file(fileToOut) writeLines(c(paste("##"," QC ", 0, collapse = " ")), fileConn) close(fileConn) - print(found_CNVs_total) + if(opt$debug) { + print(found_CNVs_total) + } write.table(found_CNVs_total, file = fileToOut, quote=F, row.names = F, sep="\t", append = T) } } diff --git a/somatic/generalHelpers.R b/somatic/generalHelpers.R index 0218e97..f663afb 100644 --- a/somatic/generalHelpers.R +++ b/somatic/generalHelpers.R @@ -264,29 +264,6 @@ find_all_CNVs <- function(minimum_length_of_CNV, threshold, price_per_tile, init matrix_of_likeliks[k,] = 0 } - # if (found_CNV[4] >= 2 & found_CNV[4] <= 4) { - # for (k in found_CNV[2]:found_CNV[3]) { - # matrix_of_likeliks[k,found_CNV[4]] = matrix_of_likeliks[k,current_region_to_look_for_CNVs[4]] - # } - # } else { - # if (found_CNV[4] == 1) { - # # replace borders as they are heterozygous deletions - # matrix_of_likeliks[max((found_CNV[2] - 1), start), 1] = matrix_of_likeliks[max((found_CNV[2] - 1), start), 2] - # matrix_of_likeliks[min((found_CNV[3] + 1), end), 1] = matrix_of_likeliks[min((found_CNV[3] + 1), end), 2] - # } - # if (found_CNV[4] > 4) { - # # replace borders as they are heterozygous duplications - # matrix_of_likeliks[max((found_CNV[2] - 1), start), found_CNV[4]] = matrix_of_likeliks[max((found_CNV[2] - 1), start), 4] - # matrix_of_likeliks[min((found_CNV[3] + 1), end), found_CNV[4]] = matrix_of_likeliks[min((found_CNV[3] + 1), end), 4] - # } - # found_CNV_with_changed = find_one_CNV(start, end, current_region_to_look_for_CNVs[4], threshold, matrix_of_likeliks, minimum_length_of_CNV) - # if (found_CNV_with_changed[3] == found_CNV[3] & found_CNV_with_changed[2] == found_CNV[2]) { - # # evaluate_segment_further = F - # for (k in max((found_CNV[2] - 1), start):min((found_CNV[3] + 1), end)) { - # matrix_of_likeliks[k,found_CNV[4]] = matrix_of_likeliks[k,current_region_to_look_for_CNVs[4]] - # } - # } - # } matrix_for_calculations <- -matrix_of_likeliks[start:end,] + matrix_of_likeliks[start:end, initial_state] if (!is.null(nrow(matrix_for_calculations))) { matrix_for_calculations <- apply(matrix_for_calculations, 2, sum) @@ -350,7 +327,6 @@ outputSegmentsAndDotsFromListOfCNVs <- function(toyBedFile, foundCNVs, startOfCh ### MAKE ANNOTATION TO TRACK FILES makeTrackAnnotation <- function(fileName) { if (!file.exists(fileName)) { - print("WE CREATE FILE") file.create(fileName) fileConn<-file(fileName) writeLines(c("#type=GENE_EXPRESSION", diff --git a/somatic/helpersSomatic.R b/somatic/helpersSomatic.R index 0e4f5ad..03cdccd 100644 --- a/somatic/helpersSomatic.R +++ b/somatic/helpersSomatic.R @@ -24,10 +24,6 @@ determineSDsOfSomaticSample <- function(x) { else { for (i in 2:length(bordersOfChroms)) { valuesBetweenBorders <- x[bordersOfChroms[i-1]:bordersOfChroms[i]] - #valuesBetweenDelAndDup <- which(valuesBetweenBorders > -1 & valuesBetweenBorders < log2(3/2)) - #if (length(valuesBetweenDelAndDup) > 0.5 * length(valuesBetweenBorders)) { - # valuesBetweenBorders <- valuesBetweenBorders[valuesBetweenDelAndDup] - # } sdsS[i] = Sn(valuesBetweenBorders) } }