From 21150aea31d8442872d4c727ffc27c951652a949 Mon Sep 17 00:00:00 2001 From: wbq <2982433346@qq.com> Date: Wed, 28 May 2025 11:24:50 +0800 Subject: [PATCH 01/10] add bedtools --- R/cmd-bedtools.R | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 R/cmd-bedtools.R diff --git a/R/cmd-bedtools.R b/R/cmd-bedtools.R new file mode 100644 index 0000000..e27a7bb --- /dev/null +++ b/R/cmd-bedtools.R @@ -0,0 +1,39 @@ +#' Run bedtools +#' +#' The "bedtools" is a powerful toolset for genome arithmetic +#' @param +#' @param ... 'r rd_dots("bedtools")'. +#' @param +#' @param bedtools 'r rd_cmd("bedtools")'. +#' @family command +#' @inherit exec return +#' @seealso +#' - +#' +#' 'r rd_seealso()' +#' @export +bedtools <- make_command( + "bedtools", + function( + + ){ + assert_string(bedtools,allow_empty = FALSE, allow_null = TRUE) + BEDTools$new( + cmd = bedtools, + ) + } +) + +BEDTools <- R6Class( + "BEDTools", + inherit = Command, + private = list( + alias = function() "bedtools", + setup_help_params = function() "--help", + setup_command_params = function(){ + c( + + ) + } + ) +) From 2a8218fe42c53f06bedafde1a3f38178c80dc19b Mon Sep 17 00:00:00 2001 From: wbq <2982433346@qq.com> Date: Wed, 4 Jun 2025 00:13:11 +0800 Subject: [PATCH 02/10] add bedtools --- .Rhistory | 0 R/cmd-bedtools.R | 248 ++++++++++++++++++++++++++++++++++++++++++++--- blit.Rproj | 6 ++ 3 files changed, 238 insertions(+), 16 deletions(-) create mode 100644 .Rhistory diff --git a/.Rhistory b/.Rhistory new file mode 100644 index 0000000..e69de29 diff --git a/R/cmd-bedtools.R b/R/cmd-bedtools.R index e27a7bb..1857db9 100644 --- a/R/cmd-bedtools.R +++ b/R/cmd-bedtools.R @@ -1,38 +1,254 @@ #' Run bedtools #' -#' The "bedtools" is a powerful toolset for genome arithmetic +#' The `bedtools` is a powerful toolset for genome arithmetic, +#' which includes `intersect`,`merge`,`coverage`,`getfasta`,`closest`,etc. +#' @param file1 Path to bed/gff(gtf)/vcf/bam(sam) file. +#' @param file2 Path to the second file, some commands require. +#' @param ... +#' - `bedtools intersect`: `r rd_dots("bedtools intersect")`. +#' - `bedtools merge`: `r rd_dots("bedtools merge")`. +#' - `bedtools coverage`: `r rd_dots("bedtools coverage")`. +#' - `bedtools getfasta`: `r rd_dots("bedtools getfasta")`. +#' - `bedtools closest`: `r rd_dots("bedtools closest")`. +#' @param ofile Path to the output file. #' @param -#' @param ... 'r rd_dots("bedtools")'. -#' @param -#' @param bedtools 'r rd_cmd("bedtools")'. -#' @family command -#' @inherit exec return +#' - `bedtools intersect`: `r rd_cmd("bedtools intersect")`. +#' - `bedtools merge`: `r rd_cmd("bedtools merge")`. +#' - `bedtools coverage`: `r rd_cmd("bedtools coverage")`. +#' - `bedtools getfasta`: `r rd_cmd("bedtools getfasta")`. +#' - `bedtools closest`: `r rd_cmd("bedtools closest")`. #' @seealso #' - #' -#' 'r rd_seealso()' +#' `r rd_seealso()` +#' @inherit exec return +#' @family command #' @export -bedtools <- make_command( - "bedtools", + +# bedtools intersect ---- +`bedtools intersect` <- make_command( + "bedtools intersect", + function( + file1, + file2, + ofile, + ..., + `bedtools intersect` = NULL + ){ + assert_string(`bedtools intersect`, allow_empty = FALSE, allow_null = TRUE) + `BEDTools Intersect`$new( + cmd = `bedtools intersect`, + ..., + file1 = file1, + file2 = file2, + ofile = ofile, + ) + } +) + +`BEDTools Intersect` <- R6Class( + "BEDTools Intersect", + inherit = Command, + private = list( + alias = function() "bedtools intersect", + setup_help_params = function() "--help", + setup_command_params = function(file1, file2, ofile){ + c( + arg0("-a", file1), + arg0("-b", file2), + arg0("-wa"), + arg0("-o", ofile), + ) + } + ) +) + +# bedtools merge ---- +`bedtools merge` <- make_command( + "bedtools merge", + function( + file1, + ofile, + ..., + dist = NULL, + `bedtools merge` = NULL + ){ + assert_string(`bedtools merge`, allow_empty = FALSE, allow_null = TRUE) + `BEDTools Merge`$new( + cmd = `bedtools merge`, + ..., + file1 = file1, + dist = dist, + ofile = ofile, + ) + } +) + +`BEDTools Merge` <- R6Class( + "BEDTools Merge", + inherit = Command, + private = list( + alias = function() "bedtools merge", + setup_help_params = function() "--help", + setup_command_params = function(file1, dist, ofile){ + c( + if (endsWith(file1, ".bed")|endsWith(file1, ".gff")){ + arg0("-i", file1) + } else{ + cli::cli_abort( + "{.arg file1} must be BED/GFF" + ) + }, + if (!is.null(dist)) arg0("-d", dist) else NULL, + arg0("-o", ofile), + ) + } + ) +) + +# bedtools coverage ---- +`bedtools coverage` <- make_command( + "bedtools coverage", function( + file1, + file2, + ofile, + ..., + `bedtools coverage` = NULL + ){ + assert_string(`bedtools coverage`, allow_empty = FALSE, allow_null = TRUE) + `BEDTools Coverage`$new( + cmd = `bedtools coverage`, + ..., + file1 = file1, + file2 = file2, + ofile = ofile, + ) + } +) + +`BEDTools Coverage` <- R6Class( + "BEDTools Coverage", + inherit = Command, + private = list( + alias = function() "bedtools coverage", + setup_help_params = function() "--help", + setup_command_params = function(file1, file2, ofile){ + c( + if (endsWith(file1, ".bed")|endsWith(file1, ".gff")){ + arg0("-a", file1) + } else{ + cli::cli_abort( + "{.arg file1} must be BED/GFF" + ) + }, + if (endsWith(file2, ".bed")|endsWith(file2, ".gff")|endsWith(file2, ".bam")){ + arg0("-b", file2) + } else{ + cli::cli_abort( + "{.arg file2} must be BED/GFF/BAM" + ) + }, + arg0("-o", ofile), + ) + } + ) +) +# bedtools getfasta ---- +`bedtools getfasta` <- make_command( + "bedtools getfasta", + function( + file1, + file2, + ofile, + ..., + `bedtools getfasta` = NULL ){ - assert_string(bedtools,allow_empty = FALSE, allow_null = TRUE) - BEDTools$new( - cmd = bedtools, + assert_string(`bedtools getfasta`, allow_empty = FALSE, allow_null = TRUE) + `BEDTools Getfasta`$new( + cmd = `bedtools getfasta`, + ..., + file1 = file1, + file2 = file2, + ofile = ofile, ) } ) -BEDTools <- R6Class( - "BEDTools", +`BEDTools Getfasta` <- R6Class( + "BEDTools Getfasta", inherit = Command, private = list( - alias = function() "bedtools", + alias = function() "bedtools getfasta", setup_help_params = function() "--help", - setup_command_params = function(){ + setup_command_params = function(file1, file2, ofile){ c( + if (endsWith(file1, ".fa")){ + arg0("-fi", file1) + } else{ + cli::cli_abort( + "{.arg file1} must be FASTA" + ) + }, + if (endsWith(file2, ".bed")|endsWith(file2, ".gff")){ + arg0("-bed", file2) + } else{ + cli::cli_abort( + "{.arg file2} must be BED/GFF" + ) + }, + arg0("-fo", ofile), + ) + } + ) +) + +# bedtools closest ---- +`bedtools closest` <- make_command( + "bedtools closest", + function( + file1, + file2, + ofile, + ..., + `bedtools closest` = NULL + ){ + assert_string(`bedtools closest`, allow_empty = FALSE, allow_null = TRUE) + `BEDTools Closest`$new( + cmd = `bedtools closest`, + ..., + file1 = file1, + file2 = file2, + ofile = ofile, + ) + } +) +`BEDTools Closest` <- R6Class( + "BEDTools Closest", + inherit = Command, + private = list( + alias = function() "bedtools closest", + setup_help_params = function() "--help", + setup_command_params = function(file1, file2, ofile){ + c( + if (endsWith(file1, ".bed")|endsWith(file1, ".gff")|endsWith(file1, ".vcf")){ + arg0("-a", file1) + } else{ + cli::cli_abort( + "{.arg file1} must be BED/GFF/VCF" + ) + }, + if (endsWith(file2, ".bed")|endsWith(file2, ".gff")|endsWith(file2, ".vcf")){ + arg0("-b", file2) + } else{ + cli::cli_abort( + "{.arg file2} must be BED/GFF/VCF" + ) + }, + args("-D"), + arg0("-o", ofile), ) } ) diff --git a/blit.Rproj b/blit.Rproj index aaa62a5..268608d 100644 --- a/blit.Rproj +++ b/blit.Rproj @@ -1,12 +1,18 @@ Version: 1.0 +ProjectId: 8959c0d9-c76c-4fa8-a50c-0dae5e78ec5f RestoreWorkspace: No SaveWorkspace: No AlwaysSaveHistory: Default EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 Encoding: UTF-8 +RnwWeave: Sweave +LaTeX: pdfLaTeX + AutoAppendNewline: Yes StripTrailingWhitespace: Yes LineEndingConversion: Posix From b3979fb460f422c445eeca0deee528a4271c025a Mon Sep 17 00:00:00 2001 From: wbq <2982433346@qq.com> Date: Wed, 4 Jun 2025 16:18:21 +0800 Subject: [PATCH 03/10] add bedtools --- R/{cmd-bedtools.R => cmd-bedtools(1).R} | 63 ++++++++++++------------- R/cmd-bedtools(2).R | 59 +++++++++++++++++++++++ 2 files changed, 90 insertions(+), 32 deletions(-) rename R/{cmd-bedtools.R => cmd-bedtools(1).R} (85%) create mode 100644 R/cmd-bedtools(2).R diff --git a/R/cmd-bedtools.R b/R/cmd-bedtools(1).R similarity index 85% rename from R/cmd-bedtools.R rename to R/cmd-bedtools(1).R index 1857db9..a96d6aa 100644 --- a/R/cmd-bedtools.R +++ b/R/cmd-bedtools(1).R @@ -1,7 +1,7 @@ #' Run bedtools #' #' The `bedtools` is a powerful toolset for genome arithmetic, -#' which includes `intersect`,`merge`,`coverage`,`getfasta`,`closest`,etc. +#' which includes `intersect`, `merge`, `coverage`, `getfasta`, `closest`, etc. #' @param file1 Path to bed/gff(gtf)/vcf/bam(sam) file. #' @param file2 Path to the second file, some commands require. #' @param ... @@ -24,10 +24,9 @@ #' @inherit exec return #' @family command #' @export - -# bedtools intersect ---- -`bedtools intersect` <- make_command( - "bedtools intersect", +# bedtools_intersect ---- +bedtools_intersect <- make_command( + "bedtools_intersect", function( file1, file2, @@ -36,7 +35,7 @@ `bedtools intersect` = NULL ){ assert_string(`bedtools intersect`, allow_empty = FALSE, allow_null = TRUE) - `BEDTools Intersect`$new( + BEDTools_Intersect$new( cmd = `bedtools intersect`, ..., file1 = file1, @@ -46,8 +45,8 @@ } ) -`BEDTools Intersect` <- R6Class( - "BEDTools Intersect", +BEDTools_Intersect <- R6Class( + "BEDTools_Intersect", inherit = Command, private = list( alias = function() "bedtools intersect", @@ -63,9 +62,9 @@ ) ) -# bedtools merge ---- -`bedtools merge` <- make_command( - "bedtools merge", +# bedtools_merge ---- +bedtools_merge <- make_command( + "bedtools_merge", function( file1, ofile, @@ -74,7 +73,7 @@ `bedtools merge` = NULL ){ assert_string(`bedtools merge`, allow_empty = FALSE, allow_null = TRUE) - `BEDTools Merge`$new( + `BEDTools_Merge`$new( cmd = `bedtools merge`, ..., file1 = file1, @@ -84,8 +83,8 @@ } ) -`BEDTools Merge` <- R6Class( - "BEDTools Merge", +BEDTools_Merge <- R6Class( + "BEDTools_Merge", inherit = Command, private = list( alias = function() "bedtools merge", @@ -106,9 +105,9 @@ ) ) -# bedtools coverage ---- -`bedtools coverage` <- make_command( - "bedtools coverage", +# bedtools_coverage ---- +bedtools_coverage <- make_command( + "bedtools_coverage", function( file1, file2, @@ -117,7 +116,7 @@ `bedtools coverage` = NULL ){ assert_string(`bedtools coverage`, allow_empty = FALSE, allow_null = TRUE) - `BEDTools Coverage`$new( + BEDTools_Coverage$new( cmd = `bedtools coverage`, ..., file1 = file1, @@ -127,8 +126,8 @@ } ) -`BEDTools Coverage` <- R6Class( - "BEDTools Coverage", +BEDTools_Coverage <- R6Class( + "BEDTools_Coverage", inherit = Command, private = list( alias = function() "bedtools coverage", @@ -155,9 +154,9 @@ ) ) -# bedtools getfasta ---- -`bedtools getfasta` <- make_command( - "bedtools getfasta", +# bedtools_getfasta ---- +bedtools_getfasta <- make_command( + "bedtools_getfasta", function( file1, file2, @@ -166,7 +165,7 @@ `bedtools getfasta` = NULL ){ assert_string(`bedtools getfasta`, allow_empty = FALSE, allow_null = TRUE) - `BEDTools Getfasta`$new( + BEDTools_Getfasta$new( cmd = `bedtools getfasta`, ..., file1 = file1, @@ -176,8 +175,8 @@ } ) -`BEDTools Getfasta` <- R6Class( - "BEDTools Getfasta", +BEDTools_Getfasta <- R6Class( + "BEDTools_Getfasta", inherit = Command, private = list( alias = function() "bedtools getfasta", @@ -204,9 +203,9 @@ ) ) -# bedtools closest ---- -`bedtools closest` <- make_command( - "bedtools closest", +# bedtools_closest ---- +bedtools_closest <- make_command( + "bedtools_closest", function( file1, file2, @@ -215,7 +214,7 @@ `bedtools closest` = NULL ){ assert_string(`bedtools closest`, allow_empty = FALSE, allow_null = TRUE) - `BEDTools Closest`$new( + BEDTools_Closest$new( cmd = `bedtools closest`, ..., file1 = file1, @@ -225,8 +224,8 @@ } ) -`BEDTools Closest` <- R6Class( - "BEDTools Closest", +BEDTools_Closest <- R6Class( + "BEDTools_Closest", inherit = Command, private = list( alias = function() "bedtools closest", diff --git a/R/cmd-bedtools(2).R b/R/cmd-bedtools(2).R new file mode 100644 index 0000000..6096e0d --- /dev/null +++ b/R/cmd-bedtools(2).R @@ -0,0 +1,59 @@ +#' Run bedtools +#' +#' The `bedtools` is a powerful toolset for genome arithmetic. +#' @param subcmd Sub-Command of bedtools. Details see: `r rd_help("bedtools")`. +#' @param file1 Path to bed/gff(gtf)/vcf/bam(sam) file. +#' @param file2 Path to the second file, some commands require. +#' @param ... `r rd_dots("bedtools")`. +#' @param ofile Path to the output file. +#' @param bedtools `r rd_cmd("bedtools")`. +#' @seealso +#' - +#' +#' `r rd_seealso()` +#' @inherit exec return +#' @family command +#' @export +bedtools <- make_command( + "bedtools", + function( + subcmd = NULL, + file1, + ofile, + ..., + file2 = NULL, + bedtools = NULL + ) { + assert_string(subcmd, allow_empty = FALSE, allow_null = TRUE) + assert_string(bedtools, allow_empty = FALSE, allow_null = TRUE) + BEDTools$new( + cmd = bedtools, + ..., + subcmd = subcmd, + file1 = file1, + file2 = file2, + ofile = ofile + ) + } +) + +BEDTools <- R6Class( + "BEDTools", + inherit = Command, + private = list( + alias = function() "bedtools", + setup_help_params = function() "help", + combine_params = function(subcmd, file1, file2, ofile) { + c( + if (private$help) { + c(super$combine_params(), subcmd) + } else { + c(subcmd, super$combine_params()) + }, + arg0("-a", file1), + if (!is.null(file2)) arg0("-b", file2) else NULL, + arg0("-o", ofile), + ) + } + ) +) From 8320ab27391caa5892089bc75e99564bcefc4eb3 Mon Sep 17 00:00:00 2001 From: wbq <2982433346@qq.com> Date: Wed, 4 Jun 2025 16:30:20 +0800 Subject: [PATCH 04/10] init --- R/{cmd-bedtools(2).R => cmd-bedtools.R} | 0 R/{cmd-bedtools(1).R => cmd-bedtools_1.R} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename R/{cmd-bedtools(2).R => cmd-bedtools.R} (100%) rename R/{cmd-bedtools(1).R => cmd-bedtools_1.R} (100%) diff --git a/R/cmd-bedtools(2).R b/R/cmd-bedtools.R similarity index 100% rename from R/cmd-bedtools(2).R rename to R/cmd-bedtools.R diff --git a/R/cmd-bedtools(1).R b/R/cmd-bedtools_1.R similarity index 100% rename from R/cmd-bedtools(1).R rename to R/cmd-bedtools_1.R From f8a11e2977ebeda680373745d148defbc46e6900 Mon Sep 17 00:00:00 2001 From: wbq <2982433346@qq.com> Date: Thu, 5 Jun 2025 17:24:32 +0800 Subject: [PATCH 05/10] add document --- man/bedtools.Rd | 54 ++++++++++++++++++++++++++++++++ man/bedtools_intersect.Rd | 65 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 man/bedtools.Rd create mode 100644 man/bedtools_intersect.Rd diff --git a/man/bedtools.Rd b/man/bedtools.Rd new file mode 100644 index 0000000..f32ccca --- /dev/null +++ b/man/bedtools.Rd @@ -0,0 +1,54 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cmd-bedtools.R +\name{bedtools} +\alias{bedtools} +\title{Run bedtools} +\usage{ +bedtools(subcmd = NULL, file1, ofile, ..., file2 = NULL, bedtools = NULL) +} +\arguments{ +\item{subcmd}{Sub-Command of bedtools. Details see: \code{cmd_help(bedtools())}.} + +\item{file1}{Path to bed/gff(gtf)/vcf/bam(sam) file.} + +\item{ofile}{Path to the output file.} + +\item{...}{<\link[rlang:dyn-dots]{dynamic dots}> Additional arguments passed to \code{bedtools} command. Empty arguments are automatically trimmed. If a single argument, such as a file path, contains spaces, it must be quoted, for example using \code{\link[=shQuote]{shQuote()}}. Details see: \code{cmd_help(bedtools())}.} + +\item{file2}{Path to the second file, some commands require.} + +\item{bedtools}{A string of path to \code{bedtools} command.} +} +\value{ +A \code{command} object. +} +\description{ +The \code{bedtools} is a powerful toolset for genome arithmetic. +} +\seealso{ +\itemize{ +\item \url{https://github.com/arq5x/bedtools2/} +\item \code{\link[=cmd_wd]{cmd_wd()}}/\code{\link[=cmd_envvar]{cmd_envvar()}}/\code{\link[=cmd_envpath]{cmd_envpath()}}/\code{\link[=cmd_condaenv]{cmd_condaenv()}} +\item \code{\link[=cmd_on_start]{cmd_on_start()}}/\code{\link[=cmd_on_exit]{cmd_on_exit()}} +\item \code{\link[=cmd_on_succeed]{cmd_on_succeed()}}/\code{\link[=cmd_on_fail]{cmd_on_fail()}} +\item \code{\link[=cmd_parallel]{cmd_parallel()}} +} + +Other \code{commands}: +\code{\link{allele_counter}()}, +\code{\link{bedtools_intersect}()}, +\code{\link{cellranger}()}, +\code{\link{conda}()}, +\code{\link{fastp}()}, +\code{\link{fastq_pair}()}, +\code{\link{gistic2}()}, +\code{\link{kraken2}()}, +\code{\link{kraken_tools}()}, +\code{\link{perl}()}, +\code{\link{pyscenic}()}, +\code{\link{python}()}, +\code{\link{samtools}()}, +\code{\link{seqkit}()}, +\code{\link{trust4}()} +} +\concept{command} diff --git a/man/bedtools_intersect.Rd b/man/bedtools_intersect.Rd new file mode 100644 index 0000000..a7335c2 --- /dev/null +++ b/man/bedtools_intersect.Rd @@ -0,0 +1,65 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cmd-bedtools_1.R +\name{bedtools_intersect} +\alias{bedtools_intersect} +\title{Run bedtools} +\usage{ +bedtools_intersect(file1, file2, ofile, ..., `bedtools intersect` = NULL) +} +\arguments{ +\item{file1}{Path to bed/gff(gtf)/vcf/bam(sam) file.} + +\item{file2}{Path to the second file, some commands require.} + +\item{ofile}{Path to the output file.} + +\item{...}{\itemize{ +\item \verb{bedtools intersect}: <\link[rlang:dyn-dots]{dynamic dots}> Additional arguments passed to \verb{bedtools intersect} command. Empty arguments are automatically trimmed. If a single argument, such as a file path, contains spaces, it must be quoted, for example using \code{\link[=shQuote]{shQuote()}}. Details see: \verb{cmd_help(bedtools intersect())}. +\item \verb{bedtools merge}: <\link[rlang:dyn-dots]{dynamic dots}> Additional arguments passed to \verb{bedtools merge} command. Empty arguments are automatically trimmed. If a single argument, such as a file path, contains spaces, it must be quoted, for example using \code{\link[=shQuote]{shQuote()}}. Details see: \verb{cmd_help(bedtools merge())}. +\item \verb{bedtools coverage}: <\link[rlang:dyn-dots]{dynamic dots}> Additional arguments passed to \verb{bedtools coverage} command. Empty arguments are automatically trimmed. If a single argument, such as a file path, contains spaces, it must be quoted, for example using \code{\link[=shQuote]{shQuote()}}. Details see: \verb{cmd_help(bedtools coverage())}. +\item \verb{bedtools getfasta}: <\link[rlang:dyn-dots]{dynamic dots}> Additional arguments passed to \verb{bedtools getfasta} command. Empty arguments are automatically trimmed. If a single argument, such as a file path, contains spaces, it must be quoted, for example using \code{\link[=shQuote]{shQuote()}}. Details see: \verb{cmd_help(bedtools getfasta())}. +\item \verb{bedtools closest}: <\link[rlang:dyn-dots]{dynamic dots}> Additional arguments passed to \verb{bedtools closest} command. Empty arguments are automatically trimmed. If a single argument, such as a file path, contains spaces, it must be quoted, for example using \code{\link[=shQuote]{shQuote()}}. Details see: \verb{cmd_help(bedtools closest())}. +}} + +\item{-}{\verb{bedtools intersect}: A string of path to \verb{bedtools intersect} command. +\itemize{ +\item \verb{bedtools merge}: A string of path to \verb{bedtools merge} command. +\item \verb{bedtools coverage}: A string of path to \verb{bedtools coverage} command. +\item \verb{bedtools getfasta}: A string of path to \verb{bedtools getfasta} command. +\item \verb{bedtools closest}: A string of path to \verb{bedtools closest} command. +}} +} +\value{ +A \code{command} object. +} +\description{ +The \code{bedtools} is a powerful toolset for genome arithmetic, +which includes \code{intersect}, \code{merge}, \code{coverage}, \code{getfasta}, \code{closest}, etc. +} +\seealso{ +\itemize{ +\item \url{https://github.com/arq5x/bedtools2/} +\item \code{\link[=cmd_wd]{cmd_wd()}}/\code{\link[=cmd_envvar]{cmd_envvar()}}/\code{\link[=cmd_envpath]{cmd_envpath()}}/\code{\link[=cmd_condaenv]{cmd_condaenv()}} +\item \code{\link[=cmd_on_start]{cmd_on_start()}}/\code{\link[=cmd_on_exit]{cmd_on_exit()}} +\item \code{\link[=cmd_on_succeed]{cmd_on_succeed()}}/\code{\link[=cmd_on_fail]{cmd_on_fail()}} +\item \code{\link[=cmd_parallel]{cmd_parallel()}} +} + +Other \code{commands}: +\code{\link{allele_counter}()}, +\code{\link{bedtools}()}, +\code{\link{cellranger}()}, +\code{\link{conda}()}, +\code{\link{fastp}()}, +\code{\link{fastq_pair}()}, +\code{\link{gistic2}()}, +\code{\link{kraken2}()}, +\code{\link{kraken_tools}()}, +\code{\link{perl}()}, +\code{\link{pyscenic}()}, +\code{\link{python}()}, +\code{\link{samtools}()}, +\code{\link{seqkit}()}, +\code{\link{trust4}()} +} +\concept{command} From b53e36cafe59e69acd27b163eac31972f513aa69 Mon Sep 17 00:00:00 2001 From: wbq <2982433346@qq.com> Date: Sat, 7 Jun 2025 20:19:15 +0800 Subject: [PATCH 06/10] Made modifications --- NAMESPACE | 1 + R/cmd-bedtools.R | 41 ++---- R/cmd-bedtools_1.R | 254 ------------------------------------- blit.Rproj | 1 - man/allele_counter.Rd | 1 + man/bedtools.Rd | 10 +- man/bedtools_intersect.Rd | 65 ---------- man/cellranger.Rd | 1 + man/conda.Rd | 1 + man/exec.Rd | 1 + man/fastp.Rd | 1 + man/fastq_pair.Rd | 1 + man/gistic2.Rd | 1 + man/kraken2.Rd | 1 + man/kraken_tools.Rd | 1 + man/perl.Rd | 1 + man/pyscenic.Rd | 1 + man/python.Rd | 1 + man/samtools.Rd | 1 + man/seqkit.Rd | 1 + man/trust4.Rd | 1 + tests/testthat/test-exec.R | 5 + 22 files changed, 33 insertions(+), 359 deletions(-) delete mode 100644 R/cmd-bedtools_1.R delete mode 100644 man/bedtools_intersect.Rd diff --git a/NAMESPACE b/NAMESPACE index ed26bd9..8888fe2 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -7,6 +7,7 @@ export(appmamba) export(appmamba_rc) export(arg) export(arg0) +export(bedtools) export(cellranger) export(cmd_background) export(cmd_conda) diff --git a/R/cmd-bedtools.R b/R/cmd-bedtools.R index 6096e0d..d6ba1bd 100644 --- a/R/cmd-bedtools.R +++ b/R/cmd-bedtools.R @@ -2,12 +2,10 @@ #' #' The `bedtools` is a powerful toolset for genome arithmetic. #' @param subcmd Sub-Command of bedtools. Details see: `r rd_help("bedtools")`. -#' @param file1 Path to bed/gff(gtf)/vcf/bam(sam) file. -#' @param file2 Path to the second file, some commands require. #' @param ... `r rd_dots("bedtools")`. -#' @param ofile Path to the output file. #' @param bedtools `r rd_cmd("bedtools")`. #' @seealso +#' - #' - #' #' `r rd_seealso()` @@ -16,24 +14,10 @@ #' @export bedtools <- make_command( "bedtools", - function( - subcmd = NULL, - file1, - ofile, - ..., - file2 = NULL, - bedtools = NULL - ) { + function(subcmd = NULL, ..., bedtools = NULL) { assert_string(subcmd, allow_empty = FALSE, allow_null = TRUE) assert_string(bedtools, allow_empty = FALSE, allow_null = TRUE) - BEDTools$new( - cmd = bedtools, - ..., - subcmd = subcmd, - file1 = file1, - file2 = file2, - ofile = ofile - ) + BEDTools$new(cmd = bedtools, ..., subcmd = subcmd) } ) @@ -42,18 +26,13 @@ BEDTools <- R6Class( inherit = Command, private = list( alias = function() "bedtools", - setup_help_params = function() "help", - combine_params = function(subcmd, file1, file2, ofile) { - c( - if (private$help) { - c(super$combine_params(), subcmd) - } else { - c(subcmd, super$combine_params()) - }, - arg0("-a", file1), - if (!is.null(file2)) arg0("-b", file2) else NULL, - arg0("-o", ofile), - ) + setup_help_params = function() "--help", + combine_params = function(subcmd) { + if (private$help) { + c(super$combine_params(), subcmd) + } else { + c(subcmd, super$combine_params()) + } } ) ) diff --git a/R/cmd-bedtools_1.R b/R/cmd-bedtools_1.R deleted file mode 100644 index a96d6aa..0000000 --- a/R/cmd-bedtools_1.R +++ /dev/null @@ -1,254 +0,0 @@ -#' Run bedtools -#' -#' The `bedtools` is a powerful toolset for genome arithmetic, -#' which includes `intersect`, `merge`, `coverage`, `getfasta`, `closest`, etc. -#' @param file1 Path to bed/gff(gtf)/vcf/bam(sam) file. -#' @param file2 Path to the second file, some commands require. -#' @param ... -#' - `bedtools intersect`: `r rd_dots("bedtools intersect")`. -#' - `bedtools merge`: `r rd_dots("bedtools merge")`. -#' - `bedtools coverage`: `r rd_dots("bedtools coverage")`. -#' - `bedtools getfasta`: `r rd_dots("bedtools getfasta")`. -#' - `bedtools closest`: `r rd_dots("bedtools closest")`. -#' @param ofile Path to the output file. -#' @param -#' - `bedtools intersect`: `r rd_cmd("bedtools intersect")`. -#' - `bedtools merge`: `r rd_cmd("bedtools merge")`. -#' - `bedtools coverage`: `r rd_cmd("bedtools coverage")`. -#' - `bedtools getfasta`: `r rd_cmd("bedtools getfasta")`. -#' - `bedtools closest`: `r rd_cmd("bedtools closest")`. -#' @seealso -#' - -#' -#' `r rd_seealso()` -#' @inherit exec return -#' @family command -#' @export -# bedtools_intersect ---- -bedtools_intersect <- make_command( - "bedtools_intersect", - function( - file1, - file2, - ofile, - ..., - `bedtools intersect` = NULL - ){ - assert_string(`bedtools intersect`, allow_empty = FALSE, allow_null = TRUE) - BEDTools_Intersect$new( - cmd = `bedtools intersect`, - ..., - file1 = file1, - file2 = file2, - ofile = ofile, - ) - } -) - -BEDTools_Intersect <- R6Class( - "BEDTools_Intersect", - inherit = Command, - private = list( - alias = function() "bedtools intersect", - setup_help_params = function() "--help", - setup_command_params = function(file1, file2, ofile){ - c( - arg0("-a", file1), - arg0("-b", file2), - arg0("-wa"), - arg0("-o", ofile), - ) - } - ) -) - -# bedtools_merge ---- -bedtools_merge <- make_command( - "bedtools_merge", - function( - file1, - ofile, - ..., - dist = NULL, - `bedtools merge` = NULL - ){ - assert_string(`bedtools merge`, allow_empty = FALSE, allow_null = TRUE) - `BEDTools_Merge`$new( - cmd = `bedtools merge`, - ..., - file1 = file1, - dist = dist, - ofile = ofile, - ) - } -) - -BEDTools_Merge <- R6Class( - "BEDTools_Merge", - inherit = Command, - private = list( - alias = function() "bedtools merge", - setup_help_params = function() "--help", - setup_command_params = function(file1, dist, ofile){ - c( - if (endsWith(file1, ".bed")|endsWith(file1, ".gff")){ - arg0("-i", file1) - } else{ - cli::cli_abort( - "{.arg file1} must be BED/GFF" - ) - }, - if (!is.null(dist)) arg0("-d", dist) else NULL, - arg0("-o", ofile), - ) - } - ) -) - -# bedtools_coverage ---- -bedtools_coverage <- make_command( - "bedtools_coverage", - function( - file1, - file2, - ofile, - ..., - `bedtools coverage` = NULL - ){ - assert_string(`bedtools coverage`, allow_empty = FALSE, allow_null = TRUE) - BEDTools_Coverage$new( - cmd = `bedtools coverage`, - ..., - file1 = file1, - file2 = file2, - ofile = ofile, - ) - } -) - -BEDTools_Coverage <- R6Class( - "BEDTools_Coverage", - inherit = Command, - private = list( - alias = function() "bedtools coverage", - setup_help_params = function() "--help", - setup_command_params = function(file1, file2, ofile){ - c( - if (endsWith(file1, ".bed")|endsWith(file1, ".gff")){ - arg0("-a", file1) - } else{ - cli::cli_abort( - "{.arg file1} must be BED/GFF" - ) - }, - if (endsWith(file2, ".bed")|endsWith(file2, ".gff")|endsWith(file2, ".bam")){ - arg0("-b", file2) - } else{ - cli::cli_abort( - "{.arg file2} must be BED/GFF/BAM" - ) - }, - arg0("-o", ofile), - ) - } - ) -) - -# bedtools_getfasta ---- -bedtools_getfasta <- make_command( - "bedtools_getfasta", - function( - file1, - file2, - ofile, - ..., - `bedtools getfasta` = NULL - ){ - assert_string(`bedtools getfasta`, allow_empty = FALSE, allow_null = TRUE) - BEDTools_Getfasta$new( - cmd = `bedtools getfasta`, - ..., - file1 = file1, - file2 = file2, - ofile = ofile, - ) - } -) - -BEDTools_Getfasta <- R6Class( - "BEDTools_Getfasta", - inherit = Command, - private = list( - alias = function() "bedtools getfasta", - setup_help_params = function() "--help", - setup_command_params = function(file1, file2, ofile){ - c( - if (endsWith(file1, ".fa")){ - arg0("-fi", file1) - } else{ - cli::cli_abort( - "{.arg file1} must be FASTA" - ) - }, - if (endsWith(file2, ".bed")|endsWith(file2, ".gff")){ - arg0("-bed", file2) - } else{ - cli::cli_abort( - "{.arg file2} must be BED/GFF" - ) - }, - arg0("-fo", ofile), - ) - } - ) -) - -# bedtools_closest ---- -bedtools_closest <- make_command( - "bedtools_closest", - function( - file1, - file2, - ofile, - ..., - `bedtools closest` = NULL - ){ - assert_string(`bedtools closest`, allow_empty = FALSE, allow_null = TRUE) - BEDTools_Closest$new( - cmd = `bedtools closest`, - ..., - file1 = file1, - file2 = file2, - ofile = ofile, - ) - } -) - -BEDTools_Closest <- R6Class( - "BEDTools_Closest", - inherit = Command, - private = list( - alias = function() "bedtools closest", - setup_help_params = function() "--help", - setup_command_params = function(file1, file2, ofile){ - c( - if (endsWith(file1, ".bed")|endsWith(file1, ".gff")|endsWith(file1, ".vcf")){ - arg0("-a", file1) - } else{ - cli::cli_abort( - "{.arg file1} must be BED/GFF/VCF" - ) - }, - if (endsWith(file2, ".bed")|endsWith(file2, ".gff")|endsWith(file2, ".vcf")){ - arg0("-b", file2) - } else{ - cli::cli_abort( - "{.arg file2} must be BED/GFF/VCF" - ) - }, - args("-D"), - arg0("-o", ofile), - ) - } - ) -) diff --git a/blit.Rproj b/blit.Rproj index 268608d..69fafd4 100644 --- a/blit.Rproj +++ b/blit.Rproj @@ -1,5 +1,4 @@ Version: 1.0 -ProjectId: 8959c0d9-c76c-4fa8-a50c-0dae5e78ec5f RestoreWorkspace: No SaveWorkspace: No diff --git a/man/allele_counter.Rd b/man/allele_counter.Rd index af89e9b..7592dc9 100644 --- a/man/allele_counter.Rd +++ b/man/allele_counter.Rd @@ -43,6 +43,7 @@ between some other projects, specifically \code{AscatNGS} and \code{Battenberg}. } Other \code{commands}: +\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/bedtools.Rd b/man/bedtools.Rd index f32ccca..dcf66a9 100644 --- a/man/bedtools.Rd +++ b/man/bedtools.Rd @@ -4,19 +4,13 @@ \alias{bedtools} \title{Run bedtools} \usage{ -bedtools(subcmd = NULL, file1, ofile, ..., file2 = NULL, bedtools = NULL) +bedtools(subcmd = NULL, ..., bedtools = NULL) } \arguments{ \item{subcmd}{Sub-Command of bedtools. Details see: \code{cmd_help(bedtools())}.} -\item{file1}{Path to bed/gff(gtf)/vcf/bam(sam) file.} - -\item{ofile}{Path to the output file.} - \item{...}{<\link[rlang:dyn-dots]{dynamic dots}> Additional arguments passed to \code{bedtools} command. Empty arguments are automatically trimmed. If a single argument, such as a file path, contains spaces, it must be quoted, for example using \code{\link[=shQuote]{shQuote()}}. Details see: \code{cmd_help(bedtools())}.} -\item{file2}{Path to the second file, some commands require.} - \item{bedtools}{A string of path to \code{bedtools} command.} } \value{ @@ -27,6 +21,7 @@ The \code{bedtools} is a powerful toolset for genome arithmetic. } \seealso{ \itemize{ +\item \url{http://bedtools.readthedocs.io/} \item \url{https://github.com/arq5x/bedtools2/} \item \code{\link[=cmd_wd]{cmd_wd()}}/\code{\link[=cmd_envvar]{cmd_envvar()}}/\code{\link[=cmd_envpath]{cmd_envpath()}}/\code{\link[=cmd_condaenv]{cmd_condaenv()}} \item \code{\link[=cmd_on_start]{cmd_on_start()}}/\code{\link[=cmd_on_exit]{cmd_on_exit()}} @@ -36,7 +31,6 @@ The \code{bedtools} is a powerful toolset for genome arithmetic. Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bedtools_intersect}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/bedtools_intersect.Rd b/man/bedtools_intersect.Rd deleted file mode 100644 index a7335c2..0000000 --- a/man/bedtools_intersect.Rd +++ /dev/null @@ -1,65 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/cmd-bedtools_1.R -\name{bedtools_intersect} -\alias{bedtools_intersect} -\title{Run bedtools} -\usage{ -bedtools_intersect(file1, file2, ofile, ..., `bedtools intersect` = NULL) -} -\arguments{ -\item{file1}{Path to bed/gff(gtf)/vcf/bam(sam) file.} - -\item{file2}{Path to the second file, some commands require.} - -\item{ofile}{Path to the output file.} - -\item{...}{\itemize{ -\item \verb{bedtools intersect}: <\link[rlang:dyn-dots]{dynamic dots}> Additional arguments passed to \verb{bedtools intersect} command. Empty arguments are automatically trimmed. If a single argument, such as a file path, contains spaces, it must be quoted, for example using \code{\link[=shQuote]{shQuote()}}. Details see: \verb{cmd_help(bedtools intersect())}. -\item \verb{bedtools merge}: <\link[rlang:dyn-dots]{dynamic dots}> Additional arguments passed to \verb{bedtools merge} command. Empty arguments are automatically trimmed. If a single argument, such as a file path, contains spaces, it must be quoted, for example using \code{\link[=shQuote]{shQuote()}}. Details see: \verb{cmd_help(bedtools merge())}. -\item \verb{bedtools coverage}: <\link[rlang:dyn-dots]{dynamic dots}> Additional arguments passed to \verb{bedtools coverage} command. Empty arguments are automatically trimmed. If a single argument, such as a file path, contains spaces, it must be quoted, for example using \code{\link[=shQuote]{shQuote()}}. Details see: \verb{cmd_help(bedtools coverage())}. -\item \verb{bedtools getfasta}: <\link[rlang:dyn-dots]{dynamic dots}> Additional arguments passed to \verb{bedtools getfasta} command. Empty arguments are automatically trimmed. If a single argument, such as a file path, contains spaces, it must be quoted, for example using \code{\link[=shQuote]{shQuote()}}. Details see: \verb{cmd_help(bedtools getfasta())}. -\item \verb{bedtools closest}: <\link[rlang:dyn-dots]{dynamic dots}> Additional arguments passed to \verb{bedtools closest} command. Empty arguments are automatically trimmed. If a single argument, such as a file path, contains spaces, it must be quoted, for example using \code{\link[=shQuote]{shQuote()}}. Details see: \verb{cmd_help(bedtools closest())}. -}} - -\item{-}{\verb{bedtools intersect}: A string of path to \verb{bedtools intersect} command. -\itemize{ -\item \verb{bedtools merge}: A string of path to \verb{bedtools merge} command. -\item \verb{bedtools coverage}: A string of path to \verb{bedtools coverage} command. -\item \verb{bedtools getfasta}: A string of path to \verb{bedtools getfasta} command. -\item \verb{bedtools closest}: A string of path to \verb{bedtools closest} command. -}} -} -\value{ -A \code{command} object. -} -\description{ -The \code{bedtools} is a powerful toolset for genome arithmetic, -which includes \code{intersect}, \code{merge}, \code{coverage}, \code{getfasta}, \code{closest}, etc. -} -\seealso{ -\itemize{ -\item \url{https://github.com/arq5x/bedtools2/} -\item \code{\link[=cmd_wd]{cmd_wd()}}/\code{\link[=cmd_envvar]{cmd_envvar()}}/\code{\link[=cmd_envpath]{cmd_envpath()}}/\code{\link[=cmd_condaenv]{cmd_condaenv()}} -\item \code{\link[=cmd_on_start]{cmd_on_start()}}/\code{\link[=cmd_on_exit]{cmd_on_exit()}} -\item \code{\link[=cmd_on_succeed]{cmd_on_succeed()}}/\code{\link[=cmd_on_fail]{cmd_on_fail()}} -\item \code{\link[=cmd_parallel]{cmd_parallel()}} -} - -Other \code{commands}: -\code{\link{allele_counter}()}, -\code{\link{bedtools}()}, -\code{\link{cellranger}()}, -\code{\link{conda}()}, -\code{\link{fastp}()}, -\code{\link{fastq_pair}()}, -\code{\link{gistic2}()}, -\code{\link{kraken2}()}, -\code{\link{kraken_tools}()}, -\code{\link{perl}()}, -\code{\link{pyscenic}()}, -\code{\link{python}()}, -\code{\link{samtools}()}, -\code{\link{seqkit}()}, -\code{\link{trust4}()} -} -\concept{command} diff --git a/man/cellranger.Rd b/man/cellranger.Rd index c6132c1..a147004 100644 --- a/man/cellranger.Rd +++ b/man/cellranger.Rd @@ -48,6 +48,7 @@ cellranger( Other \code{commands}: \code{\link{allele_counter}()}, +\code{\link{bedtools}()}, \code{\link{conda}()}, \code{\link{fastp}()}, \code{\link{fastq_pair}()}, diff --git a/man/conda.Rd b/man/conda.Rd index 876b7ed..165cd39 100644 --- a/man/conda.Rd +++ b/man/conda.Rd @@ -29,6 +29,7 @@ Run conda Other \code{commands}: \code{\link{allele_counter}()}, +\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{fastp}()}, \code{\link{fastq_pair}()}, diff --git a/man/exec.Rd b/man/exec.Rd index 64e7f40..8e0b526 100644 --- a/man/exec.Rd +++ b/man/exec.Rd @@ -21,6 +21,7 @@ Invoke a System Command \itemize{ \item \code{\link[=allele_counter]{allele_counter()}} +\item \code{\link[=bedtools]{bedtools()}} \item \code{\link[=cellranger]{cellranger()}} \item \code{\link[=conda]{conda()}} \item \code{\link[=fastp]{fastp()}} diff --git a/man/fastp.Rd b/man/fastp.Rd index 1be6075..765e0ef 100644 --- a/man/fastp.Rd +++ b/man/fastp.Rd @@ -33,6 +33,7 @@ and quality control for FastQ data. Other \code{commands}: \code{\link{allele_counter}()}, +\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastq_pair}()}, diff --git a/man/fastq_pair.Rd b/man/fastq_pair.Rd index f432d1b..010a540 100644 --- a/man/fastq_pair.Rd +++ b/man/fastq_pair.Rd @@ -54,6 +54,7 @@ they demand paired end files have the same number of reads. Other \code{commands}: \code{\link{allele_counter}()}, +\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/gistic2.Rd b/man/gistic2.Rd index 487a27e..7346991 100644 --- a/man/gistic2.Rd +++ b/man/gistic2.Rd @@ -51,6 +51,7 @@ deletion, and it lists genes found in each "wide peak" region. Other \code{commands}: \code{\link{allele_counter}()}, +\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/kraken2.Rd b/man/kraken2.Rd index b4b9d49..b44a199 100644 --- a/man/kraken2.Rd +++ b/man/kraken2.Rd @@ -57,6 +57,7 @@ given k-mer. Other \code{commands}: \code{\link{allele_counter}()}, +\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/kraken_tools.Rd b/man/kraken_tools.Rd index cf873d6..17ee478 100644 --- a/man/kraken_tools.Rd +++ b/man/kraken_tools.Rd @@ -33,6 +33,7 @@ analysis of Kraken results. Other \code{commands}: \code{\link{allele_counter}()}, +\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/perl.Rd b/man/perl.Rd index 89eed70..0babc4f 100644 --- a/man/perl.Rd +++ b/man/perl.Rd @@ -30,6 +30,7 @@ years of development. Other \code{commands}: \code{\link{allele_counter}()}, +\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/pyscenic.Rd b/man/pyscenic.Rd index db6b9dd..df7e0e9 100644 --- a/man/pyscenic.Rd +++ b/man/pyscenic.Rd @@ -30,6 +30,7 @@ Run pyscenic Other \code{commands}: \code{\link{allele_counter}()}, +\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/python.Rd b/man/python.Rd index 7b5c513..8bbb5af 100644 --- a/man/python.Rd +++ b/man/python.Rd @@ -30,6 +30,7 @@ systems more effectively. Other \code{commands}: \code{\link{allele_counter}()}, +\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/samtools.Rd b/man/samtools.Rd index ed59740..ab889f6 100644 --- a/man/samtools.Rd +++ b/man/samtools.Rd @@ -32,6 +32,7 @@ systems more effectively. Other \code{commands}: \code{\link{allele_counter}()}, +\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/seqkit.Rd b/man/seqkit.Rd index 6922f84..a6303b7 100644 --- a/man/seqkit.Rd +++ b/man/seqkit.Rd @@ -30,6 +30,7 @@ Run seqkit Other \code{commands}: \code{\link{allele_counter}()}, +\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/trust4.Rd b/man/trust4.Rd index ae887a7..c8cc737 100644 --- a/man/trust4.Rd +++ b/man/trust4.Rd @@ -85,6 +85,7 @@ data Other \code{commands}: \code{\link{allele_counter}()}, +\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/tests/testthat/test-exec.R b/tests/testthat/test-exec.R index acda33e..d0745e8 100644 --- a/tests/testthat/test-exec.R +++ b/tests/testthat/test-exec.R @@ -3,6 +3,11 @@ testthat::test_that("`allele_counter()` works as expected", { allele_counter() |> cmd_help() }) +testthat::test_that("`bedtools()` works as expected", { + testthat::skip_if_not(nzchar(Sys.which("bedtools"))) + bedtools() |> cmd_help() +}) + testthat::test_that("`cellranger()` works as expected", { testthat::skip_if_not(nzchar(Sys.which("cellranger"))) cellranger() |> cmd_help() From 1be2782d26de419068b3f549c7cb6d53a8de7f7b Mon Sep 17 00:00:00 2001 From: wbq <2982433346@qq.com> Date: Sat, 7 Jun 2025 20:30:31 +0800 Subject: [PATCH 07/10] clean blit.Rproj --- blit.Rproj | 5 ----- 1 file changed, 5 deletions(-) diff --git a/blit.Rproj b/blit.Rproj index 69fafd4..aaa62a5 100644 --- a/blit.Rproj +++ b/blit.Rproj @@ -5,13 +5,8 @@ SaveWorkspace: No AlwaysSaveHistory: Default EnableCodeIndexing: Yes -UseSpacesForTab: Yes -NumSpacesForTab: 2 Encoding: UTF-8 -RnwWeave: Sweave -LaTeX: pdfLaTeX - AutoAppendNewline: Yes StripTrailingWhitespace: Yes LineEndingConversion: Posix From 94b49eec169da206735ece59005e538636a1afb7 Mon Sep 17 00:00:00 2001 From: wbq <2982433346@qq.com> Date: Sat, 7 Jun 2025 20:43:32 +0800 Subject: [PATCH 08/10] clean man --- man/allele_counter.Rd | 1 - man/cellranger.Rd | 1 - man/conda.Rd | 1 - man/exec.Rd | 1 - man/fastp.Rd | 1 - man/fastq_pair.Rd | 1 - man/gistic2.Rd | 1 - man/kraken2.Rd | 1 - man/kraken_tools.Rd | 1 - man/perl.Rd | 1 - man/pyscenic.Rd | 1 - man/python.Rd | 1 - man/samtools.Rd | 1 - man/seqkit.Rd | 1 - man/trust4.Rd | 1 - 15 files changed, 15 deletions(-) diff --git a/man/allele_counter.Rd b/man/allele_counter.Rd index 7592dc9..af89e9b 100644 --- a/man/allele_counter.Rd +++ b/man/allele_counter.Rd @@ -43,7 +43,6 @@ between some other projects, specifically \code{AscatNGS} and \code{Battenberg}. } Other \code{commands}: -\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/cellranger.Rd b/man/cellranger.Rd index a147004..c6132c1 100644 --- a/man/cellranger.Rd +++ b/man/cellranger.Rd @@ -48,7 +48,6 @@ cellranger( Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bedtools}()}, \code{\link{conda}()}, \code{\link{fastp}()}, \code{\link{fastq_pair}()}, diff --git a/man/conda.Rd b/man/conda.Rd index 165cd39..876b7ed 100644 --- a/man/conda.Rd +++ b/man/conda.Rd @@ -29,7 +29,6 @@ Run conda Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{fastp}()}, \code{\link{fastq_pair}()}, diff --git a/man/exec.Rd b/man/exec.Rd index 8e0b526..64e7f40 100644 --- a/man/exec.Rd +++ b/man/exec.Rd @@ -21,7 +21,6 @@ Invoke a System Command \itemize{ \item \code{\link[=allele_counter]{allele_counter()}} -\item \code{\link[=bedtools]{bedtools()}} \item \code{\link[=cellranger]{cellranger()}} \item \code{\link[=conda]{conda()}} \item \code{\link[=fastp]{fastp()}} diff --git a/man/fastp.Rd b/man/fastp.Rd index 765e0ef..1be6075 100644 --- a/man/fastp.Rd +++ b/man/fastp.Rd @@ -33,7 +33,6 @@ and quality control for FastQ data. Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastq_pair}()}, diff --git a/man/fastq_pair.Rd b/man/fastq_pair.Rd index 010a540..f432d1b 100644 --- a/man/fastq_pair.Rd +++ b/man/fastq_pair.Rd @@ -54,7 +54,6 @@ they demand paired end files have the same number of reads. Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/gistic2.Rd b/man/gistic2.Rd index 7346991..487a27e 100644 --- a/man/gistic2.Rd +++ b/man/gistic2.Rd @@ -51,7 +51,6 @@ deletion, and it lists genes found in each "wide peak" region. Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/kraken2.Rd b/man/kraken2.Rd index b44a199..b4b9d49 100644 --- a/man/kraken2.Rd +++ b/man/kraken2.Rd @@ -57,7 +57,6 @@ given k-mer. Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/kraken_tools.Rd b/man/kraken_tools.Rd index 17ee478..cf873d6 100644 --- a/man/kraken_tools.Rd +++ b/man/kraken_tools.Rd @@ -33,7 +33,6 @@ analysis of Kraken results. Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/perl.Rd b/man/perl.Rd index 0babc4f..89eed70 100644 --- a/man/perl.Rd +++ b/man/perl.Rd @@ -30,7 +30,6 @@ years of development. Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/pyscenic.Rd b/man/pyscenic.Rd index df7e0e9..db6b9dd 100644 --- a/man/pyscenic.Rd +++ b/man/pyscenic.Rd @@ -30,7 +30,6 @@ Run pyscenic Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/python.Rd b/man/python.Rd index 8bbb5af..7b5c513 100644 --- a/man/python.Rd +++ b/man/python.Rd @@ -30,7 +30,6 @@ systems more effectively. Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/samtools.Rd b/man/samtools.Rd index ab889f6..ed59740 100644 --- a/man/samtools.Rd +++ b/man/samtools.Rd @@ -32,7 +32,6 @@ systems more effectively. Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/seqkit.Rd b/man/seqkit.Rd index a6303b7..6922f84 100644 --- a/man/seqkit.Rd +++ b/man/seqkit.Rd @@ -30,7 +30,6 @@ Run seqkit Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/trust4.Rd b/man/trust4.Rd index c8cc737..ae887a7 100644 --- a/man/trust4.Rd +++ b/man/trust4.Rd @@ -85,7 +85,6 @@ data Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, From ec0b97a8697222ce641c2d2b6a82600ceee3460d Mon Sep 17 00:00:00 2001 From: Yunuuuu Date: Fri, 19 Sep 2025 20:22:28 +0800 Subject: [PATCH 09/10] docs: update and regenerate package documentation with roxygen2 --- NAMESPACE | 2 +- man/allele_counter.Rd | 3 ++- man/bcftools.Rd | 5 ++++- man/bedtools.Rd | 6 +++++- man/bowtie2.Rd | 6 +++++- man/cellranger.Rd | 3 ++- man/conda.Rd | 3 ++- man/exec.Rd | 3 ++- man/fastp.Rd | 3 ++- man/fastq_pair.Rd | 3 ++- man/gistic2.Rd | 3 ++- man/kraken2.Rd | 3 ++- man/kraken_tools.Rd | 3 ++- man/perl.Rd | 3 ++- man/pyscenic.Rd | 3 ++- man/python.Rd | 3 ++- man/samtools.Rd | 3 ++- man/seqkit.Rd | 3 ++- man/snpEff.Rd | 5 ++++- man/trust4.Rd | 3 ++- man/varscan.Rd | 4 ++++ 21 files changed, 53 insertions(+), 20 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 3b51689..8913399 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -7,9 +7,9 @@ export(appmamba) export(appmamba_rc) export(arg) export(arg0) +export(bcftools) export(bedtools) export(bowtie2) -export(bcftools) export(cellranger) export(cmd_background) export(cmd_conda) diff --git a/man/allele_counter.Rd b/man/allele_counter.Rd index ace7f44..cfa696b 100644 --- a/man/allele_counter.Rd +++ b/man/allele_counter.Rd @@ -43,8 +43,9 @@ between some other projects, specifically \code{AscatNGS} and \code{Battenberg}. } Other \code{commands}: -\code{\link{bowtie2}()}, \code{\link{bcftools}()}, +\code{\link{bedtools}()}, +\code{\link{bowtie2}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/bcftools.Rd b/man/bcftools.Rd index f117b3b..f884a5e 100644 --- a/man/bcftools.Rd +++ b/man/bcftools.Rd @@ -34,6 +34,8 @@ All commands work transparently with both VCFs and BCFs, both uncompressed and B Other \code{commands}: \code{\link{allele_counter}()}, +\code{\link{bedtools}()}, +\code{\link{bowtie2}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, @@ -47,6 +49,7 @@ Other \code{commands}: \code{\link{samtools}()}, \code{\link{seqkit}()}, \code{\link{snpEff}()}, -\code{\link{trust4}()} +\code{\link{trust4}()}, +\code{\link{varscan}()} } \concept{command} diff --git a/man/bedtools.Rd b/man/bedtools.Rd index dcf66a9..869b61c 100644 --- a/man/bedtools.Rd +++ b/man/bedtools.Rd @@ -31,6 +31,8 @@ The \code{bedtools} is a powerful toolset for genome arithmetic. Other \code{commands}: \code{\link{allele_counter}()}, +\code{\link{bcftools}()}, +\code{\link{bowtie2}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, @@ -43,6 +45,8 @@ Other \code{commands}: \code{\link{python}()}, \code{\link{samtools}()}, \code{\link{seqkit}()}, -\code{\link{trust4}()} +\code{\link{snpEff}()}, +\code{\link{trust4}()}, +\code{\link{varscan}()} } \concept{command} diff --git a/man/bowtie2.Rd b/man/bowtie2.Rd index 6d0563b..361c175 100644 --- a/man/bowtie2.Rd +++ b/man/bowtie2.Rd @@ -40,6 +40,8 @@ Bowtie 2 supports gapped, local, and paired-end alignment modes. Other \code{commands}: \code{\link{allele_counter}()}, +\code{\link{bcftools}()}, +\code{\link{bedtools}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, @@ -52,6 +54,8 @@ Other \code{commands}: \code{\link{python}()}, \code{\link{samtools}()}, \code{\link{seqkit}()}, -\code{\link{trust4}()} +\code{\link{snpEff}()}, +\code{\link{trust4}()}, +\code{\link{varscan}()} } \concept{command} diff --git a/man/cellranger.Rd b/man/cellranger.Rd index 576a6b1..f52c025 100644 --- a/man/cellranger.Rd +++ b/man/cellranger.Rd @@ -48,8 +48,9 @@ cellranger( Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bowtie2}()}, \code{\link{bcftools}()}, +\code{\link{bedtools}()}, +\code{\link{bowtie2}()}, \code{\link{conda}()}, \code{\link{fastp}()}, \code{\link{fastq_pair}()}, diff --git a/man/conda.Rd b/man/conda.Rd index 9efe8f8..9fe0555 100644 --- a/man/conda.Rd +++ b/man/conda.Rd @@ -29,8 +29,9 @@ Run conda Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bowtie2}()}, \code{\link{bcftools}()}, +\code{\link{bedtools}()}, +\code{\link{bowtie2}()}, \code{\link{cellranger}()}, \code{\link{fastp}()}, \code{\link{fastq_pair}()}, diff --git a/man/exec.Rd b/man/exec.Rd index 8cf83ce..31fb607 100644 --- a/man/exec.Rd +++ b/man/exec.Rd @@ -21,8 +21,9 @@ Invoke a System Command \itemize{ \item \code{\link[=allele_counter]{allele_counter()}} -\item \code{\link[=bowtie2]{bowtie2()}} \item \code{\link[=bcftools]{bcftools()}} +\item \code{\link[=bedtools]{bedtools()}} +\item \code{\link[=bowtie2]{bowtie2()}} \item \code{\link[=cellranger]{cellranger()}} \item \code{\link[=conda]{conda()}} \item \code{\link[=fastp]{fastp()}} diff --git a/man/fastp.Rd b/man/fastp.Rd index 46225c3..ec3e879 100644 --- a/man/fastp.Rd +++ b/man/fastp.Rd @@ -33,8 +33,9 @@ and quality control for FastQ data. Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bowtie2}()}, \code{\link{bcftools}()}, +\code{\link{bedtools}()}, +\code{\link{bowtie2}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastq_pair}()}, diff --git a/man/fastq_pair.Rd b/man/fastq_pair.Rd index 48dcb9b..3764bc6 100644 --- a/man/fastq_pair.Rd +++ b/man/fastq_pair.Rd @@ -54,8 +54,9 @@ they demand paired end files have the same number of reads. Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bowtie2}()}, \code{\link{bcftools}()}, +\code{\link{bedtools}()}, +\code{\link{bowtie2}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/gistic2.Rd b/man/gistic2.Rd index e800cef..42e9a6a 100644 --- a/man/gistic2.Rd +++ b/man/gistic2.Rd @@ -51,8 +51,9 @@ deletion, and it lists genes found in each "wide peak" region. Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bowtie2}()}, \code{\link{bcftools}()}, +\code{\link{bedtools}()}, +\code{\link{bowtie2}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/kraken2.Rd b/man/kraken2.Rd index 49efc23..0a1adc0 100644 --- a/man/kraken2.Rd +++ b/man/kraken2.Rd @@ -57,8 +57,9 @@ given k-mer. Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bowtie2}()}, \code{\link{bcftools}()}, +\code{\link{bedtools}()}, +\code{\link{bowtie2}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/kraken_tools.Rd b/man/kraken_tools.Rd index 3e6886c..fece02b 100644 --- a/man/kraken_tools.Rd +++ b/man/kraken_tools.Rd @@ -33,8 +33,9 @@ analysis of Kraken results. Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bowtie2}()}, \code{\link{bcftools}()}, +\code{\link{bedtools}()}, +\code{\link{bowtie2}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/perl.Rd b/man/perl.Rd index bf68f86..c2b8c8e 100644 --- a/man/perl.Rd +++ b/man/perl.Rd @@ -30,8 +30,9 @@ years of development. Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bowtie2}()}, \code{\link{bcftools}()}, +\code{\link{bedtools}()}, +\code{\link{bowtie2}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/pyscenic.Rd b/man/pyscenic.Rd index 5e2d739..63f20fc 100644 --- a/man/pyscenic.Rd +++ b/man/pyscenic.Rd @@ -30,8 +30,9 @@ Run pyscenic Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bowtie2}()}, \code{\link{bcftools}()}, +\code{\link{bedtools}()}, +\code{\link{bowtie2}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/python.Rd b/man/python.Rd index 7e99e12..d4e32a3 100644 --- a/man/python.Rd +++ b/man/python.Rd @@ -30,8 +30,9 @@ systems more effectively. Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bowtie2}()}, \code{\link{bcftools}()}, +\code{\link{bedtools}()}, +\code{\link{bowtie2}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/samtools.Rd b/man/samtools.Rd index e5db7e1..5b1c133 100644 --- a/man/samtools.Rd +++ b/man/samtools.Rd @@ -32,8 +32,9 @@ systems more effectively. Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bowtie2}()}, \code{\link{bcftools}()}, +\code{\link{bedtools}()}, +\code{\link{bowtie2}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/seqkit.Rd b/man/seqkit.Rd index 2685649..fcfe722 100644 --- a/man/seqkit.Rd +++ b/man/seqkit.Rd @@ -30,8 +30,9 @@ Run seqkit Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bowtie2}()}, \code{\link{bcftools}()}, +\code{\link{bedtools}()}, +\code{\link{bowtie2}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/snpEff.Rd b/man/snpEff.Rd index 6c6a500..79b611a 100644 --- a/man/snpEff.Rd +++ b/man/snpEff.Rd @@ -33,6 +33,8 @@ It annotates and predicts the effects of genetic variants on genes and proteins Other \code{commands}: \code{\link{allele_counter}()}, \code{\link{bcftools}()}, +\code{\link{bedtools}()}, +\code{\link{bowtie2}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, @@ -45,6 +47,7 @@ Other \code{commands}: \code{\link{python}()}, \code{\link{samtools}()}, \code{\link{seqkit}()}, -\code{\link{trust4}()} +\code{\link{trust4}()}, +\code{\link{varscan}()} } \concept{command} diff --git a/man/trust4.Rd b/man/trust4.Rd index 62f2155..cdcc7bd 100644 --- a/man/trust4.Rd +++ b/man/trust4.Rd @@ -85,8 +85,9 @@ data Other \code{commands}: \code{\link{allele_counter}()}, -\code{\link{bowtie2}()}, \code{\link{bcftools}()}, +\code{\link{bedtools}()}, +\code{\link{bowtie2}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, diff --git a/man/varscan.Rd b/man/varscan.Rd index 791ea29..03ae011 100644 --- a/man/varscan.Rd +++ b/man/varscan.Rd @@ -32,6 +32,9 @@ developed at the Genome Institute at Washington University to detect variants in Other \code{commands}: \code{\link{allele_counter}()}, +\code{\link{bcftools}()}, +\code{\link{bedtools}()}, +\code{\link{bowtie2}()}, \code{\link{cellranger}()}, \code{\link{conda}()}, \code{\link{fastp}()}, @@ -44,6 +47,7 @@ Other \code{commands}: \code{\link{python}()}, \code{\link{samtools}()}, \code{\link{seqkit}()}, +\code{\link{snpEff}()}, \code{\link{trust4}()} } \concept{command} From 72c1685ad0643c999f0a4edb11de8413e0ae6718 Mon Sep 17 00:00:00 2001 From: Yunuuuu Date: Fri, 19 Sep 2025 20:28:49 +0800 Subject: [PATCH 10/10] refactor: remove Rhistory --- .Rhistory | 0 .gitignore | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 .Rhistory diff --git a/.Rhistory b/.Rhistory deleted file mode 100644 index e69de29..0000000 diff --git a/.gitignore b/.gitignore index 6a6b6d8..6959d3c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ .Rproj.user +.Rhistory .radian_history Scratch.RConsole - /.quarto/ README.html docs