annotate tools/rgenetics/rgGLM_code.py @ 0:9071e359b9a3

Uploaded
author xuebing
date Fri, 09 Mar 2012 19:37:19 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
1 # before running the qc, need to rename various output files
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
2 import os,string,time
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
3 from galaxy import datatypes
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
4
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
5
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
6 def get_phecols(phef='',selectOne=0):
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
7 """return column names """
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
8 phepath = phef.extra_files_path
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
9 phename = phef.metadata.base_name
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
10 phe = os.path.join(phepath,'%s.pphe' % phename)
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
11 head = open(phe,'r').next()
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
12 c = head.strip().split()[2:] # first are fid,iid
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
13 res = [(cname,cname,False) for cname in c]
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
14 if len(res) >= 1:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
15 if selectOne:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
16 x,y,z = res[0] # 0,1 = fid,iid
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
17 res[0] = (x,y,True) # set second selected
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
18 else:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
19 res.insert(0,('None','None',True))
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
20 else:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
21 res = [('None','no phenotype columns found',False),]
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
22 return res
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
23