Learn R Programming

eDNAfuns (version 0.1.0)

fasta_writer: Read FASTA or FASTQ files into a tibble

Description

Functions to read sequence files into a tidy data frame with one row per sequence.

Usage

fasta_writer(df, sequence, header, file.out)

fastq_writer(df, sequence, header, Qscores, file.out)

Value

- `fasta_reader()`: A tibble with columns: - `header`: sequence identifiers (without the `>`). - `seq`: nucleotide sequences.

- `fastq_reader()`: A tibble with columns: - `header`: sequence identifiers (without the `@`). - `seq`: nucleotide sequences. - `Qscores` (optional): quality scores, if `keepQ = TRUE`.

Arguments

df

A dataframe where the sequence information is stored, one sequence per row

sequence

The name (unquoted) of the column where the sequence information (as characters) is stored

header

The name (unquoted) of the column where the header information is stored

file.out

Character. Path to the location where to write the file.

Qscores

The name (unquoted) of the column where the Quality information (encoded as characters) is stored

Examples

Run this code
fasta_file <- tempfile(fileext = ".fasta")

fasta_df <- fasta_reader(system.file("extdata", "test.fasta", package="eDNAfuns"))

fasta_writer(fasta_df, sequence=seq,
              header = header,
              file.out = fasta_file)
 
fastq_file <- tempfile(fileext = ".fastq")  
           
fastq_df <- fastq_reader(system.file("extdata", "test.fastq", package="eDNAfuns"), keepQ = TRUE)

fastq_writer(fastq_df, sequence=seq,
              header = header,Qscores= Qscores,
              file.out = fastq_file)

Run the code above in your browser using DataLab