Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gga_load_data
Manage
Activity
Members
Labels
Plan
Issues
12
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
abims
e-infra
gga_load_data
Commits
b0ff7f5e
Commit
b0ff7f5e
authored
3 years ago
by
Loraine Gueguen
Browse files
Options
Downloads
Plain Diff
Merge branch 'picture' into 'dev'
fixes See merge request
!16
parents
dc04c84a
8c1e24f2
No related branches found
No related tags found
2 merge requests
!18
Release v2.1.0
,
!16
fixes
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
gga_init.py
+15
-13
15 additions, 13 deletions
gga_init.py
speciesData.py
+12
-10
12 additions, 10 deletions
speciesData.py
templates/gspecies_compose.yml.j2
+7
-7
7 additions, 7 deletions
templates/gspecies_compose.yml.j2
utilities.py
+17
-3
17 additions, 3 deletions
utilities.py
with
51 additions
and
33 deletions
gga_init.py
+
15
−
13
View file @
b0ff7f5e
...
...
@@ -38,7 +38,7 @@ class DeploySpeciesStack(speciesData.SpeciesData):
"""
def
make_directory_tree
(
self
):
def
make_directory_tree
(
self
,
picture_path
):
"""
Generate the directory tree for an organism
...
...
@@ -76,19 +76,19 @@ class DeploySpeciesStack(speciesData.SpeciesData):
logging
.
debug
(
"
Using default banner for Tripal pages
"
)
self
.
config
.
pop
(
constants
.
CONF_TRIPAL_BANNER_PATH
,
None
)
# Copy the organism picture for tripal
if one was specified in the input species
if
self
.
picture_path
is
not
None
:
if
os
.
path
.
isfile
(
self
.
picture_path
):
picture_path_basename
=
os
.
path
.
basename
(
self
.
picture_path
)
# Copy the organism picture for tripal
if
picture_path
is
not
None
:
if
os
.
path
.
isfile
(
picture_path
):
picture_path_basename
=
os
.
path
.
basename
(
picture_path
)
picture_path_filename
,
picture_path_extension
=
os
.
path
.
splitext
(
picture_path_basename
)
if
picture_path_extension
==
"
.png
"
or
picture_path_extension
==
"
.jpg
"
:
picture_dest_name
=
"
species%s
"
%
picture_path_extension
picture_dest_path
=
os
.
path
.
join
(
self
.
species_dir
,
picture_dest_name
)
shutil
.
copy
(
self
.
picture_path
,
picture_dest_path
)
shutil
.
copy
(
picture_path
,
picture_dest_path
)
else
:
logging
.
error
(
"
Specified organism picture has wrong extension (must be
'
.png
'
or
'
.jpg
'
): {0}
"
.
format
(
self
.
picture_path
))
logging
.
error
(
"
Specified organism picture has wrong extension (must be
'
.png
'
or
'
.jpg
'
): {0}
"
.
format
(
picture_path
))
else
:
logging
.
error
(
"
Specified organism picture not found {0} for {1}
"
.
format
(
self
.
picture_path
,
self
.
genus_uppercase
+
"
"
+
self
.
species
))
logging
.
error
(
"
Specified organism picture not found {0} for {1}
"
.
format
(
picture_path
,
self
.
genus_uppercase
+
"
"
+
self
.
species
))
# Create nginx dirs and write/re-write nginx conf
make_dirs
(
dir_paths_li
=
[
"
./nginx
"
,
"
./nginx/conf
"
])
...
...
@@ -127,10 +127,10 @@ class DeploySpeciesStack(speciesData.SpeciesData):
# Create input file vars dict
input_vars
=
{
"
genus
"
:
self
.
genus_lowercase
,
"
Genus
"
:
self
.
genus_uppercase
,
"
species
"
:
self
.
species
,
"
genus_species
"
:
self
.
genus_species
,
"
genus_species_strain_sex
"
:
self
.
species_folder_name
,
"
genus_species_sex
"
:
"
{0}_{1}_{2}
"
.
format
(
self
.
genus_lowercase
,
self
.
species
.
lower
(),
self
.
sex
),
"
strain
"
:
self
.
strain
,
"
sex
"
:
self
.
sex
,
"
Genus_species
"
:
self
.
genus_species
[
0
].
upper
()
+
self
.
genus_species
[
1
:]
,
"
blast
"
:
self
.
blast
,
"
picture_path
"
:
self
.
picture_path
}
"
genus_species
"
:
self
.
genus_species
,
"
genus_species_strain_sex
"
:
self
.
species_folder_name
,
"
genus_species_sex
"
:
"
{0}_{1}_{2}
"
.
format
(
self
.
genus_lowercase
,
self
.
species
_
lower
(),
self
.
sex
),
"
strain
"
:
self
.
strain
,
"
sex
"
:
self
.
sex
,
"
Genus_species
"
:
"
{0} {1}
"
.
format
(
self
.
genus_uppercase
,
self
.
species_lower
())
,
"
blast
"
:
self
.
blast
,
"
picture_path
"
:
self
.
picture_path
}
if
(
len
(
self
.
config
.
keys
())
==
0
):
logging
.
error
(
"
Empty config dictionary
"
)
# Merge the two dicts
...
...
@@ -402,6 +402,7 @@ if __name__ == "__main__":
make_traefik_compose_files
(
config
=
config
,
main_dir
=
main_dir
)
unique_sp_dict_list
=
utilities
.
get_unique_species_dict_list
(
sp_dict_list
=
sp_dict_list
)
sp_picture_dict
=
utilities
.
get_sp_picture
(
sp_dict_list
=
sp_dict_list
)
logging
.
info
(
"
Deploying stacks for organisms in input file %s
"
%
args
.
input
)
for
sp_dict
in
unique_sp_dict_list
:
...
...
@@ -422,7 +423,8 @@ if __name__ == "__main__":
logging
.
info
(
"
gga_init.py called for %s %s
"
,
deploy_stack_for_current_organism
.
genus
,
deploy_stack_for_current_organism
.
species
)
# Make/update directory tree
deploy_stack_for_current_organism
.
make_directory_tree
()
picture_path
=
sp_picture_dict
[
deploy_stack_for_current_organism
.
genus_species
]
deploy_stack_for_current_organism
.
make_directory_tree
(
picture_path
)
logging
.
info
(
"
Successfully generated the directory tree for %s %s
"
,
deploy_stack_for_current_organism
.
genus
,
deploy_stack_for_current_organism
.
species
)
# Make compose files
...
...
This diff is collapsed.
Click to expand it.
speciesData.py
+
12
−
10
View file @
b0ff7f5e
...
...
@@ -93,20 +93,25 @@ class SpeciesData:
else
:
self
.
picture_path
=
None
self
.
genus_lowercase
=
self
.
genus
[
0
].
lower
()
+
self
.
genus
[
1
:]
self
.
genus_uppercase
=
self
.
genus
[
0
].
upper
()
+
self
.
genus
[
1
:]
self
.
genus_lowercase
=
self
.
genus
.
lower
()
self
.
species_lower
=
self
.
species
.
lower
()
self
.
genus_uppercase
=
self
.
genus
[
0
].
upper
()
+
self
.
genus_lowercase
[
1
:]
self
.
genus_species
=
"
{0}_{1}
"
.
format
(
self
.
genus_lowercase
,
self
.
species_lower
)
self
.
chado_species_name
=
"
{0} {1}
"
.
format
(
self
.
species
,
self
.
sex
)
self
.
full_name
=
'
'
.
join
(
utilities
.
filter_empty_not_empty_items
([
self
.
genus_uppercase
,
self
.
species
,
self
.
strain
,
self
.
sex
])[
"
not_empty
"
])
self
.
full_name_lowercase
=
self
.
full_name
.
lower
()
self
.
abbreviation
=
"
_
"
.
join
(
utilities
.
filter_empty_not_empty_items
([
self
.
genus_lowercase
[
0
],
self
.
species
,
self
.
strain
,
self
.
sex
])[
"
not_empty
"
])
self
.
genus_species
=
"
{0}_{1}
"
.
format
(
self
.
genus
.
lower
(),
self
.
species
.
lower
())
self
.
species_folder_name
=
"
_
"
.
join
(
utilities
.
filter_empty_not_empty_items
(
[
self
.
genus_lowercase
,
self
.
species_lower
(),
self
.
strain
.
lower
(),
self
.
sex
.
lower
()])[
"
not_empty
"
])
self
.
dataset_prefix
=
None
if
self
.
sex
is
not
None
or
self
.
sex
!=
""
:
self
.
dataset_prefix
=
self
.
genus
[
0
].
lower
()
+
"
_
"
+
self
.
species
.
lower
()
+
"
_
"
+
self
.
sex
[
0
].
lower
()
self
.
dataset_prefix
=
self
.
genus
[
0
].
lower
()
+
"
_
"
+
self
.
species
_
lower
+
"
_
"
+
self
.
sex
[
0
].
lower
()
else
:
self
.
dataset_prefix
=
self
.
genus
[
0
].
lower
()
+
"
_
"
+
self
.
species
.
lower
()
self
.
dataset_prefix
=
self
.
genus
[
0
].
lower
()
+
"
_
"
+
self
.
species
_
lower
# Bioblend/Chado IDs for an organism analyses/organisms/datasets/history/library
self
.
org_id
=
None
...
...
@@ -131,6 +136,3 @@ class SpeciesData:
self
.
api_key
=
None
# API key used to communicate with the galaxy instance. Cannot be used to do user-tied actions
self
.
datasets
=
dict
()
self
.
config
=
None
# Custom config used to set environment variables inside containers
self
.
species_folder_name
=
"
_
"
.
join
(
utilities
.
filter_empty_not_empty_items
(
[
self
.
genus_lowercase
.
lower
(),
self
.
species
.
lower
(),
self
.
strain
.
lower
(),
self
.
sex
.
lower
()])[
"
not_empty
"
])
This diff is collapsed.
Click to expand it.
templates/gspecies_compose.yml.j2
+
7
−
7
View file @
b0ff7f5e
...
...
@@ -38,18 +38,18 @@ services:
- ./docker_data/galaxy/:/export/:ro
- ./src_data/:/project_data/:ro
- ./src_data:/data:ro
{% if 'tripal_banner_path' is defined %}
{% if 'tripal_banner_path' is defined %}
- ./banner.png:/var/www/html/banner.png:ro
{% endif %}
{% endif %}
#- /groups/XXX/:/groups/XXX/:ro # We do this when we have symlinks in src_data pointing to /groups/XXX/...
{% if 'picture_path' is defined %}
{% if 'png' in picture_path %}
{% if 'picture_path' is defined %}
{% if 'png' in picture_path %}
- ./species.png:/var/www/html/species.png:ro
{% endif %}
{% if 'jpg' in picture_path %}
{% endif %}
{% if 'jpg' in picture_path %}
- ./species.jpg:/var/www/html/species.jpg:ro
{% endif %}
{% endif %}
{% endif %}
environment:
DB_HOST: tripal-db.{{ genus_species }}
BASE_URL_PATH: /sp/{{ genus_species }}
...
...
This diff is collapsed.
Click to expand it.
utilities.py
+
17
−
3
View file @
b0ff7f5e
...
...
@@ -162,14 +162,28 @@ def get_unique_species_dict_list(sp_dict_list):
if
gspecies
not
in
unique_species_dict
.
keys
()
or
(
constants
.
ORG_PARAM_DESC_MAIN_SPECIES
in
sp
[
constants
.
ORG_PARAM_DESC
].
keys
()
and
sp
[
constants
.
ORG_PARAM_DESC
][
constants
.
ORG_PARAM_DESC_MAIN_SPECIES
]
==
True
)
:
unique_species_dict
[
gspecies
]
=
sp
else
:
continue
for
k
,
v
in
unique_species_dict
.
items
():
unique_species_list_of_dict
.
append
(
v
)
return
unique_species_list_of_dict
def
get_sp_picture
(
sp_dict_list
):
"""
Get the picture for each species: the picture of the main strain if exists, other strain if not
"""
sp_picture_dict
=
{}
for
sp
in
sp_dict_list
:
gspecies
=
get_gspecies_string_from_sp_dict
(
sp
)
if
gspecies
not
in
sp_picture_dict
.
keys
()
or
(
constants
.
ORG_PARAM_DESC_MAIN_SPECIES
in
sp
[
constants
.
ORG_PARAM_DESC
].
keys
()
and
sp
[
constants
.
ORG_PARAM_DESC
][
constants
.
ORG_PARAM_DESC_MAIN_SPECIES
]
==
True
):
if
sp
[
constants
.
ORG_PARAM_DESC_PICTURE_PATH
]
!=
""
:
sp_picture_dict
[
gspecies
]
=
sp
[
constants
.
ORG_PARAM_DESC_PICTURE_PATH
]
return
sp_picture_dict
def
run_tool
(
instance
,
tool_id
,
history_id
,
tool_inputs
):
output_dict
=
None
...
...
@@ -223,4 +237,4 @@ def create_org_param_dict_from_constants():
org_param_dict
[
"
org_param_services
"
]
=
constants
.
ORG_PARAM_SERVICES
org_param_dict
[
"
org_param_services_blast
"
]
=
constants
.
ORG_PARAM_SERVICES_BLAST
return
org_param_dict
\ No newline at end of file
return
org_param_dict
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment