Skip to content
Open
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
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ Suggests:
Config/testthat/edition: 3
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
URL: https://github.com/WangLabCSU/blit, https://wanglabcsu.github.io/blit/
BugReports: https://github.com/WangLabCSU/blit/issues
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,20 @@ export(exec)
export(fastp)
export(fastq_pair)
export(fastq_read_pair)
export(freebayes)
export(gistic2)
export(install_appmamba)
export(kraken2)
export(kraken_tools)
export(make_command)
export(minimap2)
export(perl)
export(pyscenic)
export(python)
export(samtools)
export(seqkit)
export(snpEff)
export(strelka)
export(trust4)
export(trust4_gene_names)
export(trust4_imgt_annot)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

* new command `bedtools`

* new command `strelka`

* new command `minimap2`

# blit 0.2.0

## New features
Expand Down
53 changes: 53 additions & 0 deletions R/cmd-freebayes.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#' Run freebayes
#'
#'freebayes is a Bayesian genetic variant detector designed to find small polymorphisms,
#'specifically SNPs (single-nucleotide polymorphisms), indels (insertions and deletions),
#'MNPs (multi-nucleotide polymorphisms), and complex events (composite insertion and substitution events)
#'smaller than the length of a short-read sequencing alignment.
#' @param ref A string of reference file path.
#' @param input A string of path to the input bam file.
#' @param ofile A string of path to the output vcf file.
#' @param ... `r rd_dots("freebayes")`.
#' @param freebayes `r rd_cmd("freebayes")`.
#' @family command
#' @inherit exec return
#' @seealso
#' - <https://github.com/freebayes/freebayes>
#'
#' `r rd_seealso()`
#' @export
freebayes <- make_command(
"freebayes",
function(
ref,
input,
ofile,
...,
freebayes = NULL
){
assert_string(freebayes, allow_empty = FALSE, allow_null = TRUE)
Freebayes$new(
cmd = freebayes,
...,
ref = ref,
input = input,
ofile = ofile,
)
}
)

Freebayes <- R6Class(
"Freebayes",
inherit = Command,
private = list(
alias = function() "freebayes",
setup_help_params = function() "--help",
setup_command_params = function(ref, input, ofile){
c(
arg0("-f", ref),
arg0("-b", input),
arg0("-v", ofile)
)
}
)
)
70 changes: 70 additions & 0 deletions R/cmd-minimap2.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#' Run minimap2
#'
#' Minimap2 is a versatile sequence alignment program that aligns DNA or mRNA sequences against a large reference database.
#' Typical use cases include:
#' (1) mapping PacBio or Oxford Nanopore genomic reads to the human genome;
#' (2) finding overlaps between long reads with error rate up to ~15%;
#' (3) splice-aware alignment of PacBio Iso-Seq or Nanopore cDNA or Direct RNA reads against a reference genome;
#' (4) aligning Illumina single- or paired-end reads;
#' (5) assembly-to-assembly alignment;
#' (6) full-genome alignment between two closely related species with divergence below ~15%.
#'
#' @param method Mapping preset: "map-ont" (single-end long reads) or "sr" (paired-end short reads).
#' @param ref Path to the reference genome FASTA file.
#' @param reads A character vector of FASTQ files used as input to minimap2.
#' @param ofile A string of path to the output SAM file.
#' @param ... `r rd_dots("minimap2")`.
#' @param minimap2 `r rd_cmd("minimap2")`.
#' @family command
#' @inherit exec return
#' @seealso
#' - <https://github.com/lh3/minimap2>
#'
#' `r rd_seealso()`
#' @export
minimap2 <- make_command(
"minimap2",
function(
method,
ref,
reads,
ofile,
...,
minimap2 = NULL
){
assert_string(minimap2, allow_empty = FALSE, allow_null = TRUE)
Minimap2$new(
cmd = minimap2,
...,
method = method,
ref = ref,
reads = reads,
ofile = ofile
)
}
)

Minimap2 <- R6Class(
"Minimap2",
inherit = Command,
private = list(
alias = function() "minimap2",
setup_help_params = function() "--help",
setup_command_params = function(method, ref, reads, ofile){
c(
if (!method %in% c("map-ont", "sr")){
cli::cli_abort("{.arg method} must be map-ont or sr!")
} else { arg0("-ax", method) },
ref,
if (length(reads) == 1L){
reads
} else if (length(reads) == 2L){
reads
} else {
cli::cli_abort("{.arg reads} must be of length 1 or 2")
},
arg0(">", ofile)
)
}
)
)
50 changes: 50 additions & 0 deletions R/cmd-strelka.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#' Run strelka
#'
#' Strelka is a fast and accurate small variant caller optimized for analysis of germline variation
#' in small cohorts and somatic variation in tumor/normal sample pairs.
#'
#' @param script Name of the Strelka script. One of
#' `r oxford_comma(code_quote(StrelkaScripts))`.
#' @param ... `r rd_dots("strelka")`.
#' @param strelka `r rd_cmd("strelka")`.
#' @seealso
#' - <https://github.com/Illumina/strelka>
#'
#' `r rd_seealso()`
#' @inherit exec return
#' @family command
#' @export
strelka <- make_command(
"strelka",
function(script, ...) {
script <- rlang::arg_match0(script, StrelkaScripts)
Strelka$new(
script = script,
...
)
}
)

Strelka <- R6::R6Class(
"Strelka",
inherit = Command,
private = list(
alias = function() "strelka",
command_locate = function() {
py2 <- Sys.which("python2")
if (py2 == "") {
stop("Cannot locate python2. Please install it or activate a Conda environment with Python2.")
}else{py2}
},
setup_help_params = function() "--help",
setup_command_params = function(script) {
script_path <- pkg_extdata("strelka", paste0(script, ".py"))
file_executable(script_path)
c(script_path, super$combine_params())
}
)
)

StrelkaScripts <- c(
"configureStrelkaGermlineWorkflow", "configureStrelkaSomaticWorkflow", "runWorkflow"
)
3 changes: 3 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ reference:
- varscan
- snpEff
- gistic2
- strelka
- minimap2
- freebayes

- title: "Transcriptomic tools"
desc: "Wrappers for transcriptome sequencing data processing and analysis tools."
Expand Down
Loading