Skip to content
Merged

bwa #13

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export(arg0)
export(bcftools)
export(bedtools)
export(bowtie2)
export(bwa)
export(cellranger)
export(cmd_background)
export(cmd_conda)
Expand Down
48 changes: 48 additions & 0 deletions R/cmd-bwa.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#' Run BWA
#'
#' BWA is a software package that aligns low-divergence sequences to a
#' large reference genome, such as the human genome
#' @param subcmd Sub-Command of BWA (e.g., "index", "mem").
#' @param ... `r rd_dots("bwa")`.
#' @param bwa `r rd_cmd("bwa")`.
#' @inherit exec return
#' @seealso
#' - <http://bio-bwa.sourceforge.net/>
#'
#' `r rd_seealso()`
#' @examples
#' \dontrun{
#' # Index reference genome
#' bwa("index", "-a", "bwtsw", "reference.fa") |>
#' cmd_run()
#'
#' # Paired-end sequence alignment
#' bwa("mem", "-t", "4", "reference.fa", "read1.fq", "read2.fq") |>
#' cmd_run(stdout = "output.sam")
#'
#' # Single-end alignment (generate sai file)
#' bwa("aln", "-t", "4", "reference.fa", "read.fq") |>
#' cmd_run(stdout = "read.sai")
#' }
#' @family command
#' @export
bwa <- make_command(
"bwa",
function(subcmd = NULL, ..., bwa = NULL) {
assert_string(subcmd, allow_empty = FALSE, allow_null = TRUE)
assert_string(bwa, allow_empty = FALSE, allow_null = TRUE)
BWA$new(cmd = bwa, ..., subcmd = subcmd)
}
)

BWA <- R6Class(
"BWA",
inherit = Command,
private = list(
alias = function() "bwa",
setup_help_params = function() "--help",
combine_params = function(subcmd) {
c(subcmd, super$combine_params())
}
)
)
5 changes: 5 additions & 0 deletions blit.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ SaveWorkspace: No
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

AutoAppendNewline: Yes
StripTrailingWhitespace: Yes
LineEndingConversion: Posix
Expand Down
1 change: 1 addition & 0 deletions man/allele_counter.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/bcftools.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/bedtools.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/bowtie2.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions man/bwa.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/cellranger.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/conda.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/exec.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/fastp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/fastq_pair.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/gistic2.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/kraken2.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/kraken_tools.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/perl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/pyscenic.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/python.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/samtools.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/seqkit.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/snpEff.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/trust4.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/varscan.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 34 additions & 1 deletion tests/testthat/test-exec.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ testthat::test_that("`bedtools()` works as expected", {
bedtools() |> cmd_help()
})

testthat::test_that("`bwa()` works as expected", {
testthat::skip_if_not(nzchar(Sys.which("bwa")))
bwa() |> cmd_help()
bwa("index") |> cmd_help()
bwa("mem") |> cmd_help()
})

testthat::test_that("`cellranger()` works as expected", {
testthat::skip_if_not(nzchar(Sys.which("cellranger")))
cellranger() |> cmd_help()
Expand Down Expand Up @@ -96,4 +103,30 @@ testthat::test_that("`bcftools()` works as expected", {
testthat::test_that("`bowtie2()` works as expected", {
testthat::skip_if_not(nzchar(Sys.which("bowtie2")))
bowtie2() |> cmd_help()
})
})

testthat::test_that("`varscan()` works as expected", {
testthat::skip_if_not(nzchar(Sys.which("varscan")))
varscan() |> cmd_help()
})

testthat::test_that("`fastp()` works as expected", {
testthat::skip_if_not(nzchar(Sys.which("fastp")))
fastp() |> cmd_help()
})


testthat::test_that("`snpeff()` works as expected", {
testthat::skip_if_not(nzchar(Sys.which("snpeff")))
snpeff() |> cmd_help()
})

testthat::test_that("`bcftools()` works as expected", {
testthat::skip_if_not(nzchar(Sys.which("bcftools")))
bcftools() |> cmd_help()
})

testthat::test_that("`bowtie2()` works as expected", {
testthat::skip_if_not(nzchar(Sys.which("bowtie2")))
bowtie2() |> cmd_help()
})
Loading