From afb196b8e758577c0b2c79a2dd17c6d9d50bc069 Mon Sep 17 00:00:00 2001 From: Nicole Kramer Date: Fri, 29 Mar 2024 10:00:16 -0400 Subject: [PATCH] plotManhattan GRanges bug fix --- DESCRIPTION | 4 ++-- NEWS.md | 5 +++++ R/plotManhattan.R | 5 ++--- R/readingFunctions.R | 6 ++++++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3fe0313c..3ea39bde 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: plotgardener Title: Coordinate-Based Genomic Visualization Package for R -Version: 1.8.2 -Date: 2023-12-07 +Version: 1.8.3 +Date: 2024-03-29 Authors@R: c(person("Nicole", "Kramer", email = "nekramer@live.unc.edu", role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index 4f86f599..6798fdf2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# VERSION 1.8.3 +## BUG FIXES + +* `plotManhattan` accommodates `GRanges` data input. + # VERSION 1.8.2 ## BUG FIXES diff --git a/R/plotManhattan.R b/R/plotManhattan.R index b18a70a7..0b09a152 100644 --- a/R/plotManhattan.R +++ b/R/plotManhattan.R @@ -291,13 +291,12 @@ plotManhattan <- function(data, sigVal = 5e-08, chrom = NULL, errorcheck_plotManhattan <- function(bedfile, chrom, chromstart, chromend, object, leadSNP, fill) { - ## check bedfile columns if (!"chrom" %in% colnames(bedfile)) { stop("\'chrom\' column not found in data.", call. = FALSE) } else { - if (!is(bedfile$chrom, "character")) { - stop("\'chrom\' column must be a character.", call. = FALSE) + if (!is(bedfile$chrom, "character") & !is(bedfile$chrom, "factor")) { + stop("\'chrom\' column must be a character or factor.", call. = FALSE) } } diff --git a/R/readingFunctions.R b/R/readingFunctions.R index 14e3d943..60622061 100644 --- a/R/readingFunctions.R +++ b/R/readingFunctions.R @@ -69,6 +69,12 @@ read_rangeData <- function(data, assembly, chrom = NULL, } + } else if (type == "GWAS") { + + ## Rename chrom and position columns + colnames(data)[seq(1, 2)] <- c("chrom", "pos") + ## column data types will be checked in plotManhattan errorchecks + } return(data)