codon_diff: Find codon differences between sequences

Description Usage Arguments Value Examples

View source: R/sequence_diffs.R

Description

Function takes a baseline sequence and any number of sequences to compare to and determines the number or the positions of the codon (3 characters) differences.

Usage

1
2
3
4
5
6
7
8
codon_diff(
  baseline_seq,
  compare_seqs,
  diff_type = c("synonymous", "non-synonymous", "all"),
  output = c("num", "position"),
  seq_type = c("DNA", "RNA"),
  ignore_case = TRUE
)

Arguments

baseline_seq

Character vector of length one that all other sequences are being compared to.

compare_seqs

Character vector of any length that will be compared to the baseline sequence.

diff_type

Either "synonymous", "non-synonymous", or "all".

  • "all" : find all the codon differences

  • "non-synonymous" : find all of the non-synonymous codon differences

  • "synonymous" : find all of the synonymous codon differences

output

Either "num" (return the number of differences) or "position" (return the positions of the differences).

seq_type

Character value of "DNA" or "RNA" describing whether the sequences use "T" or "U".

ignore_case

Logical value (TRUE / FALSE) designating whether the function should ignore case. Defaults to TRUE.

Value

Either a list of numeric vectors describing the positions of the differences or a numeric vector of the number of differences.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
codon_diff('AGTGGG', 'CGTGAG', output = 'num', diff_type = 'all', seq_type = 'DNA')

seq1 = 'ACTGACTGG'
seq2 = c('ACGGGCCGG', 'ACTGACTGG', 'GCTCAGTGG')
codon_diff(seq1, seq2, output = 'num', diff_type = 'synonymous',
    seq_type = 'DNA', ignore_case = TRUE)
codon_diff(seq1, seq2, output = 'position', diff_type = 'non-synonymous',
    seq_type = 'DNA', ignore_case = FALSE)

seq1 = 'ACUGACUGG'
seq2 = c('ACGGGCCGG', 'ACUGACUGG', 'GCUCAGUGG')
codon_diff(seq1, seq2, output = 'num', diff_type = 'synonymous',
    seq_type = 'RNA', ignore_case = TRUE)
codon_diff(seq1, seq2, output = 'position', diff_type = 'non-synonymous',
    seq_type = 'RNA', ignore_case = FALSE)

## Not run: 
codon_diff(seq1, seq2)
codon_diff('AGTCGA', 'TTA')

## End(Not run)

ryanmcnamara4/myPackage documentation built on Dec. 22, 2021, 8:18 p.m.