diff data_manager/data_manager_selection_background.py @ 3:10ac95ec81d9 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_selection_background commit bbba39ae993250a1e7301965b03c12621513775e"
author iuc
date Wed, 25 Aug 2021 21:07:59 +0000
parents e4f07770b340
children
line wrap: on
line diff
--- a/data_manager/data_manager_selection_background.py	Tue Aug 24 17:58:31 2021 +0000
+++ b/data_manager/data_manager_selection_background.py	Wed Aug 25 21:07:59 2021 +0000
@@ -111,21 +111,24 @@
     parser.add_argument('--dataset', dest='dataset', action='store', help='Path for the sequences')
 
     args = parser.parse_args()
-
-    work_dir = os.getcwd()
+    dbkey = str(args.dbkey)
 
     if args.uri is not None:
         background_fasta = url_download(args.uri)
     else:
         background_fasta = args.dataset
 
-    table_entry = '%s.fa' % args.dbkey
-    shutil.copy(background_fasta, os.path.join(work_dir, table_entry))
+    with open(args.output) as fh:
+        params = json.load(fh)
+    target_directory = params['output_data'][0]['extra_files_path']
+    os.makedirs(target_directory, exist_ok=True)
+    table_entry = '%s.fa' % dbkey
+    shutil.copy(background_fasta, os.path.join(target_directory, table_entry))
 
     # Update Data Manager JSON and write to file
     data_manager_entry = {
         'data_tables': {
-            'selection_background': {'value': args.dbkey, 'label': args.label, 'path': table_entry}
+            'selection_background': {'value': dbkey, 'label': args.label, 'path': table_entry}
         }
     }