annotate tools/samtools/sam_merge_code.py @ 1:cdcb0ce84a1b

Uploaded
author xuebing
date Fri, 09 Mar 2012 19:45:15 -0500
parents 9071e359b9a3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
1 from galaxy.tools.parameters import DataToolParameter
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
2
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
3 def validate_input( trans, error_map, param_values, page_param_map ):
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
4 dbkeys = set()
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
5 data_param_names = set()
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
6 data_params = 0
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
7 for name, param in page_param_map.iteritems():
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
8 if isinstance( param, DataToolParameter ):
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
9 # for each dataset parameter
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
10 if param_values.get(name, None) != None:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
11 dbkeys.add( param_values[name].dbkey )
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
12 data_params += 1
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
13 # check meta data
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
14 # try:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
15 # param = param_values[name]
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
16 # startCol = int( param.metadata.startCol )
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
17 # endCol = int( param.metadata.endCol )
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
18 # chromCol = int( param.metadata.chromCol )
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
19 # if param.metadata.strandCol is not None:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
20 # strandCol = int ( param.metadata.strandCol )
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
21 # else:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
22 # strandCol = 0
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
23 # except:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
24 # error_msg = "The attributes of this dataset are not properly set. " + \
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
25 # "Click the pencil icon in the history item to set the chrom, start, end and strand columns."
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
26 # error_map[name] = error_msg
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
27 data_param_names.add( name )
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
28 if len( dbkeys ) > 1:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
29 for name in data_param_names:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
30 error_map[name] = "All datasets must belong to same genomic build, " \
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
31 "this dataset is linked to build '%s'" % param_values[name].dbkey
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
32 if data_params != len(data_param_names):
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
33 for name in data_param_names:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
34 error_map[name] = "A dataset of the appropriate type is required"