コード例 #1
0
def encodeHomozygousData(raw_data=None):
    gwas_data = gwas_core.CGWASDataHelper()
    gwas_data.encodeHomozygousData(raw_data,raw_data.shape[1],raw_data.shape[0])
    encoded = gwas_data.getEncodedData()
    maf_data = gwas_data.getMAF()
    gwas_data.releaseMemory()
    return [encoded,maf_data]
コード例 #2
0
ファイル: experiment.py プロジェクト: grimmlab/easyGWASCore
 def selectAlgorithm(self, algo_model=None):
     if algo_model == "linear":
         self.__ass = gwas_core.LinearRegression()
     elif algo_model == "logit":
         self.__ass = gwas_core.LogisticRegression()
     elif algo_model == "MWUrt":
         self.__ass = ranksum.RankSumAsso(test="MannWhitneyU")
     elif algo_model == "WCrt":
         self.__ass = ranksum.RankSumAsso(test="Wilcoxon")
     elif algo_model == "ttest":
         self.__ass = ranksum.RankSumAsso(test="ttest")
     elif algo_model == "FaSTLMM":
         self.__ass = gwas_core.FaSTLMM()
     elif algo_model == "EMMAX":
         self.__ass = gwas_core.EMMAX()
     elif algo_model == "EMMAXperm":
         self.__ass = gwas_core.EMMAX()
         self.__permutation = True
     elif algo_model == "linearperm":
         self.__ass = gwas_core.LinearRegression()
         self.__permutation = True
     elif algo_model == "logitperm":
         self.__ass = gwas_core.LogisticRegression()
         self.__permutation = True
     elif algo_model == "fisher":
         self.__ass = fe.FisherExact()
     self.__algorithm = algo_model
コード例 #3
0
def encodeHeterozygousData(raw_data=None,snp_encoding="additive"):
    gwas_data = gwas_core.CGWASDataHelper()
    if snp_encoding=="recessive":
        encoding = gwas_data.recessive
    elif snp_encoding=="dominant":
        encoding = gwas_data.dominant
    elif snp_encoding=="codominant":
        encoding = gwas_data.codominant
    else:
        encoding = gwas_data.additive
    gwas_data.encodeHeterozygousData(raw_data,raw_data.shape[1],raw_data.shape[0],encoding)
    encoded = gwas_data.getEncodedData()
    maf_data = gwas_data.getMAF()
    gwas_data.releaseMemory()
    return [encoded,maf_data]
コード例 #4
0
import sys
sys.path.append("bin/" + sys.platform + "/interfaces/python/")
import CEasyGWAS as gwas
import scipy as sp

means1 = sp.array([94, 98, 98, 94, 98, 96])
means2 = sp.array([92, 92, 88, 82, 88, 92])

sd1 = sp.array([22, 21, 28, 19, 21, 21])
sd2 = sp.array([20, 22, 26, 17, 22, 22])

n1 = sp.array([60, 65, 40, 200, 50, 85])
n2 = sp.array([60, 65, 40, 200, 45, 85])

mEffect = gwas.MeanEffectSize(means1, means2, sd1, sd2, n1, n2)
effects = mEffect.getHedgesG()
variance = mEffect.getVariance()

print effects, variance
tmp = sp.array([0.129297, 0.193972])
tmp1 = sp.array([0.265015, 0.341087])
random_model = gwas.RandomEffectModel(tmp, tmp1)

random_model.process()

weights = random_model.getWeights()

print weights

mean = random_model.getWeightedMean()
Z = random_model.getZvalue()
コード例 #5
0
import sys
sys.path.append("bin/" + sys.platform + "/interfaces/python/")
import CEasyGWAS as gwas
import scipy as sp

#create dummy genotype wiht 100 sampkes and 10 SNPs.
#Just to demonstrate how to call some stuff in python
X = sp.random.randn(100, 10)
Y = sp.random.randn(100)

K = gwas.CKernels.realizedRelationshipKernel(X)

lmm = gwas.EMMAX()
lmm.setPhenotype(Y)
lmm.setGenotype(X)
lmm.setK(K)

lmm.test_associations()

print lmm.getPValues()
コード例 #6
0
import sys
sys.path.append("bin/" + sys.platform + "/interfaces/python/")
import CEasyGWAS as gwas
import scipy as sp

#create dummy genotype wiht 100 sampkes and 10 SNPs. 
#Just to demonstrate how to call some stuff in python
X = sp.random.randn(100,10)
Y = sp.random.randn(100)

linreg = gwas.LinearRegression()
linreg.setPhenotype(Y)
linreg.setGenotype(X)

linreg.test_associations()

print linreg.getPValues()
コード例 #7
0
ファイル: fixed_effect.py プロジェクト: grimmlab/easyGWASCore
import sys
print "bin/" + sys.platform + "/interfaces/python/"
sys.path.append("bin/" + sys.platform + "/interfaces/python/")
import CEasyGWAS as gwas
import scipy as sp

means1 = sp.array([94, 98, 98, 94, 98, 96])
means2 = sp.array([92, 92, 88, 82, 88, 92])

sd1 = sp.array([22, 21, 28, 19, 21, 21])
sd2 = sp.array([20, 22, 26, 17, 22, 22])

n1 = sp.array([ 60,  65,  40, 200,  50,  85])
n2 = sp.array([ 60,  65,  40, 200,  45,  85])

mEffect = gwas.MeanEffectSize(means1,means2,sd1,sd2,n1,n2)
effects = mEffect.getHedgesG()
variance = mEffect.getVariance()

print effects, variance

fixed_model = gwas.FixedEffectModel(effects,variance)

fixed_model.process()

weights = fixed_model.getWeights()

print weights

mean = fixed_model.getWeightedMean()
Z = fixed_model.getZvalue()