From 6d62d0e011a6f467ce6726df5b0c33f35515b019 Mon Sep 17 00:00:00 2001 From: chabrault <37081971+chabrault@users.noreply.github.com> Date: Thu, 30 Apr 2020 11:27:25 +0200 Subject: [PATCH 1/7] Add border L524 in qtldf --- R/drawone.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/drawone.R b/R/drawone.R index 6b98d38..263bcfe 100644 --- a/R/drawone.R +++ b/R/drawone.R @@ -521,7 +521,7 @@ drawone <- x2[1] + posmult * (qtlxpos + strwidth("M") + lgwpct / 3), qtldf$ei[ql], col = qtldf$col[ql], - border = qtldf$col[ql] + border = qtldf$border[ql] ) text( x2[1] + posmult * (qtlxpos + strwidth("MM") + lgwpct / 3), From cdc4f7f174f0ccde46a8eb7aec223cbb0b44c6d7 Mon Sep 17 00:00:00 2001 From: chabrault <37081971+chabrault@users.noreply.github.com> Date: Thu, 30 Apr 2020 11:43:02 +0200 Subject: [PATCH 2/7] add hatch option --- R/drawone.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R/drawone.R b/R/drawone.R index 263bcfe..769d419 100644 --- a/R/drawone.R +++ b/R/drawone.R @@ -515,12 +515,16 @@ drawone <- ) # make inner region 1/3 size of linkage group width # 1/3 is arbitrary, just looks good + add.hatch <- ifelse(all(is.logical(qtldf$border)), TRUE, FALSE) + if(is.null(qtldf$border)) + qtldf$border <- qtldf$col rect( x2[1] + posmult * (qtlxpos + strwidth("M")), qtldf$si[ql], x2[1] + posmult * (qtlxpos + strwidth("M") + lgwpct / 3), qtldf$ei[ql], col = qtldf$col[ql], + density = ifelse(add.hatch,1,0), # add hatch if border is logical border = qtldf$border[ql] ) text( From e802afbdd1b56b285aba09cb9577eacf7b619cf4 Mon Sep 17 00:00:00 2001 From: chabrault <37081971+chabrault@users.noreply.github.com> Date: Thu, 30 Apr 2020 11:51:58 +0200 Subject: [PATCH 3/7] Correct hatch with density parameter --- R/drawone.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/drawone.R b/R/drawone.R index 769d419..61a0206 100644 --- a/R/drawone.R +++ b/R/drawone.R @@ -515,7 +515,9 @@ drawone <- ) # make inner region 1/3 size of linkage group width # 1/3 is arbitrary, just looks good - add.hatch <- ifelse(all(is.logical(qtldf$border)), TRUE, FALSE) + hatch <- 0 + if(!is.null(qtldf$hatch)) + hatch <- ifelse(qtldf$hatch, 30, 0) # if hatch is TRUE, set density to 30 if(is.null(qtldf$border)) qtldf$border <- qtldf$col rect( @@ -524,7 +526,7 @@ drawone <- x2[1] + posmult * (qtlxpos + strwidth("M") + lgwpct / 3), qtldf$ei[ql], col = qtldf$col[ql], - density = ifelse(add.hatch,1,0), # add hatch if border is logical + density =hatch, border = qtldf$border[ql] ) text( From f4baa2cc6058a106a2e321f6bc3152fae17319d1 Mon Sep 17 00:00:00 2001 From: chabrault <37081971+chabrault@users.noreply.github.com> Date: Thu, 30 Apr 2020 11:56:02 +0200 Subject: [PATCH 4/7] Fix error --- R/drawone.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/drawone.R b/R/drawone.R index 61a0206..5cac90b 100644 --- a/R/drawone.R +++ b/R/drawone.R @@ -526,7 +526,7 @@ drawone <- x2[1] + posmult * (qtlxpos + strwidth("M") + lgwpct / 3), qtldf$ei[ql], col = qtldf$col[ql], - density =hatch, + density = hatch[ql], border = qtldf$border[ql] ) text( From a07727a8220c6feb44cedcf6f52810c62166c3a3 Mon Sep 17 00:00:00 2001 From: chabrault <37081971+chabrault@users.noreply.github.com> Date: Thu, 30 Apr 2020 12:02:37 +0200 Subject: [PATCH 5/7] Fix error --- R/drawone.R | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/R/drawone.R b/R/drawone.R index 5cac90b..575c327 100644 --- a/R/drawone.R +++ b/R/drawone.R @@ -456,6 +456,13 @@ drawone <- # determine x position of qtl if (nrow(qtldf) > 0) { + hatch <- 0 + if(!is.null(qtldf$hatch)) + hatch <- ifelse(qtldf$hatch, 30, 0) # if hatch is TRUE, set density to 30 + write(hatch, stderr()) + if(is.null(qtldf$border)) + qtldf$border <- NA + write(qtldf$border, stderr()) for (ql in 1:nrow(qtldf)) { # if there are labels on y axis where qtl needs to be drawn # first decide if QTL line (so to eo) or text label is longest @@ -515,11 +522,6 @@ drawone <- ) # make inner region 1/3 size of linkage group width # 1/3 is arbitrary, just looks good - hatch <- 0 - if(!is.null(qtldf$hatch)) - hatch <- ifelse(qtldf$hatch, 30, 0) # if hatch is TRUE, set density to 30 - if(is.null(qtldf$border)) - qtldf$border <- qtldf$col rect( x2[1] + posmult * (qtlxpos + strwidth("M")), qtldf$si[ql], From 5eebb37a62621e396715e8686b053b83280fbb14 Mon Sep 17 00:00:00 2001 From: chabrault <37081971+chabrault@users.noreply.github.com> Date: Thu, 30 Apr 2020 15:26:55 +0200 Subject: [PATCH 6/7] Remove write --- R/drawone.R | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/R/drawone.R b/R/drawone.R index 575c327..89dc130 100644 --- a/R/drawone.R +++ b/R/drawone.R @@ -458,11 +458,9 @@ drawone <- if (nrow(qtldf) > 0) { hatch <- 0 if(!is.null(qtldf$hatch)) - hatch <- ifelse(qtldf$hatch, 30, 0) # if hatch is TRUE, set density to 30 - write(hatch, stderr()) + hatch <- ifelse(qtldf$hatch, 30, NA) # if hatch is TRUE, set density to 30 if(is.null(qtldf$border)) qtldf$border <- NA - write(qtldf$border, stderr()) for (ql in 1:nrow(qtldf)) { # if there are labels on y axis where qtl needs to be drawn # first decide if QTL line (so to eo) or text label is longest From 3981fbbc63b20be2ac71196e1519efee1658a5c6 Mon Sep 17 00:00:00 2001 From: chabrault <37081971+chabrault@users.noreply.github.com> Date: Thu, 30 Apr 2020 16:16:33 +0200 Subject: [PATCH 7/7] Update parameters in qtldf --- R/lmv.linkage.plot.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/lmv.linkage.plot.R b/R/lmv.linkage.plot.R index 14ed24f..3af6974 100644 --- a/R/lmv.linkage.plot.R +++ b/R/lmv.linkage.plot.R @@ -186,6 +186,8 @@ #' \item ei End of inner interval. Numeric. #' \item eo End of outer interval. Numeric. #' \item col Color for QTL. +#' \item border Color of QTL rectangle border (optionnal) +#' \item hatch Hatch or not QTL rectangle (optionnal). Logical. #' } #' #' @param qtlscanone Optional scanone data frame from package r/qtl. If provided,