Skip to content

Commit

Permalink
Fixed bug GWASpoly chromosome ordering with limits
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviaAB committed Aug 4, 2024
1 parent ef42717 commit f14d30e
Show file tree
Hide file tree
Showing 4 changed files with 757 additions and 384 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ URL: https://plantandfoodresearch.github.io/hidecan/, https://github.com/Plantan
BugReports: https://github.com/PlantandFoodResearch/hidecan/issues
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
Depends:
R (>= 2.10)
Imports:
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

* Added the `manhattan_plot()` function to generate Manhattan plots from a table of GWAS results.

* Fixed bug where specifying chromosome limits for `hidecan_plot_from_gwaspoly()` would mess up the ordering of the chromosomes in the plot.

# hidecan 1.1.0

* Removed `get_gwaspoly_example_data()` function so that the package doesn't depend on GWASpoly (for CRAN submission)
Expand Down
7 changes: 4 additions & 3 deletions R/create_hidecan_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ create_hidecan_plot <- function(x,
## Now filter both toplot and chrom_lenght to only the desired chromosomes
toplot <- toplot |>
dplyr::filter(chromosome %in% chroms) |>
dplyr::mutate(chromosome = factor(chromosome, levels = chroms))
dplyr::mutate(chromosome = factor(chromosome, levels = chroms, ordered = FALSE))

chrom_length <- chrom_length |>
dplyr::filter(chromosome %in% chroms) |>
dplyr::mutate(chromosome = factor(chromosome, levels = chroms))
dplyr::mutate(chromosome = factor(chromosome, levels = chroms, ordered = FALSE))

toplot_chroms <- chrom_length |>
dplyr::mutate(position_mb = length / 1e6) |>
Expand Down Expand Up @@ -231,7 +231,8 @@ create_hidecan_plot <- function(x,
~ tibble::tibble(lower_limit_mb = .x[[1]],
upper_limit_mb = .x[[2]]),
.id = "chromosome"
),
) |>
dplyr::mutate(chromosome = factor(chromosome, levels = chroms)),
by = "chromosome"
) |>
tidyr::replace_na(list(lower_limit_mb = 0)) |>
Expand Down
Loading

0 comments on commit f14d30e

Please sign in to comment.