export_sq: Export sq objects into other formats

View source: R/export_sq.R

export_sqR Documentation

Export sq objects into other formats

Description

Converts object of class sq to a class from another package. Currently supported packages are ape, bioseq, Bioconductor and seqinr. For exact list of supported classes and resulting types, see details.

Usage

export_sq(x, export_format, name = NULL, ...)

Arguments

x

[sq]
An object this function is applied to.

export_format

[character(1)]
A string indicating desired class (with specified package for clarity).

name

[character]
Vector of sequence names. Must be of the same length as sq object. Can be NULL.

...

further arguments to be passed from or to other methods.

Details

Currently supported formats are as follows (grouped by sq types):

  • ami:

    • "ape::AAbin"

    • "bioseq::bioseq_aa"

    • "Biostrings::AAString"

    • "Biostrings::AAStringSet"

    • "seqinr::SeqFastaAA"

  • dna:

    • "ape::DNAbin"

    • "bioseq::bioseq_dna"

    • "Biostrings::DNAString"

    • "Biostrings::DNAStringSet"

    • "seqinr::SeqFastadna"

  • rna:

    • "bioseq::bioseq_rna"

    • "Biostrings::RNAString"

    • "Biostrings::RNAStringSet"

Value

An object with the format specified in the parameter. To find information about the detailed structure of this object, see documentation of these objects.

See Also

sq class

Functions from output module: as.character.sq(), as.matrix.sq(), as.sq(), write_fasta()

Examples

# DNA and amino acid sequences can be exported to most packages
sq_ami <- sq(c("MVVGL", "LAVPP"), alphabet = "ami_bsc")
export_sq(sq_ami, "ape::AAbin")
export_sq(sq_ami, "bioseq::bioseq_aa")
export_sq(sq_ami, "Biostrings::AAStringSet", c("one", "two"))
export_sq(sq_ami, "seqinr::SeqFastaAA")

sq_dna <- sq(c("TGATGAAGCGCA", "TTGATGGGAA"), alphabet = "dna_bsc")
export_sq(sq_dna, "ape::DNAbin", name = c("one", "two"))
export_sq(sq_dna, "bioseq::bioseq_dna")
export_sq(sq_dna, "Biostrings::DNAStringSet")
export_sq(sq_dna, "seqinr::SeqFastadna")

# RNA sequences are limited to Biostrings and bioseq
sq_rna <- sq(c("NUARYGCB", "", "DRKCNYBAU"), alphabet = "rna_ext")
export_sq(sq_rna, "bioseq::bioseq_rna")
export_sq(sq_rna, "Biostrings::RNAStringSet")

# Biostrings can export single sequences to simple strings as well
export_sq(sq_dna[1], "Biostrings::DNAString")


michbur/tidysq documentation built on April 1, 2022, 5:18 p.m.