def _sq_run_file_attributes(converted_files): file_attributes = {} for index, file in enumerate(converted_files): file_attributes.update({ f'Files - {index} - File Core - File Name': dsp_attribute(file.get('name')), f'Files - {index} - File Core - Format': dsp_attribute(file.get('format')), f'Files - {index} - HCA File UUID': dsp_attribute(file.get('uuid')), f'Files - {index} - Read Index': dsp_attribute(file.get('read_index')), f'Files - {index} - Lane Index': dsp_attribute(file.get('lane_index')) }) return file_attributes
def nominal_value(*args): value = args[0] if value: value = str(args[0]) else: value = "0" return dsp_attribute(value)
def test_dsp_attribute(self): # given: string_attribute = dsp_attribute('name') numeric_attribute = dsp_attribute(28) falsy_attribute = dsp_attribute(0) # expect: self.assertEqual(1, len(string_attribute)) self.assertEqual('name', string_attribute[0].get('value')) # and: self.assertEqual(1, len(numeric_attribute)) self.assertEqual(28, numeric_attribute[0].get('value')) # and: self.assertEqual(1, len(falsy_attribute)) self.assertEqual(0, falsy_attribute[0].get('value')) # and: self.assertIsNone(dsp_attribute(None))
def instrument_model(*args): hca_name = args[0] return dsp_attribute(to_dsp_name(hca_name))
def _library_layout_attribute(*args): paired_end = args[0] value = 'PAIRED' if paired_end else 'SINGLE' return dsp_attribute(value)
def _map_primer(*args): primer = str(args[0]) mapping = _primer_mapping.get(primer) return dsp_attribute(mapping)
def derive_concrete_type(*args): schema_url = args[0] concrete_type = get_concrete_type(schema_url) return dsp_attribute(concrete_type)
def taxon_id_attribute(*args): ids: list = args[0] return dsp_attribute(ids[0])
def derive_concrete_type(*args): schema_url = args[0] concrete_type = schema_url.split('/')[-1] return dsp_attribute(concrete_type)