meanvar package

The meanvar library provides the base functionality for the MVtest method. It depends on PyGWAS functionality.

meanvar.mv_esteq module

meanvar.mv_esteq.MeanVarEstEQ(y, x, covariates, tol=1e-08)[source]

Perform the mean var calculation using estimated equestions

Parameters:
  • y – Outcomes
  • x – [genotypes, cov1, ..., covN]
  • tol – convergence criterion
meanvar.mv_esteq.RunAnalysis(dataset, pheno_covar)[source]

Run the actual analysis on all valid loci for each phenotype

Parameters:
  • dataset – GWAS parser object
  • pheno_covar – holds all of the variables

This acts as a standard iterator, returning a single MVResult for each locus/phenotype combination.

Missing is evaluated as anything missing in any of the phenotype, covariate(s) or genotype

meanvar.mv_esteq.RunMeanVar(pheno, geno, covar=[])[source]

Setup and execute the mean var calculation.

Parameters:
  • pheno – Phenotype data (one phenotype at a time)
  • geno – SNP data (might be genotypes, or dosages, etc)
  • covar – List of covariate data

It is possible that the optimization will fail to converge. Such cases are stripped of data, but are still reported to alert the user that there were problems with the data.

meanvar.mvresult module

class meanvar.mvresult.MVResult(chr, pos, rsid, maj, min, eff_alcount, non_miss_count, p_mvtest, ph_label, beta_values, pvalues, stderrors, maf, covar_labels=[], lm=-1, runtime=-1)[source]

Bases: object

Result associated with a single locus/phenotype execution

beta_pvalues = None

list of beta pvalues

beta_stderr = None

list of std errors

betas = None

list of beta values

chr = None

Chromosome

covar_labels = None

Covariate labels used for analysis

eff_alcount = None

Total count of effect alleles

lmpv = None

LM

maf = None

minor allele frequency

maj_allele = None

Major allele (A,C,G,T, etc)

min_allele = None

Minor allele

non_miss = None

non missing count

p_mvtest = None

mvtest’s pvalue

p_variance
ph_label = None

current phenotype label

pos = None

BP position

print_header(f=<open file '<stdout>', mode 'w'>, verbose=False)[source]

Prints header to f (will write header based on verbose)

Parameters:
  • f – stream to print output
  • verbose – print all data or only the most important parts?
print_result(f=<open file '<stdout>', mode 'w'>, verbose=False)[source]

Print result to f

Parameters:
  • f – stream to print output
  • verbose – print all data or only the most important parts?
rsid = None

RSID

runtime = None

number of seconds analysis took to complete

stringify(value)[source]

meanvar.mvstandardizer module

class meanvar.mvstandardizer.Standardizer(pc)[source]

Bases: pygwas.standardizer.StandardizedVariable

Optional plugin object that can be used to standardize covariate and phenotype data.

Many algorithms require that input be standardized in some way in order to work properly, however, rescaling the results is algorithm specific. In order to facilitate this situation, application authors can write up application specific Standardization objects for use with the data parsers.

destandardize(estimates, se, **kwargs)[source]

Revert the betas and variance components back to the original scale.

standardize()[source]

Standardize the variables within a range [-1.0 and 1.0]

This replaces the local copies of this data. When it’s time to scale back, use destandardize from the datasource for that.

meanvar.simple_timer module

class meanvar.simple_timer.SimpleTimer[source]

Simple abstraction to allow for basic timing.

report(msg, do_reset=False, file=<open file '<stdout>', mode 'w'>)[source]

Print to stdout msg followed by the runtime.

When true, do_reset will result in a reset of start time.

reset()[source]

Reset start time

result(msg, do_reset=False)[source]

Return log message containing ellapsed time as a string.

When true, do_reset will result in a reset of start time.

runtime()[source]

Return ellapsed time and reset start.

Module contents