catfastq {Rfastp} | R Documentation

## Concatenate Fastq Files.

### Description

concatenate multiple fastq files into a single file.

### Usage

    catfastq(output, inputFiles, append = FALSE, paired = FALSE, shuffled = FALSE)

### Arguments

`output` | output file name [string]
`inputFiles` | a vector of input file names [vector]
`append` | a logical indicating append the files to a file already exists.
`paired` | a logical indicating split the input files into two halves. the first half merged into read1, the second half merged into read2.
`shuffled` | a logical indicating split the input file list into two halves. The R1/R2 files are inteleaved in the inputFiles vector.

### Value

no returns.

### Author(s)

Wei Wang

### Examples

    pe001_read1 <- system.file("extdata","splited_001_R1.fastq.gz",
         package="Rfastp")
    pe002_read1 <- system.file("extdata","splited_002_R1.fastq.gz",
         package="Rfastp")
    pe003_read1 <- system.file("extdata","splited_003_R1.fastq.gz",
         package="Rfastp")
    pe004_read1 <- system.file("extdata","splited_004_R1.fastq.gz",
         package="Rfastp")

    pe001_read2 <- system.file("extdata","splited_001_R2.fastq.gz",
         package="Rfastp")
    pe002_read2 <- system.file("extdata","splited_002_R2.fastq.gz",
         package="Rfastp")
    pe003_read2 <- system.file("extdata","splited_003_R2.fastq.gz",
         package="Rfastp")
    pe004_read2 <- system.file("extdata","splited_004_R2.fastq.gz",
         package="Rfastp")

    allR1 <- c(pe001_read1, pe002_read1, pe003_read1, pe004_read1)
    allR2 <- c(pe001_read2, pe002_read2, pe003_read2, pe004_read2)

    allreads <- c(allR1, allR2)
    allreads_shuffled <- c(pe001_read1, pe001_read2, pe002_read1, pe002_read2,
                   pe003_read1, pe003_read2, pe004_read1, pe004_read2)

    outputPrefix <- tempfile(tmpdir = tempdir())
    # a normal concatenation for single-end libraries.

    catfastq(output = paste0(outputPrefix, "_R1.fastq.gz"), inputFiles = allR1)

    # a normal concatenation for paired-end libraries.

    catfastq(output = paste0(outputPrefix, "merged_paired"),
        inputFiles = allreads, paired=TRUE)

    # Append to exist files (paired-end)

    catfastq(output=paste0(outputPrefix,"append_paired"), inputFiles=allreads,
        append=TRUE, paired=TRUE)

    # Input paired-end files are shuffled.

    catfastq(output=paste0(outputPrefix,"_shuffled_paired"),
        inputFiles=allreads_shuffled, paired=TRUE, shuffled=TRUE)

[Package Rfastp version 1.2.0 Index]