cutadapt_remove_primers: Remove primers using cutadapt

View source: R/dada_phyloseq.R

cutadapt_remove_primersR Documentation

Remove primers using cutadapt

Description

lifecycle-experimental

You need to install Cutadapt. See also https://github.com/VascoElbrecht/JAMP/blob/master/JAMP/R/Cutadapt.R for another call to cutadapt from R

Usage

cutadapt_remove_primers(
  path_to_fastq,
  primer_fw = NULL,
  primer_rev = NULL,
  folder_output = "wo_primers",
  nproc = 1,
  pattern = "fastq.gz",
  pattern_R1 = "_R1",
  pattern_R2 = "_R2",
  nb_files = Inf,
  cmd_is_run = TRUE,
  args_before_cutadapt =
    "source ~/miniconda3/etc/profile.d/conda.sh && conda activate cutadaptenv && "
)

Arguments

path_to_fastq

(Required) A path to a folder with fastq files. See list_fastq_files() for help.

primer_fw

(Required, String) The forward primer DNA sequence.

primer_rev

(String) The reverse primer DNA sequence.

folder_output

The path to a folder for output files

nproc

(default 1) Set to number of cpus/processors to use for the clustering

pattern

a pattern to filter files (passed on to list.files function).

pattern_R1

a pattern to filter R1 files (default "R1")

pattern_R2

a pattern to filter R2 files (default "R2")

nb_files

the number of fastq files to list (default FALSE)

cmd_is_run

(logical, default TRUE) Do the cutadapt command is run. If set to FALSE, the only effect of the function is to return a list of command to manually run in a terminal.

args_before_cutadapt

(String) A one line bash command to run before to run cutadapt. For examples, "source ~/miniconda3/etc/profile.d/conda.sh && conda activate cutadaptenv &&" allow to bypass the conda init which asks to restart the shell

Details

This function is mainly a wrapper of the work of others. Please cite cutadapt (\Sexpr[results=rd]{tools:::Rd_expr_doi("doi:10.14806/ej.17.1.200")}).

Value

a list of command

Author(s)

Adrien Taudière

Examples


## Not run: 
cutadapt_remove_primers("inst/extdata", "TTC", "GAA",
  folder_output = tempdir()
)

cutadapt_remove_primers(
  system.file("extdata",
    package = "dada2"
  ),
  pattern_R1 = "F.fastq.gz",
  pattern_R2 = "R.fastq.gz",
  primer_fw = "TTC",
  primer_rev = "GAA",
  folder_output = tempdir()
)

cutadapt_remove_primers(
  system.file("extdata",
    package = "dada2"
  ),
  pattern_R1 = "F.fastq.gz",
  primer_fw = "TTC",
  folder_output = tempdir(),
  cmd_is_run = FALSE
)

unlink(tempdir(), recursive = TRUE)

## End(Not run)


adrientaudiere/MiscMetabar documentation built on Oct. 13, 2024, 9:42 p.m.