Skip to content

Commit

Permalink
Merge pull request #53 from loosolab/JannikHamp-patch-2
Browse files Browse the repository at this point in the history
correct maxpos calculation
  • Loading branch information
renewiegandt authored Jan 10, 2019
2 parents 881b445 + 5343f60 commit 438e806
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/1.2_filter_motifs/compareBed_runinfo.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')

Expand Down

0 comments on commit 438e806

Please sign in to comment.