PageRenderTime 23ms CodeModel.GetById 20ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/tools/samtools/sam_merge_code.py

https://bitbucket.org/cistrome/cistrome-harvard/
Python | 34 lines | 18 code | 1 blank | 15 comment | 10 complexity | a853da14f1583d2b5fd81d8a8a4ed27d MD5 | raw file
 1from galaxy.tools.parameters import DataToolParameter
 2
 3def validate_input( trans, error_map, param_values, page_param_map ):
 4    dbkeys = set()
 5    data_param_names = set()
 6    data_params = 0
 7    for name, param in page_param_map.iteritems():
 8        if isinstance( param, DataToolParameter ):
 9            # for each dataset parameter
10            if param_values.get(name, None) != None:
11                dbkeys.add( param_values[name].dbkey )
12                data_params += 1
13                # check meta data
14#                try:
15#                    param = param_values[name]
16#                    startCol = int( param.metadata.startCol )
17#                    endCol = int( param.metadata.endCol )
18#                    chromCol = int( param.metadata.chromCol )
19#                    if param.metadata.strandCol is not None:
20#                        strandCol = int ( param.metadata.strandCol )
21#                    else:
22#                        strandCol = 0
23#                except:
24#                    error_msg = "The attributes of this dataset are not properly set. " + \
25#                    "Click the pencil icon in the history item to set the chrom, start, end and strand columns."
26#                    error_map[name] = error_msg
27            data_param_names.add( name )
28    if len( dbkeys ) > 1:
29        for name in data_param_names:
30            error_map[name] = "All datasets must belong to same genomic build, " \
31                "this dataset is linked to build '%s'" % param_values[name].dbkey
32    if data_params != len(data_param_names):
33        for name in data_param_names:
34            error_map[name] = "A dataset of the appropriate type is required"