Skip to content

Commit

Permalink
Fix indent
Browse files Browse the repository at this point in the history
  • Loading branch information
jwokaty committed Aug 26, 2024
1 parent 09d609c commit 4852078
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
15 changes: 9 additions & 6 deletions R/bedbaser.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ BEDbase <- function() {
}

#' Display API
#'
#'
#' @param x BEDbase object
#' @param ... other options
#' @param .deprecated (default FALSE) if deprecated
Expand All @@ -76,7 +76,8 @@ setMethod(
"operations", "BEDbase",
function(x, ..., .deprecated = FALSE) {
callNextMethod(x, ..., .deprecated = .deprecated)
})
}
)

#' Get the example BED file or BEDset with metadata
#'
Expand Down Expand Up @@ -172,8 +173,9 @@ bb_metadata <- function(api, id, full = FALSE) {
#' bb_list_beds(api)
#'
#' @export
bb_list_beds <- function(api, genome = NULL, bed_type = NULL, limit = 1000,
offset = 0) {
bb_list_beds <- function(
api, genome = NULL, bed_type = NULL, limit = 1000,
offset = 0) {
rsp <- api$list_beds_v1_bed_list_get(
genome = genome, bed_type = bed_type,
limit = limit, offset = offset
Expand Down Expand Up @@ -323,8 +325,9 @@ bb_bed_text_search <- function(api, query, limit = 10, offset = 0) {
#' bb_to_granges(api, ex_bed$id)
#'
#' @export
bb_to_granges <- function(api, bed_id, file_type = "bed", extra_cols = NULL,
quietly = TRUE) {
bb_to_granges <- function(
api, bed_id, file_type = "bed", extra_cols = NULL,
quietly = TRUE) {
stopifnot(file_type %in% c("bed", "bigbed"))
metadata <- bb_metadata(api, bed_id, TRUE)
file_path <- .get_file(metadata, file_type, "http", quietly)
Expand Down
16 changes: 9 additions & 7 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
#' .get_file(md, "bed", "http")
#'
#' @noRd
.get_file <- function(metadata, file_type = c("bed", "bigbed"),
access_type = c("s3", "http"), quietly = TRUE) {
.get_file <- function(
metadata, file_type = c("bed", "bigbed"),
access_type = c("s3", "http"), quietly = TRUE) {
file_details <- .format_metadata_files(metadata$files) |>
filter(
name == paste(file_type, "file", sep = "_"),
Expand Down Expand Up @@ -121,8 +122,9 @@
#' .bed_file_to_granges(file_path, md)
#'
#' @noRd
.bed_file_to_granges <- function(file_path, metadata, extra_cols = NULL,
quietly = TRUE) {
.bed_file_to_granges <- function(
file_path, metadata, extra_cols = NULL,
quietly = TRUE) {
bed_format <- gsub("peak", "Peak", metadata$bed_format)
nums <- str_replace(metadata$bed_type, "bed", "") |>
str_split_1("\\+") |>
Expand All @@ -140,9 +142,9 @@
extra_cols <- .get_extra_cols(file_path, nums[1], nums[2])
}
import(file_path,
format = "bed",
extraCols = extra_cols,
genome = metadata$genome_alias
format = "bed",
extraCols = extra_cols,
genome = metadata$genome_alias
)
} else {
import(file_path, format = bed_format, genome = metadata$genome_alias)
Expand Down
6 changes: 4 additions & 2 deletions tests/testthat/test-bedbaser.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ test_that("bb_to_granges returns a GRanges object given a bigBed file", {
gro <- bb_to_granges(api, ex_bed$id, "bigbed")
expect_equal("GRanges", class(gro)[1])
} else {
expect_warning(rlang::warn("This feature does not work on Windows."),
bb_to_granges(api, ex_bed$id, "bigbed"))
expect_warning(
rlang::warn("This feature does not work on Windows."),
bb_to_granges(api, ex_bed$id, "bigbed")
)
}
})

Expand Down
6 changes: 4 additions & 2 deletions vignettes/bedbaser.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,10 @@ Download the
[chain file](https://hgdownload.cse.ucsc.edu/downloads.html#liftover) from UCSC.

```{r convertCoordinates_getTheChain, message=FALSE}
chain_url <- paste0("https://hgdownload.cse.ucsc.edu/goldenPath/mm10/liftOver/",
"mm10ToMm39.over.chain.gz")
chain_url <- paste0(
"https://hgdownload.cse.ucsc.edu/goldenPath/mm10/liftOver/",
"mm10ToMm39.over.chain.gz"
)
tmpdir <- tempdir()
gz <- file.path(tmpdir, "mm10ToMm39.over.chain.gz")
download.file(chain_url, gz)
Expand Down

0 comments on commit 4852078

Please sign in to comment.