Skip to content

Commit

Permalink
Merge pull request #3 from Novartis/devel
Browse files Browse the repository at this point in the history
Merge pull request #2 from Novartis/main
  • Loading branch information
MarkusMuck authored Feb 17, 2025
2 parents 83a917d + f5aaf9d commit ba80246
Show file tree
Hide file tree
Showing 64 changed files with 1,404 additions and 1,714 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
^\.Rproj\.user$
^LICENSE\.md$
^data-raw$
.github$
combpeaksr.Rproj
LICENSE.txt
39 changes: 27 additions & 12 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ jobs:
matrix:
config:
- { os: windows-latest, bioc: 'devel', deploy: 'no'}
- { os: macOS-12, bioc: 'devel', deploy: 'yes'}
- { os: macOS-latest, bioc: 'devel', deploy: 'yes'}
# - { os: ubuntu-latest, r: 'devel', image: 'bioconductor/bioconductor_docker:devel', deploy: 'no'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
CRAN: ${{ matrix.config.cran }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
cache-version: v2
cache-version: v3

steps:
- name: checkout branch
- name: Checkout code
uses: actions/checkout@v3

- name: Set up R and install BiocManager
uses: grimbough/bioc-actions/setup-bioc@v1
if: matrix.config.image == null
Expand All @@ -55,7 +55,7 @@ jobs:

- name: Cache R packages
if: runner.os != 'Windows' && matrix.config.image == null
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ env.cache-version }}-${{ runner.os }}-bioc-${{ matrix.config.bioc }}-${{ hashFiles('depends.Rds') }}
Expand Down Expand Up @@ -102,11 +102,24 @@ jobs:

- name: Upload install log if the build/install/check step fails
if: always() && (steps.build-install-check.outcome == 'failure')
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: install-log
path: |
${{ steps.build-install-check.outputs.install-log }}
- name: Install dependencies
run: |
install.packages("rlang")
install.packages("testthat")
shell: Rscript {0}

- name: Run tests and capture output
run: |
sink(file = "tests/testthat.Rout")
testthat::test_dir("tests/testthat")
sink()
shell: Rscript {0}

- name: Show testthat output (windows)
if: always() && runner.os == 'Windows'
Expand All @@ -133,17 +146,19 @@ jobs:
arguments: '--no-check-bioc-views --no-check-bioc-help'
error-on: 'error'

- name: Test coverage
if: matrix.config.os == 'macOS-12' && matrix.config.bioc == 'devel'
run: |
install.packages("covr")
covr::codecov(token = "${{secrets.CODECOV_TOKEN}}")
shell: Rscript {0}
#- name: Test coverage
# if: matrix.config.os == 'macOS-latest' && matrix.config.bioc == 'devel'
# run: |
# install.packages("covr")
# covr::codecov(token = "${{secrets.CODECOV_TOKEN}}")
# shell: Rscript {0}

- name: Deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/devel' && matrix.config.deploy == 'yes'
run: |
R CMD INSTALL .
Rscript -e "remotes::install_dev('pkgdown'); pkgdown::deploy_to_branch(new_process = FALSE)"



