collate.seqs: Collate sequences

View source: R/collate.seqs.R

collate.seqsR Documentation

Collate sequences

Description

collate.seqs can be used to collate together outputs from data.proc.

Usage

collate.seqs(ldproc = NULL, rdas.in = NULL, dir.out = NULL)

Arguments

ldproc

If the data are already in R memory, a list whose element are data.proc outputs.

rdas.in

If ldproc=NULL, a character vector with the path to the rda files where the outputs from data.proc that have to be collated were saved.

dir.out

The directory where to save the results. If NULL (default) then it will be set to the working directory

Details

This function was developed because, if, for example, sequencing runs are carried out for the same samples, different data.proc outputs will also exists and you may want to collate together all the sequences from the same sample. collate.seqs does exactly this. By passing either the path to, or a list of, data.proc outputs, collate.seqs collate together the sequences.

collate.seqs will generate an output that it is very similar to data.proc but with the combined seqs for the same samples.

Value

Return a list with several elements:

  • $lbysamples: A list whose elements are vectors with the unique sequences (names) for each sample and their abundance (values).

  • $stable: The sequence table

  • $seq_list: The sequences and matching sequences IDs

  • $call: The function call

Several files are also saved to disk, these include:

  • Seq_table.csv Sequence table

  • Seq_list.csv List of sequences and their matching IDs

  • collated.rda R data file containing the list returned by collate.seqs (see above)

Examples

# Select the directory where the example data are stored
example.data <- system.file("extdata", "HTJ", package="amplicR")
# Select a temporary directory where to store the outputs
out <- tempdir()

# Run data.proc with bp=140 and save in a sub folder
out140 <- paste(out, "out140", sep="/")
HTJ.140 <- data.proc(example.data, out140, bp=140)

# Repeat the process in a different sub folder
out140bis <- paste(out, "out140bis", sep="/")
HTJ.140bis <- data.proc(example.data, out140bis, bp=140)


# Collate seqs of the two objects HTJ.140 and HTJ.140bis 
# Note that the sequences are recognised to be identical and size is summed
collate.seqs(ldproc=list(HTJ.140, HTJ.140bis), dir.out=out)

# As above but using the .rda files
rdas <- paste(out, c("out140", "out140bis"), "data.proc.rda", sep="/")
collate.seqs(rdas.in=rdas, dir.out=out)

# Clean up the temp directory
unlink(out, recursive=TRUE)

carlopacioni/amplicR documentation built on Aug. 19, 2023, 7:59 p.m.