PageRenderTime 12ms CodeModel.GetById 8ms RepoModel.GetById 0ms app.codeStats 0ms

/tools/rgenetics/rgGLM_code.py

https://bitbucket.org/cistrome/cistrome-harvard/
Python | 23 lines | 20 code | 2 blank | 1 comment | 0 complexity | cb712e2f72adeb567e5ba0c8703b4fe0 MD5 | raw file
  1. # before running the qc, need to rename various output files
  2. import os,string,time
  3. from galaxy import datatypes
  4. def get_phecols(phef='',selectOne=0):
  5. """return column names """
  6. phepath = phef.extra_files_path
  7. phename = phef.metadata.base_name
  8. phe = os.path.join(phepath,'%s.pphe' % phename)
  9. head = open(phe,'r').next()
  10. c = head.strip().split()[2:] # first are fid,iid
  11. res = [(cname,cname,False) for cname in c]
  12. if len(res) >= 1:
  13. if selectOne:
  14. x,y,z = res[0] # 0,1 = fid,iid
  15. res[0] = (x,y,True) # set second selected
  16. else:
  17. res.insert(0,('None','None',True))
  18. else:
  19. res = [('None','no phenotype columns found',False),]
  20. return res