Skip to content

Commit

Permalink
Removed some redudante output messages, reviewed code for unneccessar…
Browse files Browse the repository at this point in the history
…y comments
  • Loading branch information
axelgschwind committed Oct 8, 2018
1 parent 9cfc865 commit b06e4fa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 44 deletions.
19 changes: 3 additions & 16 deletions somatic/firstStep.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -656,9 +644,6 @@ for (sam_no in 1:ncol(matrixOfLogFold)) {
}





if(opt$debug) {
print(found_CNVs)
print(l)
Expand Down Expand Up @@ -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)
}
}
24 changes: 0 additions & 24 deletions somatic/generalHelpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 0 additions & 4 deletions somatic/helpersSomatic.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit b06e4fa

Please sign in to comment.