forked from dongzhuoer/rutil
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Zhuoer Dong
committed
Dec 10, 2018
1 parent
9bc60a1
commit 39dd90d
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#' @title wrapper to run Aliscore | ||
#' | ||
#' @details aliscore will produce several files under the directory containg input files | ||
#' | ||
#' @param args character. options for `Aliscore.0x.y.pl` | ||
#' @param ... other parameters passed on to [system2()] | ||
#' | ||
#' @return result of [system2()] | ||
#' @export | ||
#' | ||
#' @examples | ||
#' \donotrun { | ||
#' aliscore('-i data-raw/aliscore/test.fasta') | ||
#' } | ||
aliscore <- function(args, ...) { | ||
args %<>% c('-I', pkg_file('lib'), pkg_file('exec/Aliscore.02.2.pl'), .) | ||
system2('perl', args, ...); | ||
} | ||
|
||
|
||
#' @title wrapper to run Alicut | ||
#' | ||
#' @param dir string. the directory your input files lie. working directory will | ||
#' be temporarily set to it | ||
#' @param ... other parameters passed on to [system2()], including `args` and so | ||
#' on. | ||
#' | ||
#' @return result of [system2()] | ||
#' @export | ||
#' | ||
#' @examples | ||
#' \donotrun { | ||
#' aliscore('-i data-raw/aliscore/test.fasta'); | ||
#' alicut('data-raw/aliscore', args = '-s') | ||
#' } | ||
alicut <- function(dir, ...) { | ||
old_wd <- getwd(); | ||
on.exit(setwd(old_wd)); | ||
|
||
setwd(dir); | ||
system2(pkg_file('exec/ALICUT_V2.31.pl'), ...); | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
library(testthat) | ||
library(biozhuoer) | ||
|
||
test_check("biozhuoer") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
context("Testing phylo") | ||
|
||
setwd('../..'); | ||
|
||
dir('data-raw/aliscore/', full.names = T) %>% file.remove() | ||
file.copy('data-raw/aligned-multiline.fasta', 'data-raw/aliscore/test.fasta'); | ||
|
||
test_that("Testing aliscore", { | ||
expect_identical(aliscore('-i data-raw/aliscore/test.fasta', F, F), 0L); | ||
}); | ||
|
||
test_that("Testing alicut", { | ||
expect_identical(alicut('data-raw/aliscore', '-s'), 0L); | ||
}); | ||
|