Skip to content

Commit

Permalink
Changed actions to 3.19
Browse files Browse the repository at this point in the history
  • Loading branch information
smped committed May 4, 2024
1 parent 72d0458 commit d8dd019
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/check-bioc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ env:
has_testthat: 'true'
run_covr: 'true'
run_pkgdown: 'true'
cache-version: 'cache-v3'
cache-version: 'cache-v1'
run_docker: 'false'

jobs:
Expand All @@ -51,9 +51,9 @@ jobs:
fail-fast: false
matrix:
config:
- { os: ubuntu-latest, r: '4.4', bioc: 'devel', cont: "bioconductor/bioconductor_docker:devel", rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest" }
- { os: macOS-latest, r: '4.3', bioc: '3.18'}
- { os: windows-latest, r: '4.3', bioc: '3.18'}
- { os: ubuntu-latest, r: '4.4', bioc: '3.19', cont: "bioconductor/bioconductor_docker:RELEASE_3_19", rspm: "https://packagemanager.posit.co/cran/__linux__/jammy/latest" }
- { os: macOS-latest, r: '4.4', bioc: '3.19'}
- { os: windows-latest, r: '4.4', bioc: '3.19'}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
Expand Down Expand Up @@ -101,16 +101,16 @@ jobs:
uses: actions/cache@v3
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-next-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-next-
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-3.19-r-4.4-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-3.19-r-4.4-

- name: Cache R packages on Linux
if: "!contains(github.event.head_commit.message, '/nocache') && runner.os == 'Linux' "
uses: actions/cache@v3
with:
path: /home/runner/work/_temp/Library
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-next-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-next-
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-3.19-r-4.4-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-3.19-r-4.4-


- name: Install macOS system dependencies
Expand Down Expand Up @@ -267,7 +267,7 @@ jobs:
if: failure()
uses: actions/upload-artifact@master
with:
name: ${{ runner.os }}-biocversion-devel-r-next-results
name: ${{ runner.os }}-biocversion-3.19-r-4.4-results
path: check

- uses: docker/build-push-action@v1
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: extraChIPs
Version: 1.7.10
Version: 1.8.1
Title: Additional functions for working with ChIP-Seq data
Authors@R: person("Stevie", "Pederson",
email = "[email protected]",
Expand Down
11 changes: 9 additions & 2 deletions R/importPeaks.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ importPeaks <- function(
}

## Handle empty files separately first
if (file.size(x) == 0) return(GRanges(NULL, seqinfo = seqinfo))
if (.isEmpty(x)) return(GRanges(NULL, seqinfo = seqinfo))

## Define the parameters for the two types
colNames <- c(
Expand Down Expand Up @@ -158,9 +158,10 @@ importPeaks <- function(
}

## Handle empty files separately first
if (file.size(x) == 0) return(GRanges(NULL, seqinfo = seqinfo))
if (.isEmpty(x)) return(GRanges(NULL, seqinfo = seqinfo))

## Define the colnames
stopifnot(.isValidBed(x))
nCol <- min(ncol(read.table(x, sep = "\t", nrows = 1)), 6)
colNames <- c("seqnames", "start", "end", "name", "score", "strand")
classes <- c(
Expand Down Expand Up @@ -245,3 +246,9 @@ importPeaks <- function(
}
all(allNumerics, strandOK)
}

.isEmpty <- function(x) {
## This is a better approach then checking file.size, given that a
## compressed empty file will have size ~20B
!length(readLines(x, n = 1))
}
Binary file added inst/extdata/empty.bed.gz
Binary file not shown.
8 changes: 3 additions & 5 deletions tests/testthat/test_importPeaks.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ test_that("seqinfo objects behave correctly for narrowPeak files", {
)
)
## Error
expect_error(
importPeaks(fl, "narrow", seqinfo = NULL)
)
expect_error(importPeaks(fl, "narrow", seqinfo = NULL))
## Error
expect_error(
importPeaks(fl, "narrow", glueNames = "{1:5}"), "length.+is not TRUE"
Expand All @@ -105,8 +103,8 @@ test_that("blacklists behave correctly",{


test_that("Empty files parse empty GRanges", {
fl <- file.path(tempdir(), "empty.txt")
file.create(fl)
## This now catches empty files that are compressed too!
fl <- system.file("extdata/empty.bed.gz", package = "extraChIPs")
np1 <- importPeaks(fl, type = "narrow", setNames = FALSE)
bp1 <- importPeaks(fl, type = "broad", setNames = FALSE)
expect_true(is(c(np1, bp1), "GRangesList"))
Expand Down

0 comments on commit d8dd019

Please sign in to comment.