Skip to content

Commit

Permalink
feat: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nahid18 committed Sep 25, 2023
1 parent 8d1a9d4 commit aa2acc5
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 45 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: easylift
Title: An R package to perform genomic liftover
Version: 0.99.5
Version: 0.99.6
Date: 2023-09-25
Authors@R:
c(
Expand All @@ -14,13 +14,13 @@ Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Depends:
GenomicRanges
GenomicRanges,
BiocFileCache
Imports:
rtracklayer,
GenomeInfoDb,
R.utils,
tools,
BiocFileCache
tools
Suggests:
testthat (>= 3.0.0),
IRanges,
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# easylift 0.99.6

* Bug fixes and further improvements to the code.


# easylift 0.99.1

* Updated the code and documentation to reflect the changes suggested by the Bioconductor team.
Expand Down
41 changes: 18 additions & 23 deletions R/easylift.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' will look in the default BiocFileCache for a properly named chain file.
#'
#' @return A GRanges object with lifted genomic coordinates.
#'
#'
#' @examples
#' # Lift over the coordinates of the first 10 genes in the hg19 assembly
#' # to the hg38 assembly
Expand All @@ -21,20 +21,20 @@
#' )
#' genome(gr) <- "hg19"
#'
#' # here, we use the `system.file()` function because the chain file is in the
#' # Here, we use the `system.file()` function because the chain file is in the
#' # package (however if you need to point to any other file on your machine,
#' # just do 'chain <- "path/to/your/file"'):
#' chain <- system.file("extdata/hg19ToHg38.over.chain.gz", package="easylift")
#' # just do 'chain <- "path/to/your/hg19ToHg38.over.chain.gz"'):
#' chain <- system.file("extdata", "hg19ToHg38.over.chain.gz", package = "easylift")
#' easylift(gr, "hg38", chain)
#'
#' # To use `BiocFileCache` for the chain file, you can add it to the cache as follows:
#' # chain_file <- "/path/to/your/hg19ToHg38.over.chain.gz"
#' # bfc <- BiocFileCache()
#' # bfcadd(bfc, chain_file)
#'
#' \dontrun{
#' # To use `BiocFileCache` for the chain file, you can add it to the cache as follows:
#' chain_file <- "/path/to/your/hg19ToHg38.over.chain.gz"
#' bfc <- BiocFileCache()
#' bfcadd(bfc, chain_file)
#' # Then, you can use it in `easylift` like this:
#' # easylift(gr, "hg38")
#'
#' easylift(gr, "hg38")
#' }
#' @import GenomicRanges
#' @import GenomeInfoDb
#' @import rtracklayer
Expand All @@ -54,8 +54,10 @@ easylift <- function(x, to, chain) {
# Check if the input GRanges contains genomic coordinates from multiple genomes
unique_genomes <- unique(GenomeInfoDb::genome(x))
if (length(unique_genomes) > 1) {
stop("The 'GRanges' object 'x' contains genomic coordinates from multiple genomes. ",
"Please provide 'x' with coordinates from a single genome assembly.")
stop(
"The 'GRanges' object 'x' contains genomic coordinates from multiple genomes. ",
"Please provide 'x' with coordinates from a single genome assembly."
)
}

# Convert the input GRanges to the "UCSC" seqlevels style if not already
Expand All @@ -65,20 +67,13 @@ easylift <- function(x, to, chain) {

if (missing(chain)) {
bfc <- BiocFileCache()
capTo <-
paste0(toupper(substr(to, 1, 1)), substr(to, 2, nchar(to))) # capitalize first letter
trychainfile <- paste0(genome(x), "To", capTo, ".over.chain")
capTo <- paste0(toupper(substr(to, 1, 1)), substr(to, 2, nchar(to)))
trychainfile <- paste0(unique_genomes, "To", capTo, ".over.chain")
q <- bfcquery(bfc, trychainfile)
if (nrow(q) >= 1) {
chain <- bfc[[q$rid[1]]]
} else {
stop(
"Chain file not specified and not found in BiocFileCache. Look for a chain file named '",
trychainfile,
"' for liftover to '",
to,
"' in your BiocFileCache or provide the 'chain' argument with the file path."
)
stop(trychainfile, " file not found!")
}
}

Expand Down
6 changes: 3 additions & 3 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ easylift(gr, "hg38")

## Citation

To cite package easylift in publications use:
To cite package `easylift` in publications use:

Al Nahid A, Love M (2023). _easylift: An R package to perform
genomic liftover_. R package version 0.99.5,
genomic liftover_. R package version 0.99.6,
<https://github.com/nahid18/easylift>.


Expand All @@ -82,7 +82,7 @@ A BibTeX entry for LaTeX users is
title = {easylift: An R package to perform genomic liftover},
author = {Abdullah Al Nahid and Michael Love},
year = {2023},
note = {R package version 0.99.5},
note = {R package version 0.99.6},
url = {https://github.com/nahid18/easylift},
}
```
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ easylift(gr, "hg38")

## Citation

To cite package easylift in publications use:
To cite package `easylift` in publications use:

Al Nahid A, Love M (2023). *easylift: An R package to perform genomic
liftover*. R package version 0.99.5,
liftover*. R package version 0.99.6,
<https://github.com/nahid18/easylift>.

A BibTeX entry for LaTeX users is
Expand All @@ -78,7 +78,7 @@ A BibTeX entry for LaTeX users is
title = {easylift: An R package to perform genomic liftover},
author = {Abdullah Al Nahid and Michael Love},
year = {2023},
note = {R package version 0.99.5},
note = {R package version 0.99.6},
url = {https://github.com/nahid18/easylift},
}

Expand Down
18 changes: 9 additions & 9 deletions man/easylift.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vignettes/easylift.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ genome(gr) <- "hg19"
to <- "hg38"
# Here, we use the `system.file()` function because the chain file is in the
# package (however if you need to point to any other file on your machine,
# just do 'chain <- "path/to/your/file"'):
chain <- system.file("extdata/hg19ToHg38.over.chain.gz", package="easylift")
# just do 'chain <- "path/to/your/hg19ToHg38.over.chain.gz"'):
chain <- system.file("extdata", "hg19ToHg38.over.chain.gz", package = "easylift")
gr
```
Expand Down Expand Up @@ -95,7 +95,7 @@ in the BiocFileCache default location.

# Citation

To cite package easylift in publications use:
To cite package `easylift` in publications use:

Al Nahid A, Love M (2023). _easylift: An R package to perform
genomic liftover_. R package version 0.0.4,
Expand Down

0 comments on commit aa2acc5

Please sign in to comment.