write_substitutions {agvgd}R Documentation

Generate and export a list of substitutions

Description

This function exports to a file a list of residue substitutions. The format used will be the same one as requested by the web version of Align-GVGD.

Usage

write_substitutions(
  file,
  alignment,
  poi,
  sub,
  mode = c("recycle", "expand_grid")
)

Arguments

file

A file path.

alignment

A character matrix or an alignment object obtained with read_alignment(). Rows are expected to be sequences of single characters (protein residues), and columns the alignment positions. The first row must be the reference sequence, i.e. the sequence whose substitutions will be evaluated against.

poi

A whole number indicating the position of interest (POI).

sub

A character vector of protein residue substitutions to be classified. The amino acids must be provided as one-letter symbols.

mode

If both poi and sub contain more than one element, mode specifies how these two inputs are combined. If mode = 'recycle' the shortest vector is recycled to match the length of the longest. If mode = 'expand_grid', all combinations between elements of poi and sub are combined.

Value

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

Examples


write_substitutions(file = "ex01.csv",
                    alignment = read_alignment("ATM"),
                    poi = 20:25,
                    sub = amino_acids())
cat(readLines("ex01.csv"), sep = "\n")

write_substitutions(file = "ex02.csv",
                    alignment = read_alignment("ATM"),
                    poi = 20:21,
                    sub = amino_acids(),
                    mode = 'expand_grid')
cat(readLines("ex02.csv"), sep = "\n")


[Package agvgd version 0.1.2 Index]