Univariate GxE fixed effects interaction linear mixed model test for all
    pairs of SNPs and environmental variables.

    Args:
        snps:   [N x S] SP.array of S SNPs for N individuals
        pheno:  [N x 1] SP.array of 1 phenotype for N individuals
        env:    [N x E] SP.array of E environmental variables for N individuals
        K:      [N x N] SP.array of LMM-covariance/kinship koefficients (optional)
                        If not provided, then linear regression analysis is performed
        covs:   [N x D] SP.array of D covariates for N individuals
        test:    'lrt' for likelihood ratio test (default) or 'f' for F-test

    Returns:
        pv:     [E x S] SP.array of P values for interaction tests between all
                E environmental variables and all S SNPs

def interact_GxE_1dof(snps,pheno,env,K=None,covs=None, test='lrt'):
    """
    Univariate GxE fixed effects interaction linear mixed model test for all
    pairs of SNPs and environmental variables.

    Args:
        snps:   [N x S] SP.array of S SNPs for N individuals
        pheno:  [N x 1] SP.array of 1 phenotype for N individuals
        env:    [N x E] SP.array of E environmental variables for N individuals
        K:      [N x N] SP.array of LMM-covariance/kinship koefficients (optional)
                        If not provided, then linear regression analysis is performed
        covs:   [N x D] SP.array of D covariates for N individuals
        test:    'lrt' for likelihood ratio test (default) or 'f' for F-test

    Returns:
        pv:     [E x S] SP.array of P values for interaction tests between all
                E environmental variables and all S SNPs
    """
    N=snps.shape[0]
    if K is None:
        K=SP.eye(N)
    if covs is None:
        covs = SP.ones((N,1))
    assert (env.shape[0]==N and pheno.shape[0]==N and K.shape[0]==N and K.shape[1]==N and covs.shape[0]==N), "shapes missmatch"
    Inter0 = SP.ones((N,1))
    pv = SP.zeros((env.shape[1],snps.shape[1]))
    print(("starting %i interaction scans for %i SNPs each." % (env.shape[1], snps.shape[1])))
    t0=time.time()
    for i in range(env.shape[1]):
        t0_i = time.time()
        cov_i = SP.concatenate((covs,env[:,i:(i+1)]),1)
        lm_i = simple_interaction(snps=snps,pheno=pheno,covs=cov_i,Inter=env[:,i:(i+1)],Inter0=Inter0, test=test)
        pv[i,:]=lm_i.getPv()[0,:]
        t1_i = time.time()
        print(("Finished %i out of %i interaction scans in %.2f seconds."%((i+1),env.shape[1],(t1_i-t0_i))))
    t1 = time.time()
    print(("-----------------------------------------------------------\nFinished all %i interaction scans in %.2f seconds."%(env.shape[1],(t1-t0))))
    return pv