Skip to content
Snippets Groups Projects

Release 2.0

Merged Loraine Gueguen requested to merge release_2.0 into dev
Files
2
+ 11
5
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import bioblend
import argparse
@@ -28,6 +29,8 @@ Do not call this script before the galaxy container is ready
GET_ORGANISMS_TOOL = "toolshed.g2.bx.psu.edu/repos/gga/chado_organism_get_organisms/organism_get_organisms/2.3.4+galaxy0"
DELETE_ORGANISMS_TOOL = "toolshed.g2.bx.psu.edu/repos/gga/chado_organism_delete_organisms/organism_delete_organisms/2.3.4+galaxy0"
HOST_DATA_DIR='src_data'
CONTAINER_DATA_DIR_ROOT='/project_data'
class LoadData(speciesData.SpeciesData):
"""
@@ -101,7 +104,7 @@ class LoadData(speciesData.SpeciesData):
return histories
def setup_library(self, data_dir_root='./src_data'):
def setup_library(self):
"""
Create a "Project Data" library in galaxy, mirroring the "src_data" folder of the current organism
directory tree
@@ -109,7 +112,7 @@ class LoadData(speciesData.SpeciesData):
:return:
"""
self.goto_species_dir()
data_dir_root=os.path.join(self.get_species_dir(), HOST_DATA_DIR)
instance = GalaxyInstance(url=self.instance_url,
email=self.config["galaxy_default_admin_email"],
@@ -139,7 +142,7 @@ class LoadData(speciesData.SpeciesData):
for fname, files in folders.items():
if fname and files:
folder_name = fname[len(data_dir_root) + 1:]
folder_name = re.sub(data_dir_root, CONTAINER_DATA_DIR_ROOT, fname)
logging.info("Creating folder: %s" % folder_name)
folder = self.create_deep_folder(prj_lib, folder_name)
@@ -181,9 +184,12 @@ class LoadData(speciesData.SpeciesData):
logging.info("Skipping useless file '%s'" % single_file)
continue
logging.info("Adding file '%s' with type '%s' and name '%s'" % (single_file, ftype, clean_name))
single_file_relative_path = re.sub(data_dir_root, CONTAINER_DATA_DIR_ROOT, single_file)
single_file_path_in_container=os.path.join(CONTAINER_DATA_DIR_ROOT, single_file_relative_path)
logging.info("Adding file '%s' with type '%s' and name '%s'" % (single_file_path_in_container, ftype, clean_name))
datasets = prj_lib.upload_from_galaxy_fs(
single_file,
single_file_path_in_container,
folder=folder,
link_data_only='link_to_files',
file_type=ftype,
Loading