diff options
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/my_pylmm/pyLMM/convertlmm.py | 3 | ||||
-rw-r--r-- | wqflask/wqflask/my_pylmm/pyLMM/runlmm.py | 15 |
2 files changed, 14 insertions, 4 deletions
diff --git a/wqflask/wqflask/my_pylmm/pyLMM/convertlmm.py b/wqflask/wqflask/my_pylmm/pyLMM/convertlmm.py index 8a1f03ad..89c09b1e 100644 --- a/wqflask/wqflask/my_pylmm/pyLMM/convertlmm.py +++ b/wqflask/wqflask/my_pylmm/pyLMM/convertlmm.py @@ -147,7 +147,8 @@ if options.geno: writer = open(options.prefix+".geno","w") wrln("# Genotype format version 1.0") wrln("# Individuals = "+str(num_inds)) - wrln("# Phenotypes = "+str(len(num_snps))) + wrln("# SNPs = "+str(len(num_snps))) + wrln("# Encoding = HAB") for i in range(num_inds): wr("\t"+str(i+1)) wr("\n") diff --git a/wqflask/wqflask/my_pylmm/pyLMM/runlmm.py b/wqflask/wqflask/my_pylmm/pyLMM/runlmm.py index 4398926f..ce8e32be 100644 --- a/wqflask/wqflask/my_pylmm/pyLMM/runlmm.py +++ b/wqflask/wqflask/my_pylmm/pyLMM/runlmm.py @@ -28,7 +28,8 @@ import csv usage = """ python runlmm.py [options] command - runlmm.py processing multiplexer reads standard input types and calls the routines + runlmm.py processing multiplexer reads standardised input formats + and calls the different routines Current commands are: @@ -88,6 +89,9 @@ if options.pheno: if options.geno: G1 = [] + hab_mapper = {'A':0,'H':1,'B':2,'-':3} + pylmm_mapper = [ 0.0, 0.5, 1.0, float('nan') ] + print options.geno with open(options.geno,'r') as tsvin: assert(tsvin.readline().strip() == "# Genotype format version 1.0") @@ -97,9 +101,14 @@ if options.geno: tsvin.readline() tsv = csv.reader(tsvin, delimiter='\t') for row in tsv: - print(row) + # print(row) + id = row[0] + gs = list(row[1]) + # print id,gs + gs2 = [pylmm_mapper[hab_mapper[g]] for g in gs] + # print id,gs2 # ns = np.genfromtxt(row[1:]) - G1.append(ns) # <--- slow + G1.append(gs2) # <--- slow G = np.array(G1) print G |