... | ... |
@@ -2,8 +2,6 @@ |
2 | 2 |
output: github_document |
3 | 3 |
--- |
4 | 4 |
|
5 |
-<!-- README.md is generated from README.Rmd. Please edit that file --> |
|
6 |
- |
|
7 | 5 |
```{r, include = FALSE} |
8 | 6 |
knitr::opts_chunk$set( |
9 | 7 |
collapse = TRUE, |
... | ... |
@@ -24,16 +22,6 @@ The goal of `easylift` is to perform genomic liftover given `GRanges` and `chain |
24 | 22 |
|
25 | 23 |
## Installation |
26 | 24 |
|
27 |
-<!-- Get the latest stable `R` release from [CRAN](http://cran.r-project.org/). Then install `easylift` from [Bioconductor](http://bioconductor.org/) using the following code: --> |
|
28 |
- |
|
29 |
-<!-- ```{r 'install', eval = FALSE} --> |
|
30 |
-<!-- if (!requireNamespace("BiocManager", quietly = TRUE)) { --> |
|
31 |
-<!-- install.packages("BiocManager") --> |
|
32 |
-<!-- } --> |
|
33 |
- |
|
34 |
-<!-- BiocManager::install("easylift") --> |
|
35 |
-<!-- ``` --> |
|
36 |
- |
|
37 | 25 |
Get the latest development version from [GitHub](https://github.com/nahid18/easylift) with: |
38 | 26 |
|
39 | 27 |
```{r 'install_dev', eval = FALSE} |
... | ... |
@@ -41,14 +29,13 @@ BiocManager::install("nahid18/easylift") |
41 | 29 |
``` |
42 | 30 |
## Usage |
43 | 31 |
|
44 |
-First, import the libraries |
|
45 |
-```{r library, eval = requireNamespace('easylift', 'GenomicRanges')} |
|
32 |
+Import the libraries |
|
33 |
+```{r library, eval = FALSE} |
|
46 | 34 |
library("easylift") |
47 | 35 |
library("GenomicRanges") |
48 | 36 |
``` |
49 | 37 |
|
50 |
-Then, execute the code below. |
|
51 |
-This assumes you already downloaded the required chain file. |
|
38 |
+Call `easylift` with `GRanges` object, target genome and chain file. |
|
52 | 39 |
|
53 | 40 |
```{r example, eval = FALSE} |
54 | 41 |
gr <- GRanges(seqname = Rle(paste("chr", 1, sep = "")), |
... | ... |
@@ -56,6 +43,7 @@ gr <- GRanges(seqname = Rle(paste("chr", 1, sep = "")), |
56 | 43 |
genome(gr) <- "hg19" |
57 | 44 |
to <- "hg38" |
58 | 45 |
chain <- "hg19ToHg38.over.chain.gz" |
46 |
+ |
|
59 | 47 |
lifted <- easylift(gr, to, chain) |
60 | 48 |
``` |
61 | 49 |
|
... | ... |
@@ -73,9 +61,9 @@ A BibTeX entry for LaTeX users is |
73 | 61 |
``` |
74 | 62 |
@Manual{, |
75 | 63 |
title = {easylift: An R package to perform genomic liftOver}, |
76 |
- author = {Abdullah {Al Nahid} and Michael Love}, |
|
64 |
+ author = {Abdullah Al Nahid and Michael Love}, |
|
77 | 65 |
year = {2023}, |
78 |
- note = {R package version 0.0.1}, |
|
66 |
+ note = {R package version 0.0.2}, |
|
79 | 67 |
url = {https://github.com/nahid18/easylift}, |
80 | 68 |
} |
81 | 69 |
``` |
... | ... |
@@ -1,6 +1,4 @@ |
1 | 1 |
|
2 |
-<!-- README.md is generated from README.Rmd. Please edit that file --> |
|
3 |
- |
|
4 | 2 |
# easylift |
5 | 3 |
|
6 | 4 |
<!-- badges: start --> |
... | ... |
@@ -16,14 +14,6 @@ and `chain` file. |
16 | 14 |
|
17 | 15 |
## Installation |
18 | 16 |
|
19 |
-<!-- Get the latest stable `R` release from [CRAN](http://cran.r-project.org/). Then install `easylift` from [Bioconductor](http://bioconductor.org/) using the following code: --> |
|
20 |
-<!-- ```{r 'install', eval = FALSE} --> |
|
21 |
-<!-- if (!requireNamespace("BiocManager", quietly = TRUE)) { --> |
|
22 |
-<!-- install.packages("BiocManager") --> |
|
23 |
-<!-- } --> |
|
24 |
-<!-- BiocManager::install("easylift") --> |
|
25 |
-<!-- ``` --> |
|
26 |
- |
|
27 | 17 |
Get the latest development version from |
28 | 18 |
[GitHub](https://github.com/nahid18/easylift) with: |
29 | 19 |
|
... | ... |
@@ -33,15 +23,14 @@ BiocManager::install("nahid18/easylift") |
33 | 23 |
|
34 | 24 |
## Usage |
35 | 25 |
|
36 |
-First, import the libraries |
|
26 |
+Import the libraries |
|
37 | 27 |
|
38 | 28 |
``` r |
39 | 29 |
library("easylift") |
40 | 30 |
library("GenomicRanges") |
41 | 31 |
``` |
42 | 32 |
|
43 |
-Then, execute the code below. This assumes you already downloaded the |
|
44 |
-required chain file. |
|
33 |
+Call `easylift` with `GRanges` object, target genome and chain file. |
|
45 | 34 |
|
46 | 35 |
``` r |
47 | 36 |
gr <- GRanges(seqname = Rle(paste("chr", 1, sep = "")), |
... | ... |
@@ -49,6 +38,7 @@ gr <- GRanges(seqname = Rle(paste("chr", 1, sep = "")), |
49 | 38 |
genome(gr) <- "hg19" |
50 | 39 |
to <- "hg38" |
51 | 40 |
chain <- "hg19ToHg38.over.chain.gz" |
41 |
+ |
|
52 | 42 |
lifted <- easylift(gr, to, chain) |
53 | 43 |
``` |
54 | 44 |
|
... | ... |
@@ -64,9 +54,9 @@ A BibTeX entry for LaTeX users is |
64 | 54 |
|
65 | 55 |
@Manual{, |
66 | 56 |
title = {easylift: An R package to perform genomic liftOver}, |
67 |
- author = {Abdullah {Al Nahid} and Michael Love}, |
|
57 |
+ author = {Abdullah Al Nahid and Michael Love}, |
|
68 | 58 |
year = {2023}, |
69 |
- note = {R package version 0.0.1}, |
|
59 |
+ note = {R package version 0.0.2}, |
|
70 | 60 |
url = {https://github.com/nahid18/easylift}, |
71 | 61 |
} |
72 | 62 |
|
73 | 63 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,12 @@ |
1 |
+# This file is part of the standard setup for testthat. |
|
2 |
+# It is recommended that you do not modify it. |
|
3 |
+# |
|
4 |
+# Where should you do additional test configuration? |
|
5 |
+# Learn more about the roles of various files in: |
|
6 |
+# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview |
|
7 |
+# * https://testthat.r-lib.org/articles/special-files.html |
|
8 |
+ |
|
9 |
+library(testthat) |
|
10 |
+library(easylift) |
|
11 |
+ |
|
12 |
+test_check("easylift") |
0 | 13 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,44 @@ |
1 |
+library(GenomicRanges) |
|
2 |
+library(IRanges) |
|
3 |
+ |
|
4 |
+test_that("easylift function tests with valid chain files", { |
|
5 |
+ |
|
6 |
+ # Test 1: Test with a valid chain gzipped file |
|
7 |
+ chain_path_gz <- system.file("extdata", "hg19ToHg38.over.chain.gz", package = "easylift") |
|
8 |
+ gr <- GenomicRanges::GRanges( |
|
9 |
+ seqnames = "chr1", |
|
10 |
+ ranges = IRanges::IRanges(start = 100, end = 200), |
|
11 |
+ strand = "+" |
|
12 |
+ ) |
|
13 |
+ genome(gr) <- "hg19" |
|
14 |
+ expect_type(easylift(gr, to = "hg38", chain = chain_path_gz), "S4") |
|
15 |
+ expect_no_error(easylift(gr, to = "hg38", chain = chain_path_gz)) |
|
16 |
+ |
|
17 |
+ # Test 2: Test with a valid chain file |
|
18 |
+ chain_path <- system.file("extdata", "hg19ToHg38.over.chain", package = "easylift") |
|
19 |
+ gr2 <- GenomicRanges::GRanges( |
|
20 |
+ seqnames = "chr2", |
|
21 |
+ ranges = IRanges::IRanges(start = 200, end = 300), |
|
22 |
+ strand = "+" |
|
23 |
+ ) |
|
24 |
+ genome(gr2) <- "hg19" |
|
25 |
+ expect_type(easylift(gr2, to = "hg38", chain = chain_path), "S4") |
|
26 |
+ expect_no_error(easylift(gr2, to = "hg38", chain = chain_path)) |
|
27 |
+ |
|
28 |
+}) |
|
29 |
+ |
|
30 |
+test_that("easylift function tests with error cases", { |
|
31 |
+ |
|
32 |
+ # Test 3: Test with an empty GRanges object |
|
33 |
+ gr3 <- GenomicRanges::GRanges() |
|
34 |
+ expect_error(easylift(gr3, to = "hg38", chain = chain_path)) |
|
35 |
+ |
|
36 |
+ # Test 4: Test with missing genome information |
|
37 |
+ gr4 <- GenomicRanges::GRanges( |
|
38 |
+ seqnames = "chr4", |
|
39 |
+ ranges = IRanges::IRanges(start = 400, end = 500), |
|
40 |
+ strand = "+" |
|
41 |
+ ) |
|
42 |
+ expect_error(easylift(gr4, to = "hg38", chain = chain_path)) |
|
43 |
+ |
|
44 |
+}) |