write_alignment {agvgd}R Documentation

Export an alignment to FASTA

Description

This function takes an alignment and exports it to a FASTA file.

Usage

write_alignment(alignment, file)

Arguments

alignment

An alignment. It may be a simple matrix or an object obtained with read_alignment().

file

A file path.

Value

This function is run for its side effect of writing a file. But it returns the file path passed in file.

Examples


alignment <- matrix(
  c('P', 'M', 'I',
    'P', 'I', 'I',
    'P', 'L', 'I'),
  nrow = 3,
  byrow = TRUE
)

# Export an alignment based on a matrix
write_alignment(alignment, "my_alignment.fasta")
cat(readLines("my_alignment.fasta"), sep = "\n")

# Export one of the bundled alignments
write_alignment(read_alignment(gene = 'BRCA1'), "BRCA1.fasta")
cat(readLines("BRCA1.fasta")[1:10], sep = "\n")



[Package agvgd version 0.1.2 Index]