comparison hubArchiveCreator.py @ 5:fcff8e9146e7 draft

planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 8fa0bb53e1bd6c4d7e3b0d9ea2f86825040e29de-dirty
author rmarenco
date Mon, 18 Jul 2016 12:40:30 -0400
parents fb5e60d4d18a
children 4f9847539a28
comparison
equal deleted inserted replaced
4:1b653b332695 5:fcff8e9146e7
83 array_inputs_bigwig = args.bigwig 83 array_inputs_bigwig = args.bigwig
84 84
85 outputFile = args.output 85 outputFile = args.output
86 json_inputs_data = args.data_json 86 json_inputs_data = args.data_json
87 87
88 inputs_data = json.loads(json_inputs_data)
89
90 # We remove the spaces in ["name"] of inputs_data
91 sanitize_name_inputs(inputs_data)
92
93 json_inputs_data = args.data_json 88 json_inputs_data = args.data_json
94 89
95 inputs_data = json.loads(json_inputs_data) 90 inputs_data = json.loads(json_inputs_data)
96 # We remove the spaces in ["name"] of inputs_data 91 # We remove the spaces in ["name"] of inputs_data
97 sanitize_name_inputs(inputs_data) 92 sanitize_name_inputs(inputs_data)
98 93
99 if args.directory: 94 if args.directory:
100 toolDirectory = args.directory 95 toolDirectory = args.directory
101 if args.extra_files_path: 96 if args.extra_files_path:
102 extra_files_path = args.extra_files_path 97 extra_files_path = args.extra_files_path
103 if args.ucsc_tools_path:
104 ucsc_tools_path = args.ucsc_tools_path
105 98
106 # TODO: Check here all the binaries / tools we need. Exception is missing 99 # TODO: Check here all the binaries / tools we need. Exception is missing
107 100
108 # Create the Track Hub folder 101 # Create the Track Hub folder
109 trackHub = TrackHub(input_fasta_file, outputFile, extra_files_path, toolDirectory) 102 trackHub = TrackHub(input_fasta_file, outputFile, extra_files_path, toolDirectory)
156 149
157 150
158 def sanitize_name_inputs(inputs_data): 151 def sanitize_name_inputs(inputs_data):
159 """ 152 """
160 Sometimes output from Galaxy, or even just file name from user have spaces 153 Sometimes output from Galaxy, or even just file name from user have spaces
154 Also, it can contain '/' character and could break the use of os.path function
161 :param inputs_data: dict[string, dict[string, string]] 155 :param inputs_data: dict[string, dict[string, string]]
162 :return: 156 :return:
163 """ 157 """
164 for key in inputs_data: 158 for key in inputs_data:
165 inputs_data[key]["name"] = inputs_data[key]["name"].replace(" ", "_") 159 inputs_data[key]["name"] = inputs_data[key]["name"]\
160 .replace("/", "_")\
161 .replace(" ", "_")
166 162
167 163
168 def create_ordered_datatype_objects(ExtensionClass, array_inputs, inputs_data, input_fasta_file, 164 def create_ordered_datatype_objects(ExtensionClass, array_inputs, inputs_data, input_fasta_file,
169 extra_files_path, all_datatype_dictionary, tool_directory): 165 extra_files_path, all_datatype_dictionary, tool_directory):
170 """ 166 """