comparison tools/rgenetics/rgQQ_code.py @ 0:9071e359b9a3

Uploaded
author xuebing
date Fri, 09 Mar 2012 19:37:19 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:9071e359b9a3
1 # before running the qc, need to rename various output files
2 # <data format="html" name="html_file" />
3 # <data format="txt" name="log_file" parent="html_file" />
4 # <data format="tabular" name="marker_file" parent="html_file" />
5 # <data format="tabular" name="subject_file" parent="html_file" />
6
7 from galaxy import datatypes,model
8 import sys,string
9
10 def get_columns( input ):
11 columns = []
12 elems = []
13 if input and input.metadata.columns:
14 ncols = input.metadata.columns
15 colnames = ['Col%d' % x for x in range(1,ncols+1)]
16 for i, line in enumerate( file ( input.file_name ) ):
17 valid = True
18 if line and not line.startswith( '#' ):
19 line = line.rstrip('\r\n')
20 elems = line.split( '\t' )
21
22 """
23 Since this tool requires users to select only those columns
24 that contain numerical values, we'll restrict the column select
25 list appropriately.
26 """
27 if len(elems) > 0:
28 for col in range(len(elems)): # zero offset
29 if i == 0: # header row
30 colnames[col] = elems[col]
31 else:
32 val = elems[col]
33 try:
34 val = float(val)
35 valid = True
36 except:
37 valid = False
38 if valid:
39 option = colnames[col]
40 columns.append((option,str(col),False))
41 if len(columns) > 0:
42 """
43 We have our select list built, so we can break out of the outer most for loop
44 """
45 break
46 if i == 30:
47 break # Hopefully we never get here...
48 else:
49 columns = [('?','?',False),]
50 return columns