Learn R Programming

gggenomes (version 1.1.2)

def_formats: Defined file formats and extensions

Description

For seamless reading of different file formats, gggenomes uses a mapping of known formats to associated file extensions and contexts in which the different formats can be read. The notion of context allows one to read different information from the same format/extension. For example, a gbk file holds both feature and sequence information. If read in "feats" context read_feats("*.gbk") it will return a feature table, if read in "seqs" context read_seqs("*.gbk"), a sequence index.

Usage

def_formats(
  file = NULL,
  ext = NULL,
  context = NULL,
  parser = NULL,
  allow_na = FALSE
)

Value

dictionarish vector of file formats with recognized extensions as names

Arguments

file

a vector of file names

ext

a vector of file extensions

context

a vector of file contexts defined in gggenomes_global$def_formats

parser

a vector of file parsers defined in gggenomes_global$def_formats

allow_na

boolean

Defined formats, extensions, contexts, and parsers


      format          ext      context       parser
1  ambigious txt, tsv....           NA read_amb....
2      fasta fa, fas,....         seqs read_seq_len
3        fai          fai         seqs     read_fai
4       gff3 gff, gff....  feats, seqs read_gff....
5        gbk gbk, gb,....  feats, seqs read_gbk....
6        bed          bed        feats     read_bed
7      blast   m8, o6, o7 feats, links read_bla....
8        paf          paf feats, links read_paf....
9      alitv         json feats, s.... read_ali....
10       vcf          vcf        feats     read_vcf

Examples

Run this code
# vector of defined zip formats and recognized extensions as names
# format of file
def_formats("foo.fa")

# formats associated with each extension
def_formats(ext = c("fa", "gff"))

# all formats/extensions that can be read in seqs context; includes formats
# that are defined for context=NA, i.e. that can be read in any context.
def_formats(context = "seqs")

Run the code above in your browser using DataLab