1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.Rhistory
.RData
.Ruserdata
.github
inst/doc
37 changes: 22 additions & 15 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: peakCombiner
Title: The R package to curate and merge enriched genomic regions into consensus peak sets
Version: 0.99.4
Version: 0.99.1
Description: peakCombiner, a fully R based, user-friendly, transparent, and customizable tool that allows even novice R users to create a high-quality consensus peak list. The modularity of its functions allows an easy way to optimize input and output data. A broad range of accepted input data formats can be used to create a consensus peak set that can be exported to a file or used as the starting point for most downstream peak analyses.
Authors@R: c(person("Markus", "Muckenhuber",
email = "markusmuckenhuber@gmx.at",
Expand All @@ -13,8 +13,10 @@ Authors@R: c(person("Markus", "Muckenhuber",
person("Michael", "Stadler",
email = "",
role = c("aut"),
comment = c(ORCID = "0000-0002-2269-4934")))
Depends: R (>= 4.2)
comment = c(ORCID = "0000-0002-2269-4934")),
person("Novartis Biomedical Research",
role = c("cph")))
Depends: R (>= 4.3.0)
License: MIT + file LICENSE
LazyData: FALSE
biocViews:
Expand All @@ -23,33 +25,38 @@ biocViews:
ChipOnChip
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
Suggests:
testthat (>= 3.0.0),
tidyverse,
rmarkdown,
styler,
cli,
lintr,
rtracklayer,
knitr,
devtools,
qpdf,
ggplot2,
BiocStyle,
ggplot2
DEPENDS:
dplyr (>= 1.1.2),
GenomicRanges
usethis,
utils
Imports:
stringr,
tidyr,
purrr (>= 1.0.1),
dplyr (>= 1.1.2),
IRanges,
GenomicRanges,
tidyselect,
purrr,
readr (>= 2.1.2),
tibble (>= 3.2.1),
stats,
IRanges,
rlang,
here
stringr,
here,
stats,
qpdf
URL:
BugReports:
https://github.com/novartis/peakCombiner/,
https://bioconductor.org/packages/peakCombiner
BugReports: https://github.com/novartis/peakCombiner/issues
Config/testthat/edition: 3
VignetteBuilder: knitr
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2023
COPYRIGHT HOLDER: peakCombiner authors
COPYRIGHT HOLDER: Novartis Biomedical Research
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ export(center_expand_regions)
export(combine_regions)
export(filter_regions)
export(prepare_input_regions)
import(here)
import(stringr)
import(tidyr)
importFrom(rlang,.data)
25 changes: 12 additions & 13 deletions R/center_expand_regions.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@
#' named `chrom`, `start`, `end`, `name`,
#' `score`, `strand`, `center`, `sample_name`. Additional
#' columns will be maintained.
#' @param center_by Allowed values are 'center_column' (default) or
#' @param center_by Allowed values are 'center_column' (default) or
#' 'midpoint'.
#' * 'center_column' uses the value stored in the column `center` to center.
#' * 'midpoint' replaces the value stored in the column `center` with the
#' mathematical mean of each genomic region (e.g., round(end - start / 2)),
#' * 'midpoint' replaces the value stored in the column `center` with the
#' mathematical mean of each genomic region (e.g., round(end - start / 2)),
#' which is then used.
#'
#'
#' @param expand_by Allowed values a numeric vector of length 1 or 2,
#' or 'NULL' (default).
#' * The value from the numeric vector of length 1
Expand Down Expand Up @@ -94,17 +94,17 @@
#'
#' @export
#'
#' @importFrom rlang .data
#' @import tidyr
#' @import here
#'
#' @examples
#' # Load in and prepare a an accepted tibble
#' sample_sheet <- readr::read_tsv(
#' paste0(infolder, "/lists/synthetic_sample_sheet.tsv"),
#' show_col_types = FALSE
#' )
#' sample_sheet
#' utils::data(syn_data_bed)
#'
#' # Prepare input data
#' data_prepared <- prepare_input_regions(
#' data = sample_sheet,
#' data = syn_data_bed,
#' show_messages = TRUE
#' )
#' # Run center and expand
Expand Down Expand Up @@ -132,7 +132,6 @@ center_expand_regions <- function(data,
center_by = "center_column",
expand_by = NULL,
show_messages = TRUE) {

### -----------------------------------------------------------------------###
### Show or hide messages
### -----------------------------------------------------------------------###
Expand Down Expand Up @@ -228,12 +227,12 @@ center_expand_regions <- function(data,
### -----------------------------------------------------------------------###
### Center and expand
### -----------------------------------------------------------------------###

cli::cli_inform(c(
">" = "Genomic regions will be centered and expanded.",
" " = " "
))

if (center_by == "center_column") {
cli::cli_inform(c(
">" = "Starting with expanding genomic regions from the column {.field
Expand Down
7 changes: 1 addition & 6 deletions R/center_expand_regions_helper.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@
#'
#' @return A vector of length 1 to define region expansion.
#'
#' @examples
#' expansion_value <- define_expansion(
#' data = data,
#' expand_by = expand_by
#' )

define_expansion <- function(data = data,
expand_by = expand_by) {

### -----------------------------------------------------------------------###
### Pre-Check up
### -----------------------------------------------------------------------###
Expand Down
3 changes: 1 addition & 2 deletions R/check_data_structure.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Control structure of peakCombiner data structure
#'
#' @description
#' This is a general helper function for the package [peakCombiner]. Aim of this
#' This is a general helper function for the package \pkg{peakCombiner}. Aim of this
#' function is to check a data frame for the correct column names and classes of
#' each column to ensure to be an accepte inpuut for functions:
#' [peakCombiner::center_expand_regions()], [peakCombiner::filter_regions()] and
Expand All @@ -18,7 +18,6 @@
#' [peakCombiner::combine_regions()].
#'
check_data_structure <- function(data) {

### -----------------------------------------------------------------------###
### Define variables
### -----------------------------------------------------------------------###
Expand Down
23 changes: 12 additions & 11 deletions R/combine_regions.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@
#'
#' @export
#'
#' @examples
#' @importFrom rlang .data
#' @import stringr
#' @import tidyr
#' @import here
#'
#' # Load in and prepare input data
#' sample_sheet <- readr::read_tsv(
#' paste0(infolder, "/lists/synthetic_sample_sheet.tsv"),
#' show_col_types = FALSE
#' )
#' sample_sheet
#' @examples
#' # Load in and prepare a an accepted tibble
#' utils::data(syn_data_bed)
#'
#' data_prepared <- prepare_input_regions(
#' data = sample_sheet,
#' data = syn_data_bed,
#' show_messages = FALSE
#' )
#'
Expand All @@ -124,11 +124,12 @@ combine_regions <- function(data,
annotate_with_input_names = FALSE,
combined_sample_name = NULL,
show_messages = TRUE) {

### -----------------------------------------------------------------------###
### Correct parameters & load needed variables
### -----------------------------------------------------------------------###

##
set.seed(1234)
##
### -----------------------------------------------------------------------###
### Show or hide messages
### -----------------------------------------------------------------------###
Expand Down Expand Up @@ -204,7 +205,7 @@ combine_regions <- function(data,


data_combined_with_summit <- data_combined_with_summit |>
dplyr::relocate(.data$strand, .after = .data$score) |>
dplyr::relocate("strand", .after = "score") |>
dplyr::mutate(strand = ifelse(.data$strand == "*", ".", .data$strand)) |>
dplyr::ungroup()

Expand Down
Loading

0 comments on commit ba80246

Please sign in to comment.