Skip to content

Commit

Permalink
Update unit tests + vignette.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomrrr1 committed May 9, 2024
1 parent c6a7a79 commit 91bb8d1
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 27 deletions.
2 changes: 1 addition & 1 deletion R/read_motif_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ read_motif_file <- function(motif_file,
)

if (!file_format %in% names(read_functions)) {
stop(
stopper(
"Unsupported file format. The motif file must be one of",
"homer, jaspar, meme, transfac or uniprobe."
)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-check_peak_input.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ test_that("fail when peaks are incorrectly formatted", {
})

test_that("list outputted by check_peak_input function", {
data("creb_peaks", package = "MotifStats")
data("ctcf_peaks", package = "MotifStats")
res <- check_peak_input(
creb_peaks,
ctcf_peaks,
genome_build = BSgenome.Hsapiens.UCSC.hg38::BSgenome.Hsapiens.UCSC.hg38
)

Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-density_plot.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
test_that("the density_plot function outputs a ggplot", {
temp_dir <- withr::local_tempdir()

data("creb_peaks", package = "MotifStats")
data("creb_motif", package = "MotifStats")
data("ctcf_peaks", package = "MotifStats")
data("ctcf_motif", package = "MotifStats")

summit_to_motif_out <- summit_to_motif(
peak_input = creb_peaks,
motif = creb_motif,
peak_input = ctcf_peaks,
motif = ctcf_motif,
fp_rate = 0.05,
out_dir = temp_dir,
genome_build = BSgenome.Hsapiens.UCSC.hg38::BSgenome.Hsapiens.UCSC.hg38
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-markov_background_model.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
test_that("file created by markov_background_model function", {
temp_dir <- withr::local_tempdir()

data("creb_peaks", package = "MotifStats")
data("ctcf_peaks", package = "MotifStats")
genome_build <- BSgenome.Hsapiens.UCSC.hg38::BSgenome.Hsapiens.UCSC.hg38
peak_sequences <- BSgenome::getSeq(genome_build,
creb_peaks)
ctcf_peaks)

res <- markov_background_model(sequences = peak_sequences,
out_dir = temp_dir)
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-motif_enrichment.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
test_that("list outputted by motif_enrichment function", {
data("creb_peaks", package = "MotifStats")
data("creb_motif", package = "MotifStats")
data("ctcf_peaks", package = "MotifStats")
data("ctcf_motif", package = "MotifStats")

temp_dir <- withr::local_tempdir()
withr::defer(temp_dir)

res <- motif_enrichment(
peak_input = creb_peaks,
motif = creb_motif,
peak_input = ctcf_peaks,
motif = ctcf_motif,
genome_build = BSgenome.Hsapiens.UCSC.hg38::BSgenome.Hsapiens.UCSC.hg38,
out_dir = temp_dir
)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-read_peak_file.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
test_that("The output of read_peak_file is a GRanges object", {
peak_file <- system.file("extdata",
"creb_subset.narrowPeak",
"ctcf_subset.narrowPeak",
package = "MotifStats")
res <- read_peak_file(file_path = peak_file)

Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-summit_to_motif.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
test_that("list outputted by summit_to_motif function", {
temp_dir <- withr::local_tempdir()

data("creb_peaks", package = "MotifStats")
data("creb_motif", package = "MotifStats")
data("ctcf_peaks", package = "MotifStats")
data("ctcf_motif", package = "MotifStats")

res <- summit_to_motif(
peak_input = creb_peaks,
motif = creb_motif,
peak_input = ctcf_peaks,
motif = ctcf_motif,
fp_rate = 5e-02,
genome_build = BSgenome.Hsapiens.UCSC.hg38::BSgenome.Hsapiens.UCSC.hg38,
out_dir = temp_dir
Expand Down
10 changes: 1 addition & 9 deletions vignettes/MotifStats.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,11 @@ is used to recover the locations of each motif.
The `MotifStats` package comes with motif and peak data for transcription
factors CTCF and CREB1. Details of the files are as follows:

- **CREB1 TIP-seq peaks (narrowPeaks)**[^f1]
-- *Data not publicly available*

- **CTCF TIP-seq peaks (narrowPeaks)**[^f1]
-- Retrieved from NCBI GEO under
accession
[GSE188512](https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE188512)

- **CREB motif**
-- Retrieved from JASPAR2024 under matrix ID
[MA0018.5](http://jaspar.genereg.net/matrix/MA0018.5/)

- **CTCF motif**
-- Retrieved from JASPAR2024 under matrix ID
[MA1930.2](http://jaspar.genereg.net/matrix/MA1930.2/)
Expand Down Expand Up @@ -210,8 +203,7 @@ sessionInfo()


<!-- Footnotes -->
[^f1]: The peak file is a subset of chromosome 19 to reduce the size of the
built-in data.
[^f1]: The peak file is a subset of chromosome 19 to reduce the file size.
[^f2]: narrowPeak files from both version 2 and 3 of [MACS: Model-based Analysis
for ChIP-Seq](https://github.com/macs3-project/MACS) is supported.
[^f3]: For more information on the output files, refer to the
Expand Down

0 comments on commit 91bb8d1

Please sign in to comment.