From b128196a2cf492a838af5940e926d4f6257f115f Mon Sep 17 00:00:00 2001 From: JannikHamp Date: Thu, 10 Jan 2019 11:04:14 +0100 Subject: [PATCH 1/2] correct maxpos calculation --- bin/1.2_filter_motifs/compareBed_runinfo.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/1.2_filter_motifs/compareBed_runinfo.R b/bin/1.2_filter_motifs/compareBed_runinfo.R index ea6b1a6..04b9f87 100644 --- a/bin/1.2_filter_motifs/compareBed_runinfo.R +++ b/bin/1.2_filter_motifs/compareBed_runinfo.R @@ -8,7 +8,7 @@ # adds a column with a flag "contains_maxpos" # and creates a file with information of the bedtool comparison -# parameters: Parameters are not named. Respect the parameter order. +# parameters: Parameters are not named, respect the parameter order. # min: minimum footprint size threshold # max: maximum footprint size threshold # input_raw: unfiltered BED-file From 5343f6052f151429d2747727a7d2bdbd7ecbf8d0 Mon Sep 17 00:00:00 2001 From: JannikHamp Date: Thu, 10 Jan 2019 12:18:54 +0100 Subject: [PATCH 2/2] fixed for correct contains_maxpos calculation --- bin/1.2_filter_motifs/compareBed_runinfo.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/1.2_filter_motifs/compareBed_runinfo.R b/bin/1.2_filter_motifs/compareBed_runinfo.R index 04b9f87..2723fb5 100644 --- a/bin/1.2_filter_motifs/compareBed_runinfo.R +++ b/bin/1.2_filter_motifs/compareBed_runinfo.R @@ -52,10 +52,10 @@ data_filtered[[7]] <- data_filtered[[3]] - data_filtered[[2]] # adding column "contains_maxpos", containing flag (0 or 1) # max_pos is the position of maximum score of a footprint -data_filtered[[8]] <- data_filtered[[8]] - data_filtered[[2]] +data_filtered[[8]] <- data_filtered[[8]] + data_filtered[[2]] data_filtered <- cbind(data_filtered, contains_maxpos = 0) data_filtered$contains_maxpos[intersect(which(data_filtered[[2]] <= data_filtered[[8]]), which(data_filtered[[3]] > data_filtered[[8]]))] = 1 -data_filtered[[8]] <- data_filtered[[8]] + data_filtered[[2]] +data_filtered[[8]] <- data_filtered[[8]] - data_filtered[[2]] fwrite(data_filtered, output, col.names=FALSE, quote = FALSE, sep = '\t')