summariseGeno.Rd
Returns a per variant summary of genotype counts, frequencies, call-rates and hwe testing.
Note, the gdb
implementation is described here, summariseGeno
can also be run directly on a
genoMatrix
object as described in the genoMatrix
documentation.
# S4 method for gdb
summariseGeno(
object,
cohort = "SM",
varSet = NULL,
VAR_id = NULL,
pheno = NULL,
memlimit = 1000,
geneticModel = "allelic",
checkPloidy = NULL,
keep = NULL,
output = NULL,
splitBy = NULL,
minCallrateVar = 0,
maxCallrateVar = Inf,
minCallrateSM = 0,
maxCallrateSM = Inf,
minMAF = 0,
maxMAF = 1,
minMAC = 0,
maxMAC = Inf,
minCarriers = 0,
maxCarriers = Inf,
minCarrierFreq = 0,
maxCarrierFreq = Inf,
strict = TRUE,
verbose = TRUE
)
a gdb
object
If a valid cohort name is provided, then the uploaded data for this cohort is used to filter and annotate the genotypes If not specified, all samples in the gdb will be loaded.
a varSetList
or varSetFile
object. Alternatively the VAR_id parameter can be specified.
A list of VAR_ids, alternatively the varSet parameter can be specified.
The memlimit
argument controls how many variants to analyze at a time.
colData field to test as response variable, although not used within this method, this can be useful to filter samples which have missing data for the response variable.
Maximum number of variants to load at once (if VAR_id
is specified).
Which genetic model to apply? ('allelic', 'recessive' or 'dominant').
Defaults to allelic
.
Version of the human genome to use when assigning variant ploidy (diploid, XnonPAR, YnonPAR).
Accepted inputs are GRCh37, hg19, GRCh38, hg38.
If not specified, the genome build in the gdb
will be used, if available (included if the genomeBuild
parameter was set in buildGdb
).
Otherwise, if the genome build is not included in the gdb metadata, and no value is provided, then all variants are assigned the default ploidy of "diploid"
vector of sample IDs to keep, defaults to NULL
, in which case all samples are kept.
Output file path for results.
Defaults to NULL
, in which case results are not written.
Split variant summaries by labels indicated in the specified field.
Minimum genotype rate for variant retention.
Maximum genotype rate for variant retention.
Minimum genotype rate for sample retention.
Maximum genotype rate for sample retention.
Minimum minor allele frequency for variant retention.
Maximum minor allele frequency for variant retention.
Minimum minor allele count for variant retention.
Maximum minor allele count for variant retention.
Minimum carrier count for variant retention.
Maximum carrier count for variant retention.
Minimum carrier frequency for variant retention.
Maximum carrier frequency for variant retention.
Should strict checks be performed? Defaults to TRUE
.
Strict checks currently includes checking whether supplied varSetFile/varSetList was generated from the same gdb as specified in object
.
Should the function be verbose? (TRUE/FALSE), defaults to TRUE
.
Returns a data.frame
with the following columns:
VAR_id
: VAR_id of the respective variant.
AF
: Allele frequency
callRate
: callRate
geno0
: Number of samples with genotype='0'.
When geneticModel
='allelic' or 'dominant' this is the number of individuals that are
homozygous for the reference allele.
geno1
: Number of samples with genotype='1'.
When geneticModel
='allelic' this is the number of individuals that are
heterozygous for the reference allele.
When geneticModel
= 'dominant' this represents the number of individuals who carry at least one
alternate allele.
When geneticModel
= 'recessive' this represents the number of individuals who are homozygous
for the alternate allele.
geno2
: When geneticModel
= 'allelic', the number of individuals who are homozygous
for the alternate allele.
library(rvatData)
gdb <- create_example_gdb()
# generate for variant summaries for list of variants
sumgeno <- tempfile()
summariseGeno(gdb,
cohort = "pheno",
VAR_id = 1:100,
output = sumgeno)
#> Analysing chunk1
#> Retrieved genotypes for 100 variants
#> Analysing unit chunk1; varSet none
# generate for variant summaries for varSetFile
varsetfile <- varSetFile(rvat_example("rvatData_varsetfile.txt.gz"))
varsets <- getVarSet(varsetfile, unit = c("SOD1", "FUS"), varSetName = "High")
summariseGeno(gdb,
cohort = "pheno",
varSet = varsets,
output = sumgeno)
#> Analysing FUS
#> Retrieved genotypes for 1 variants
#> Analysing unit FUS; varSet High
#> Analysing SOD1
#> Retrieved genotypes for 4 variants
#> Analysing unit SOD1; varSet High
# variant summaries can be generated for subgroups using the `splitBy` parameter.
# this will result in an additional column in the output for the subgroups
summariseGeno(gdb,
cohort = "pheno",
VAR_id = 1:100,
splitBy = "pheno",
output = sumgeno)
#> Analysing chunk1
#> Retrieved genotypes for 100 variants
#> Analysing unit chunk1; varSet none
data <- read.table(sumgeno, header = TRUE)
# contains 'pheno' column
head(data)
#> VAR_id pheno AF callRate geno0 geno1 geno2 hweP
#> 1 1 1 0.0000000000 0.9180 4590 0 0 1
#> 2 2 1 0.0000000000 0.9826 4913 0 0 1
#> 3 3 1 0.0000000000 1.0000 5000 0 0 1
#> 4 4 1 0.0000000000 0.8512 4256 0 0 1
#> 5 5 1 0.0001010305 0.9898 4948 1 0 1
#> 6 6 1 0.0004021717 0.9946 4969 4 0 1
# summariseGeno can be ran directly on a genoMatrix
data(GT)
sumgeno <- summariseGeno(GT)