Mercurial > repos > rv43 > tomo
comparison workflow/link_to_galaxy.py @ 71:1cf15b61cd83 draft
planemo upload for repository https://github.com/rolfverberg/galaxytools commit 366e516aef0735af2998c6ff3af037181c8d5213
author | rv43 |
---|---|
date | Mon, 20 Mar 2023 13:56:57 +0000 |
parents | fba792d5f83b |
children |
comparison
equal
deleted
inserted
replaced
70:97c4e2cbbad9 | 71:1cf15b61cd83 |
---|---|
35 return (library_id, folder_id, new_folders) | 35 return (library_id, folder_id, new_folders) |
36 | 36 |
37 def link_to_galaxy(filename:str, galaxy=None, user=None, password=None, api_key=None) -> None: | 37 def link_to_galaxy(filename:str, galaxy=None, user=None, password=None, api_key=None) -> None: |
38 # Read input file | 38 # Read input file |
39 extension = path.splitext(filename)[1] | 39 extension = path.splitext(filename)[1] |
40 if extension == '.yml' or extension == '.yaml': | 40 # RV yaml input not incorporated yet, since Galaxy can't use pyspec right now |
41 with open(filename, 'r') as f: | 41 # if extension == '.yml' or extension == '.yaml': |
42 data = safe_load(f) | 42 # with open(filename, 'r') as f: |
43 elif extension == '.nxs': | 43 # data = safe_load(f) |
44 # elif extension == '.nxs': | |
45 if extension == '.nxs': | |
44 with NXFile(filename, mode='r') as nxfile: | 46 with NXFile(filename, mode='r') as nxfile: |
45 data = nxfile.readfile() | 47 data = nxfile.readfile() |
46 else: | 48 else: |
47 raise ValueError(f'Invalid filename extension ({extension})') | 49 raise ValueError(f'Invalid filename extension ({extension})') |
48 if isinstance(data, dict): | 50 if isinstance(data, dict): |
51 if len(wf.sample_maps) > 1: | 53 if len(wf.sample_maps) > 1: |
52 raise ValueError(f'Multiple sample maps not yet implemented') | 54 raise ValueError(f'Multiple sample maps not yet implemented') |
53 nxroot = NXroot() | 55 nxroot = NXroot() |
54 for sample_map in wf.sample_maps: | 56 for sample_map in wf.sample_maps: |
55 import_scanparser(sample_map.station) | 57 import_scanparser(sample_map.station) |
56 sample_map.construct_nxentry(nxroot, include_raw_data=False) | 58 # RV raw data must be included, since Galaxy can't use pyspec right now |
59 # sample_map.construct_nxentry(nxroot, include_raw_data=False) | |
60 sample_map.construct_nxentry(nxroot, include_raw_data=True) | |
57 nxentry = nxroot[nxroot.attrs['default']] | 61 nxentry = nxroot[nxroot.attrs['default']] |
58 elif isinstance(data, NXroot): | 62 elif isinstance(data, NXroot): |
59 nxentry = data[data.attrs['default']] | 63 nxentry = data[data.attrs['default']] |
60 else: | 64 else: |
61 raise ValueError(f'Invalid input file data ({data})') | 65 raise ValueError(f'Invalid input file data ({data})') |