aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorPjotr Prins2015-03-09 14:37:04 +0300
committerPjotr Prins2015-03-09 14:37:04 +0300
commitd924bc5842d2813aad8359b9cb614c2a87df1ee9 (patch)
treea1e5fc45ffc0ad4fd0ee97f18354df185eebe28f /wqflask
parent60ef29c2b003f9d9a76d901ca4107b8cce3b9799 (diff)
downloadgenenetwork2-d924bc5842d2813aad8359b9cb614c2a87df1ee9.tar.gz
plink: missing values in bim
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)