Beispiel #1
0
 
 # train socal
 paa = []
 pab = []
 pbb = []
 for ind in tindv:
     info = indv_geno[ind]
     genotype = info[2]
     if(genotype == 'aa'):
         paa.append([float(info[0]), float(info[1])])
     elif(genotype == 'ab'):
         pab.append([float(info[0]), float(info[1])])
     elif(genotype == 'bb'):
         pbb.append([float(info[0]), float(info[1])])
 
 trainer = socal_trainer(snp, paa, pab, pbb, c1, c2, c3)
 
 # time execution in ms
 t1 = time.time()
 trainer.train()
 trainer.rescue(c5)
 t2 = time.time()
 dt = (t2-t1)*1000.0
 
 # get truth
 info = indv_geno[vindv]
 truth = info[2]
 
 # get the ellipsoids - skip the ellipsoid if any cluster can't be
 # estimated
 ellipsoids = trainer.get_ellipsoids()
Beispiel #2
0
pbb = []
for line in train_data_file:
    line = line.strip()
    cols = line.split(',')
    genotype = cols[2]
    if(genotype == '1'):
        paa.append([float(cols[0]), float(cols[1])])
    elif(genotype == '2'):
        pab.append([float(cols[0]), float(cols[1])])
    elif(genotype == '3'):
        pbb.append([float(cols[0]), float(cols[1])])

c1 = 1
c2 = 10
c3 = 100
trainer = socal_trainer('SNP_A-1643086', paa, pab, pbb, c1, c2, c3)
trainer.train()
trainer.rescue()
ellipsoids = trainer.get_ellipsoids()
e_aa = ellipsoids['aa']
print 'aa'
print e_aa['c']
print e_aa['E']
print
print 'ab'
e_ab = ellipsoids['ab']
print e_ab['c']
print e_ab['E']
print
print 'bb'
e_bb = ellipsoids['bb']