make.alleles: Build (possible) allele sequences based on genotypes

View source: R/helper.functions.R

make.allelesR Documentation

Build (possible) allele sequences based on genotypes

Description

Given the sequence of the reference allele, the genotypes, the SNPs (as the substitute nucleotide) and their positions, this function builds the possible allele sequences.

Usage

make.alleles(baseAllele, genotypes, SNPpositions, lenAllele)

Arguments

baseAllele

(Character) The sequence of the reference allele

genotypes

(named integer) The genotypes (0,1,2) named with SNPs (see Details)

SNPpositions

(integer) The position where the SNPs occur

lenAllele

(integer) The length of the allele (as number of nucleotides)

Details

The genotypes are to be codified as 0 for the reference allele, 2 for the alternative allele, and 1 for the hetorozygous. The genotype vector has to be a named integer vector where the names follow the convention. "something-p-nb/na" something is usually the name of the locus, p is the position of the SNP (as integer), nb is the nucleotide in the base allele and na is the nucleotide of the alternative allele. For examples: "100614668-2-A/C". Of all these, the critical elements are that nb and na has to be in the second to last and penultimate position in the string.

Value

A character vector with all the possible allele sequences

Examples

SNPpositions <- list(
c(0,2,7),
c(0,1,2),
c(0,1,3),
c(1,2,7),
c(1,2,3),
c(2,4,6),
c(5,6,7)
)


baseAllele <- "AAAAAAAA"
genotypes <- c(2,1,1)
names(genotypes) <- paste0("something-p-", c("A/G", "A/C", "A/T"))
seqAlleles <- lapply(SNPpositions, make.alleles, baseAllele=baseAllele,
                     genotypes=genotypes,lenAllele=8)
seqAlleles                      

carlopacioni/amplicR documentation built on Aug. 19, 2023, 7:59 p.m.