Mercurial > repos > ecology > ab1_fastq_converter
diff ab1_fastq.R @ 0:307518fb51af draft default tip
"planemo upload for repository https://github.com/ColineRoyaux/Galaxy_tool_projects/tree/main/ab1_fastq commit dbecaa89a5afa0cc73ae00a716c98ae46fa97b58"
author | ecology |
---|---|
date | Wed, 12 Jan 2022 15:12:58 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ab1_fastq.R Wed Jan 12 15:12:58 2022 +0000 @@ -0,0 +1,35 @@ +#Rscript + +############################################ +## Convert ab1 files into fastq ## +############################################ + +#####Packages + +library(CrispRVariants, quietly = TRUE) +library(sangerseqR, quietly = TRUE) + +#####Load arguments + +args <- commandArgs(trailingOnly = TRUE) + +if (length(args) == 0) { + stop("This tool needs at least one argument") +} else { + file <- args[1] + filename <- args[2] + tr <- as.logical(args[3]) + co <- as.numeric(args[4]) + min_seq <- as.integer(args[5]) + os <- as.numeric(args[6]) +} + +##### Conversion + +if (grepl("^.+\\.[aA][bB][1i]$", filename)) { + nfile <- sub("^(.+)\\.[aA][bB][1i]$", "\\1", filename) +} else { + nfile <- filename +} + +CrispRVariants::abifToFastq(nfile, file, "output.fastq", trim = tr, cutoff = co, min_seq_len = min_seq, offset = os)