Skip to content

Commit

Permalink
Merge pull request #146 from croth1/distribution_min_motifs
Browse files Browse the repository at this point in the history
fixes error when plotting motif distributions with too few hits
  • Loading branch information
Christian Roth committed Oct 4, 2019
2 parents 1f9a492 + 7ea6650 commit 4cf1675
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Expand Up @@ -43,6 +43,7 @@ ADD patches /tmp/patches
ADD tools/bamm /tmp/bamm
# apply temporary bamm patches
RUN cd /tmp/bamm && patch -p1 -N -i /tmp/patches/20190819_read_table_quote.patch
RUN cd /tmp/bamm && patch -p1 -N -i /tmp/patches/20191004_motif_distr_minmotif.patch

RUN cd /tmp/bamm && mkdir -p build && cd build && cmake .. && make -j8
RUN cp /tmp/bamm/build/bin/* /ext/bin
Expand Down
22 changes: 22 additions & 0 deletions patches/20191004_motif_distr_minmotif.patch
@@ -0,0 +1,22 @@
diff --git a/R/plotMotifDistribution.R b/R/plotMotifDistribution.R
index 1f2e990..a55e021 100755
--- a/R/plotMotifDistribution.R
+++ b/R/plotMotifDistribution.R
@@ -69,12 +69,11 @@ for( file in Sys.glob(full_glob) ){
filename = file.path(maindir, file_name)
line_number = as.integer(system2("wc", args=c("-l", filename, " | awk '{print $1}'" ), stdout = TRUE))

- if( line_number <= 2 ){
- print("Warning: The input file is empty. Query motif has <3 occurrences in the sequence set.")
- # print out an empty image
-
- picname <- paste(c(file_prefix, motif_id, "_distribution.png"), collapse="")
- picname <- file.path(maindir, picname)
+ if( line_number <= 3 ){
+ print("Warning: The input file is empty. Query motif has <3 occurrences in the sequence set.")
+ # print out an empty image
+ picname <- paste(c(file_prefix, motif_id, "_distribution.png"), collapse="")
+ picname <- file.path(maindir, picname)

png(filename=picname, width=png_width, height=png_height)
par(oma=c(0,0,0,0), mar=c(6,6.5,5,2))

0 comments on commit 4cf1675

Please sign in to comment.