Skip to content

Commit 2749821

Browse files
committed
Fix Issue #216, allowing strands to be +/- 1 in plot_genes()
1 parent 942f346 commit 2749821

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@
1515
needed. Also, if sex is missing we assume all individuals are
1616
female; previously we assumed they were male. (Issue #214)
1717

18+
- In `plot_genes()`, allow strand to be +/- 1 and not just `"+"` or
19+
`"-"`. (Issue #216)
20+
1821
### Bug fixes
1922

2023
- In `plot_genes()` there was a case where `stop` was used that should
2124
have been `end`.
2225

2326

27+
2428
## qtl2 0.30 (2022-12-02)
2529

2630
### Major changes

R/plot_genes.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#' @param start_field Character string with name of column containing the genes' start positions.
1414
#' @param stop_field Character string with name of column containing the genes' stop positions.
1515
#' @param strand_field Character string with name of column containing the genes' strands.
16+
#' (The values of the corresponding field can be character strings `"+"` or `"-"`, or numeric +1 or -1.)
1617
#' @param name_field Character string with name of column containing the genes' names.
1718
#' @param ... Optional arguments passed to `plot()`.
1819
#'
@@ -82,6 +83,10 @@ plot_genes <-
8283
strand <- as.character(genes[,strand_field])
8384
name <- as.character(genes[,name_field])
8485

86+
# deal with +/- 1 for strand
87+
strand[!is.na(strand) & (strand=="1" | strand=="+1")] <- "+"
88+
strand[!is.na(strand) & strand=="-1"] <- "-"
89+
8590
plot_genes_internal <-
8691
function(xlab=NULL, xaxs="i",
8792
bgcolor="gray92", xat=NULL,

man/plot_genes.Rd

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)