Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: regutools
Title: regutools: an R package for data extraction from RegulonDB
Version: 1.23.0
Date: 2021-11-15
Date: 2026-04-01
Authors@R: c(
person ("Joselyn", "Chavez", email = "joselynchavezf@gmail.com",
role = c("aut", "cre"), comment = c(ORCID = "0000-0002-4974-4591")),
Expand Down Expand Up @@ -35,7 +35,7 @@ Description: RegulonDB has collected, harmonized and centralized data
to further our understanding of gene regulatory networks.
License: Artistic-2.0
Encoding: UTF-8
Depends: R (>= 4.0)
Depends: R (>= 4.5.0)
Imports:
AnnotationDbi,
AnnotationHub,
Expand All @@ -51,8 +51,8 @@ Imports:
stats,
utils,
BiocFileCache
LazyData: true
RoxygenNote: 7.1.1
LazyData: false
RoxygenNote: 7.3.3
Suggests:
BiocStyle,
knitr,
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# regutools 1.23.0

BUG FIXES

* Fixed URL for the database

# regutools 1.3.2

SIGNIFICANT USER-VISIBLE CHANGES
Expand Down
14 changes: 8 additions & 6 deletions R/build_condition.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@
#' @export

build_condition <-
function(regulondb,
dataset,
filters,
operator,
interval,
partialmatch) {
function(
regulondb,
dataset,
filters,
operator,
interval,
partialmatch
) {
if (is(filters, "list")) {
if (!all(names(filters) %in% list_attributes(regulondb, dataset))) {
non.existing.attrs.index <-
Expand Down
12 changes: 4 additions & 8 deletions R/connect_database.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
#' regulondb_conn_noAH <- connect_database(ah = NULL)
connect_database <-
function(
ah = AnnotationHub::AnnotationHub(),
bfc = BiocFileCache::BiocFileCache()) {
ah = AnnotationHub::AnnotationHub(),
bfc = BiocFileCache::BiocFileCache()
) {
if (!is.null(ah)) {
## Check input
stopifnot(methods::is(ah, "AnnotationHub"))
Expand All @@ -50,13 +51,8 @@ connect_database <-
}
}


## Otherwise, use the Dropbox version and cache it with BiocFileCache
url <-
paste0(
"https://www.dropbox.com/s/ufp6wqcv5211v1w/",
"regulondb_v10.8_sqlite.db?dl=1"
)
url <- "https://github.com/ComunidadBioInfo/regutoolsData/raw/refs/heads/main/regulondb_v10.8_sqlite.db"
destfile <- BiocFileCache::bfcrpath(bfc, url)
AnnotationDbi::dbFileConnect(destfile)
}
8 changes: 5 additions & 3 deletions R/get_binding_sites.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
#' ## Get the binding sites for AraC
#' get_binding_sites(e_coli_regulondb, transcription_factor = "AraC")
#' @export
get_binding_sites <- function(regulondb, transcription_factor,
output_format = "GRanges") {
get_binding_sites <- function(
regulondb, transcription_factor,
output_format = "GRanges"
) {
## For a BiocCheck NOTE
left <- right <- NULL
if (!output_format %in% c("GRanges", "Biostrings")) {
Expand All @@ -49,7 +51,7 @@ get_binding_sites <- function(regulondb, transcription_factor,
)
tfbs_table <- strsplit(
as.character(tfbs_table$res),
split = "\t"
split = "\t"
)
tfbs_table <- as.data.frame(do.call(rbind, tfbs_table))
colnames(tfbs_table) <-
Expand Down
40 changes: 21 additions & 19 deletions R/get_dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,16 @@
#' @importFrom S4Vectors DataFrame
#' @importFrom Biostrings DNAStringSet BStringSet
get_dataset <-
function(regulondb,
dataset = NULL,
attributes = NULL,
filters = NULL,
and = TRUE,
interval = NULL,
partialmatch = NULL,
output_format = "regulondb_result") {
function(
regulondb,
dataset = NULL,
attributes = NULL,
filters = NULL,
and = TRUE,
interval = NULL,
partialmatch = NULL,
output_format = "regulondb_result"
) {
# Check if format specification is valid
if (!output_format %in% c(
"regulondb_result",
Expand Down Expand Up @@ -244,8 +246,8 @@ get_dataset <-
#' convert_to_granges(get_dataset(e_coli_regulondb, dataset = "GENE"))
convert_to_granges <- function(regulondb_result) {
if (!is(regulondb_result, "regulondb_result")) {
stop("The input is not a 'regulondb_result' object.")
}
stop("The input is not a 'regulondb_result' object.")
}
dataset <- regulondb_result@dataset
if (dataset %in% c("GENE", "DNA_OBJECTS")) {
posLeft <- "posleft"
Expand Down Expand Up @@ -292,11 +294,11 @@ convert_to_granges <- function(regulondb_result) {
DataFrame(regulondb_result[keep, !colnames(regulondb_result) %in%
c(posLeft, posRight, "strand"), drop = FALSE])
if (sum(!keep) > 0) {
warning(sprintf(
"Dropped %s entries where genomic coordinates were NAs",
sum(!keep)
))
}
warning(sprintf(
"Dropped %s entries where genomic coordinates were NAs",
sum(!keep)
))
}
grdata
} else {
stop(
Expand Down Expand Up @@ -349,11 +351,11 @@ convert_to_granges <- function(regulondb_result) {
convert_to_biostrings <-
function(regulondb_result, seq_type = "DNA") {
if (!is(regulondb_result, "regulondb_result")) {
stop("The input is not a 'regulondb_result' object.")
}
stop("The input is not a 'regulondb_result' object.")
}
if (!seq_type %in% c("DNA", "product")) {
stop("'seq_type' must be either 'DNA' or 'product'")
}
stop("'seq_type' must be either 'DNA' or 'product'")
}
dataset <- regulondb_result@dataset
if (dataset == "GENE") {
if (seq_type == "DNA") {
Expand Down
14 changes: 8 additions & 6 deletions R/get_dna_objects.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#' @examples
#' ## Connect to the RegulonDB database if necessary
#' if (!exists("regulondb_conn")) {
#' regulondb_conn <- connect_database()
#' }
#' regulondb_conn <- connect_database()
#' }
#'
#' ## Build the regulondb object
#' e_coli_regulondb <-
Expand Down Expand Up @@ -45,10 +45,12 @@
#' )
#' @export
get_dna_objects <-
function(regulondb,
genome = "eschColi_K12",
grange = GRanges("chr", IRanges(1, 5000)),
elements = "gene") {
function(
regulondb,
genome = "eschColi_K12",
grange = GRanges("chr", IRanges(1, 5000)),
elements = "gene"
) {
valid_elements <- c(
"-10 promoter box",
"-35 promoter box",
Expand Down
10 changes: 6 additions & 4 deletions R/get_gene_regulators.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@
#' @export

get_gene_regulators <-
function(regulondb,
genes,
format = "multirow",
output.type = "TF") {
function(
regulondb,
genes,
format = "multirow",
output.type = "TF"
) {
stopifnot(validObject(regulondb))
# Check genes parameter class
## if (!class(genes) %in% c("vector", "list", "character")) {
Expand Down
10 changes: 6 additions & 4 deletions R/get_gene_synonyms.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@
#' @export

get_gene_synonyms <-
function(regulondb,
genes,
from = "name",
to = c("id", "name", "bnumber", "gi")) {
function(
regulondb,
genes,
from = "name",
to = c("id", "name", "bnumber", "gi")
) {
# Function checks
stopifnot(validObject(regulondb))

Expand Down
10 changes: 6 additions & 4 deletions R/get_regulatory_network.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@
#' setEdgeColorMapping setVisualStyle

get_regulatory_network <-
function(regulondb,
regulator = NULL,
type = "TF-GENE",
cytograph = FALSE) {
function(
regulondb,
regulator = NULL,
type = "TF-GENE",
cytograph = FALSE
) {
# Check type parameter
if (!type %in% c("GENE-GENE", "TF-GENE", "TF-TF")) {
stop("Parameter 'type' must be TF-GENE, TF-TF, or GENE-GENE.",
Expand Down
4 changes: 2 additions & 2 deletions R/list_attributes.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

list_attributes <- function(regulondb, dataset) {
if (missing(dataset)) {
stop("Parameter 'dataset' is missing, please specify\n")
}
stop("Parameter 'dataset' is missing, please specify\n")
}
stopifnot(validObject(regulondb))
dbListFields(regulondb, dataset)
}
14 changes: 8 additions & 6 deletions R/plot_dna_objects.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#' @examples
#' ## Connect to the RegulonDB database if necessary
#' if (!exists("regulondb_conn")) {
#' regulondb_conn <- connect_database()
#' }
#' regulondb_conn <- connect_database()
#' }
#'
#' ## Build the regulondb object
#' e_coli_regulondb <-
Expand Down Expand Up @@ -47,10 +47,12 @@
#' )
#' @export
plot_dna_objects <-
function(regulondb,
genome = "eschColi_K12",
grange = GRanges("chr", IRanges(1, 5000)),
elements = "gene") {
function(
regulondb,
genome = "eschColi_K12",
grange = GRanges("chr", IRanges(1, 5000)),
elements = "gene"
) {
valid_elements <- c(
"-10 promoter box",
"-35 promoter box",
Expand Down
10 changes: 6 additions & 4 deletions R/regulondb-classes.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ setValidity("regulondb", function(object) {
#' )
#' @export
regulondb <-
function(database_conn,
organism,
genome_version,
database_version) {
function(
database_conn,
organism,
genome_version,
database_version
) {
stopifnot(is(database_conn, "SQLiteConnection"))
stopifnot(is(organism, "character"))
stopifnot(is(genome_version, "character"))
Expand Down
8 changes: 4 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ You can install the released version of `regutools` from [Bioconductor](http://b

```{r 'install release', eval = FALSE}
if (!requireNamespace("BiocManager", quietly = TRUE)) {
install.packages("BiocManager")
}
install.packages("BiocManager")
}

BiocManager::install("regutools")

Expand Down Expand Up @@ -95,8 +95,8 @@ Get the latest stable `R` release from [CRAN](http://cran.r-project.org/). Then

```{r 'install', eval = FALSE}
if (!requireNamespace("BiocManager", quietly = TRUE)) {
install.packages("BiocManager")
}
install.packages("BiocManager")
}

BiocManager::install("regutools")
```
Expand Down
4 changes: 2 additions & 2 deletions man/get_dna_objects.Rd

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

4 changes: 2 additions & 2 deletions man/plot_dna_objects.Rd

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

17 changes: 2 additions & 15 deletions man/regutools-package.Rd

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

4 changes: 2 additions & 2 deletions tests/testthat/test-build_condition.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ context("build_condition")
test_that("Test that the logical conditions its made as expected", {
## Connect to the RegulonDB database if necessary
if (!exists("regulondb_conn")) {
regulondb_conn <- connect_database()
}
regulondb_conn <- connect_database()
}

## Build a regulondb object
regdb <-
Expand Down
Loading
Loading