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

/tools/samtools/sam_merge_code.py

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