View source: R/helper.functions.R
make.alleles | R Documentation |
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.
make.alleles(baseAllele, genotypes, SNPpositions, lenAllele)
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) |
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.
A character vector with all the possible allele sequences
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.