| ae | R Documentation |
ae() provides a handy shortcut to extract a vector of allelic
expression ratios for a DAE SNP on a set of samples.
ae_hom() and ae_het() also extract a vector of allelic expression ratios
but for the corresponding homozygous or heterozygous samples of the candidate
SNP, respectively.
ae(dae_snp, ae, samples = rep(TRUE, ncol(ae) - 1), drop_na = TRUE) ae_hom(dae_snp, candidate_snp, zygosity, ae, drop_na = TRUE) ae_het(dae_snp, candidate_snp, zygosity, ae, drop_na = TRUE)
dae_snp |
A string indicating the identifier of the DAE SNP. |
ae |
A data frame of expression values. Each row is for a locus. The locus identity is indicated in the first column. Remaining columns are samples. |
samples |
Either a logical or an integer vector indicating which samples
in the |
drop_na |
Whether to drop |
candidate_snp |
A string indicating the identifier of the candidate SNP. |
zygosity |
A data frame of zygosity levels: |
A numeric vector of allelic ratios.
# Let us load some dummy data
zygosity <- read_snp_zygosity(file = daeqtlr_example("zygosity.csv"))
ae <- read_ae_ratios(file = daeqtlr_example("ae.csv"))
# Select all allelic expression ratios of rsX019
ae('rsX019', ae = ae, drop_na = FALSE)
# Select only the first 5 samples
ae('rsX019', ae = ae, samples = 1:10, drop_na = FALSE)
ae('rsX019', ae = ae, samples = 1:10, drop_na = TRUE)
# Use a logical vector to select samples that meet a requirement, e.g.
# heterozygous samples only. Note that `is_het()` is useful here.
(het_samples_for_rsX019 <- is_het(zygosity = zygosity, snp = 'rsX019'))
ae('rsX019', ae = ae, samples = het_samples_for_rsX019, drop_na = FALSE)
# If you want the allelic ratios for samples that are simultaneously:
# - heterozygous for rsX019
# - homozygous for rsX002
(hom_samples_for_rsX002 <- is_hom(zygosity = zygosity, snp = 'rsX002'))
ae(
dae_snp = 'rsX019',
ae = ae,
samples = het_samples_for_rsX019 & hom_samples_for_rsX002,
drop_na = FALSE
)
# Or more simply:
ae_hom('rsX019', 'rsX002', zygosity, ae, drop_na = FALSE)
# Compare with the previous
ae_hom('rsX019', 'rsX002', zygosity, ae, drop_na = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.