352 | 351 |
deleted file mode 100644 |
... | ... |
@@ -1,66 +0,0 @@ |
1 |
-test_read.bismark_coverage <- function() { |
|
2 |
- # Test that read.bismark() works on good input |
|
3 |
- infile <- system.file("extdata", "test_data.fastq_bismark.bismark.cov.gz", |
|
4 |
- package = "bsseq") |
|
5 |
- bsseq <- read.bismark(files = infile, |
|
6 |
- sampleNames = "test_data", |
|
7 |
- rmZeroCov = FALSE, |
|
8 |
- strandCollapse = FALSE, |
|
9 |
- fileType = "cov", |
|
10 |
- verbose = FALSE) |
|
11 |
- checkTrue(is(bsseq, "BSseq")) |
|
12 |
- # Regression check |
|
13 |
- # Should not fail if sampleNames have names() |
|
14 |
- bsseq <- read.bismark(files = infile, |
|
15 |
- sampleNames = c(test = "test_data"), |
|
16 |
- rmZeroCov = FALSE, |
|
17 |
- strandCollapse = FALSE, |
|
18 |
- fileType = "cov", |
|
19 |
- verbose = FALSE) |
|
20 |
- checkTrue(is(bsseq, "BSseq")) |
|
21 |
- |
|
22 |
- # Should also work because the "cov" fileType is the same as the |
|
23 |
- # "oldBedGraph" fileType |
|
24 |
- bsseq <- read.bismark(files = infile, |
|
25 |
- sampleNames = "test_data", |
|
26 |
- rmZeroCov = FALSE, |
|
27 |
- strandCollapse = FALSE, |
|
28 |
- fileType = "oldBedGraph", |
|
29 |
- verbose = FALSE) |
|
30 |
- checkTrue(is(bsseq, "BSseq")) |
|
31 |
- |
|
32 |
- # Test that read.bismark() fails if given incorrect fileType. |
|
33 |
- checkException(read.bismark(files = infile, |
|
34 |
- sampleNames = "test_data", |
|
35 |
- rmZeroCov = FALSE, |
|
36 |
- strandCollapse = FALSE, |
|
37 |
- fileType = "cytosineReport", |
|
38 |
- verbose = FALSE)) |
|
39 |
-} |
|
40 |
- |
|
41 |
-test_read.bismark_cytosineReport <- function() { |
|
42 |
- # Test that read.bismark() works on good input |
|
43 |
- infile <- system.file("extdata", "test_data.cytosineReport.gz", |
|
44 |
- package = "bsseq") |
|
45 |
- bsseq <- read.bismark(files = infile, |
|
46 |
- sampleNames = "test_data", |
|
47 |
- rmZeroCov = FALSE, |
|
48 |
- strandCollapse = FALSE, |
|
49 |
- fileType = "cytosineReport", |
|
50 |
- verbose = FALSE) |
|
51 |
- checkTrue(is(bsseq, "BSseq")) |
|
52 |
- # Check that strandCollapse = FALSE works |
|
53 |
- checkEquals(length(bsseq), 100L) |
|
54 |
- checkTrue("+" %in% strand(bsseq)) |
|
55 |
- |
|
56 |
- # Check that strandCollapse = TRUE works |
|
57 |
- bsseq <- read.bismark(files = infile, |
|
58 |
- sampleNames = "test_data", |
|
59 |
- rmZeroCov = FALSE, |
|
60 |
- strandCollapse = TRUE, |
|
61 |
- fileType = "cytosineReport", |
|
62 |
- verbose = FALSE) |
|
63 |
- checkEquals(length(bsseq), 50L) |
|
64 |
- checkTrue(all(strand(bsseq) == "*")) |
|
65 |
-} |
|
66 |
- |
... | ... |
@@ -1,3 +1,49 @@ |
1 | 1 |
context("read.bismark") |
2 | 2 |
|
3 | 3 |
# TODO: Re-factor read.bismark() and update tests accordingly |
4 |
+test_that("read.bismark() works for 'coverage' file", { |
|
5 |
+ infile <- system.file("extdata", "test_data.fastq_bismark.bismark.cov.gz", |
|
6 |
+ package = "bsseq") |
|
7 |
+ bsseq <- read.bismark(files = infile, |
|
8 |
+ sampleNames = "test_data", |
|
9 |
+ rmZeroCov = FALSE, |
|
10 |
+ strandCollapse = FALSE, |
|
11 |
+ verbose = FALSE) |
|
12 |
+ expect_is(bsseq, "BSseq") |
|
13 |
+}) |
|
14 |
+ |
|
15 |
+test_that("read.bismark() works if sampleNames has names", { |
|
16 |
+ # Regression test |
|
17 |
+ # Should not fail if sampleNames have names() |
|
18 |
+ # TODO: Check why this test is necessary by stepping through read.bismark() |
|
19 |
+ bsseq <- read.bismark(files = infile, |
|
20 |
+ sampleNames = c(test = "test_data"), |
|
21 |
+ rmZeroCov = FALSE, |
|
22 |
+ strandCollapse = FALSE, |
|
23 |
+ verbose = FALSE) |
|
24 |
+ expect_is(bsseq, "BSseq") |
|
25 |
+}) |
|
26 |
+ |
|
27 |
+test_that("read.bismark() works for 'genome wide cytosine report' file", { |
|
28 |
+ # Test that read.bismark() works on good input |
|
29 |
+ infile <- system.file("extdata", "test_data.cytosineReport.gz", |
|
30 |
+ package = "bsseq") |
|
31 |
+ bsseq <- read.bismark(files = infile, |
|
32 |
+ sampleNames = "test_data", |
|
33 |
+ rmZeroCov = FALSE, |
|
34 |
+ strandCollapse = FALSE, |
|
35 |
+ verbose = FALSE) |
|
36 |
+ expect_is(bsseq, "BSseq") |
|
37 |
+ # Check that strandCollapse = FALSE works |
|
38 |
+ expect_equal(nrow(bsseq), 100L) |
|
39 |
+ expect_true(all(strand(bsseq) %in% c("+", "-"))) |
|
40 |
+ |
|
41 |
+ # Check that strandCollapse = TRUE works |
|
42 |
+ bsseq <- read.bismark(files = infile, |
|
43 |
+ sampleNames = "test_data", |
|
44 |
+ rmZeroCov = FALSE, |
|
45 |
+ strandCollapse = TRUE, |
|
46 |
+ verbose = FALSE) |
|
47 |
+ expect_equal(nrow(bsseq), 50L) |
|
48 |
+ expect_true(all(strand(bsseq) == "*")) |
|
49 |
+}) |