Skip to content

Commit

Permalink
Fix examples, vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
jwokaty committed Jul 10, 2024
1 parent cd864f9 commit b045555
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
BEDbaseR.Rproj
.swp
.httr-oauth
/doc/
/Meta/
16 changes: 7 additions & 9 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,11 @@
#' client <- BEDbase()
#' ex_bed <- bb_example(client, "bed")
#' md <- bb_metadata(client, ex_bed$id, "bed", TRUE)
#' file_path <- .get_file_path(md$files$bed_file$access_methods[[1]]$access_url$url,
#' "bed")
#' .bed_file_to_granges(file_path, bed_type, bed_format)
#' file_path <- .get_file(md, "bed", "http")
#' .bed_file_to_granges(file_path, md)
.bed_file_to_granges <- function(file_path, metadata, extra_cols = NULL,
quietly = FALSE) {
bed_format <- metadata$bed_format
bed_type <- metadata$bed_type
nums <- str_replace(bed_type, "bed", "") |>
str_split_1("\\+") |>
as.double()
Expand All @@ -124,14 +122,14 @@
"`bed_type` or be a vector length zero."))
}

if (bed_type == "bed12+3") {
if (metadata$bed_type == "bed12+3") {
bed_format <- "gappedPeak"
extra_cols <- c(signalValue = "numeric", pValue = "numeric",
qValue = "numeric")
} else if ((bed_format == "broadpeak" && bed_type == "bed6+3") ||
(bed_format == "narrowpeak" && bed_type == "bed6+4")) {
} else if ((bed_format == "broadpeak" && metadata$bed_type == "bed6+3") ||
(bed_format == "narrowpeak" && metadata$bed_type == "bed6+4")) {
bed_format <- gsub("peak", "Peak", bed_format)
} else if (bed_format != "broadpeak" && bed_type == "bed6+3") {
} else if (bed_format != "broadpeak" && metadata$bed_type == "bed6+3") {
bed_format <- "RNA elements"
extra_cols <- c(level = "character", signif = "character",
score2 = "numeric")
Expand All @@ -154,7 +152,7 @@
} else if (!is.null(metadata$genome_alias)) {
tryCatch({
if (!quietly) {
inform(paste("Attempting to pass `genome =",
inform(paste0("Attempting to pass `genome =",
metadata$genome_alias, "` when importing."))
}
import(file_path, format = "bed", extraCols = extra_cols,
Expand Down
4 changes: 2 additions & 2 deletions vignettes/bedbaser.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ metadata <- bb_metadata(client, example_bed$id, "bed")
Use `bb_beds_in_bedset()` to display the record identifiers of BEDs in a
BEDset.

```{r bb_beds_in_bedset, eval=FALSE}
```{r bb_beds_in_bedset}
# Need to fix
bb_beds_in_bedset(client, "excluderanges")
```
Expand All @@ -95,7 +95,7 @@ bb_beds_in_bedset(client, "excluderanges")
Search for BED files by keywords. `bb_bed_text_search()` returns all BED files
scored against a query.

```{r bb_search, eval=FALSE}
```{r bb_search}
bb_bed_text_search(client, "hg13", limit = 10)
```

Expand Down

0 comments on commit b045555

Please sign in to comment.