aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/my_pylmm/pyLMM/convertlmm.py27
-rw-r--r--wqflask/wqflask/my_pylmm/pyLMM/plink.py2
2 files changed, 21 insertions, 8 deletions
diff --git a/wqflask/wqflask/my_pylmm/pyLMM/convertlmm.py b/wqflask/wqflask/my_pylmm/pyLMM/convertlmm.py
index 173bae2e..d04f9b94 100644
--- a/wqflask/wqflask/my_pylmm/pyLMM/convertlmm.py
+++ b/wqflask/wqflask/my_pylmm/pyLMM/convertlmm.py
@@ -136,19 +136,30 @@ if options.pheno:
msg(str(count)+" pheno lines written")
if options.geno:
+ msg("Converting geno "+options.geno+'.bed')
if not options.plink:
raise Exception("Use --plink switch")
if not num_inds:
raise Exception("Can not figure out the number of individuals, use --pheno or --kinship")
- # msg("Converting geno "+options.geno)
-
- snps = plink.readbim(options.geno+'.bim')
- msg("Converting geno "+options.geno+'.bed')
-
- # def out(i,x):
- # print i,x
+ num_snps = plink.readbim(options.geno+'.bim')
+ writer = None
+ if options.prefix:
+ writer = open(options.prefix+".geno","w")
+ wrln("# Genotype format version 1.0")
+ wrln("# Individuals = "+str(num_inds))
+ wrln("# Phenotypes = "+str(len(num_snps)))
+
+ def out(i,x):
+ # print(i,x)
+ pass
- snps = plink.readbed(options.geno+'.bed',num_inds, lambda i,x: print(i,x))
+ snps = plink.readbed(options.geno+'.bed',num_inds, out)
+ # for i in range(num_snps):
+ # wr("\t"+str(i+1))
+ # wr("\n")
+ # for i in range(count):
+ # wr("\t".join(phenos[i]))
+ # wr("\n")
msg(str(count)+" geno lines written (with "+str(snps)+" snps)")
msg("Converting done")
diff --git a/wqflask/wqflask/my_pylmm/pyLMM/plink.py b/wqflask/wqflask/my_pylmm/pyLMM/plink.py
index 75d51c3b..4ad2c5f7 100644
--- a/wqflask/wqflask/my_pylmm/pyLMM/plink.py
+++ b/wqflask/wqflask/my_pylmm/pyLMM/plink.py
@@ -47,6 +47,8 @@ def readbim(fn):
list = line.split()
if len([True for e in list if e == 'nan']) == 0:
res.append( (list[0],list[1],int(list[2]),int(list[3]),int(list[4]),int(list[5])) )
+ else:
+ res.append( (list[0],list[1],list[2],float('nan'),float('nan'),float('nan')) )
return res
# .bed (PLINK binary biallelic genotype table)