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
b59d2a28
Commit
b59d2a28
authored
3 years ago
by
Loraine Gueguen
Browse files
Options
Downloads
Patches
Plain Diff
fix get_history
parent
6c86b6f9
No related branches found
No related tags found
2 merge requests
!24
Run wf
,
!18
Release v2.1.0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gga_load_data.py
+4
-23
4 additions, 23 deletions
gga_load_data.py
speciesData.py
+1
-0
1 addition, 0 deletions
speciesData.py
utilities_bioblend.py
+10
-7
10 additions, 7 deletions
utilities_bioblend.py
with
15 additions
and
30 deletions
gga_load_data.py
+
4
−
23
View file @
b59d2a28
...
...
@@ -2,7 +2,6 @@
# -*- coding: utf-8 -*-
import
re
import
bioblend
import
argparse
import
os
import
logging
...
...
@@ -39,27 +38,6 @@ class LoadData(speciesData.SpeciesData):
self
.
bam_metadata_cache
=
{}
super
().
__init__
(
parameters_dictionary
)
def
get_history
(
self
):
"""
Create or set the working history to the current species one
:return:
"""
try
:
histories
=
self
.
instance
.
histories
.
get_histories
(
name
=
str
(
self
.
genus_species
))
if
len
(
histories
)
==
1
:
self
.
history_id
=
histories
[
0
][
"
id
"
]
logging
.
debug
(
"
History ID set for {0} {1}: {2}
"
.
format
(
self
.
genus
,
self
.
species
,
self
.
history_id
))
else
:
logging
.
critical
(
"
Multiple histories exists for {0}: {1}
"
.
format
(
self
.
genus
,
self
.
species
))
except
IndexError
:
logging
.
info
(
"
Creating history for {0} {1}
"
.
format
(
self
.
genus
,
self
.
species
))
hist_dict
=
self
.
instance
.
histories
.
create_history
(
name
=
str
(
self
.
genus_species
))
self
.
history_id
=
hist_dict
[
"
id
"
]
logging
.
debug
(
"
History ID set for {0} {1}: {2}
"
.
format
(
self
.
genus
,
self
.
species
,
self
.
history_id
))
return
self
.
history_id
def
remove_homo_sapiens_from_db
(
self
):
"""
Run the GMOD tool to remove the
"
Homo sapiens
"
default organism from the original database
...
...
@@ -304,6 +282,7 @@ if __name__ == "__main__":
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
else
:
logging
.
basicConfig
(
level
=
logging
.
INFO
)
logging
.
getLogger
(
"
urllib3
"
).
setLevel
(
logging
.
INFO
)
# Parsing the config file if provided, using the default config otherwise
if
args
.
config
:
...
...
@@ -360,7 +339,9 @@ if __name__ == "__main__":
logging
.
debug
(
"
Successfully set up library in galaxy for {0} {1}
"
.
format
(
load_data_for_current_species
.
genus
,
load_data_for_current_species
.
species
))
# Set or get the history for the current organism
load_data_for_current_species
.
get_history
()
load_data_for_current_species
.
history_id
=
utilities_bioblend
.
get_history
(
instance
=
load_data_for_current_species
.
instance
,
history_name
=
load_data_for_current_species
.
history_name
)
# Remove H. sapiens from database if here
# TODO: set a dedicated history for removing H. sapiens (instead of doing it into a species history)
...
...
This diff is collapsed.
Click to expand it.
speciesData.py
+
1
−
0
View file @
b59d2a28
...
...
@@ -139,4 +139,5 @@ class SpeciesData:
self
.
instance_url
=
None
self
.
instance
=
None
self
.
history_id
=
None
self
.
history_name
=
str
(
self
.
genus_species
)
self
.
library_id
=
None
This diff is collapsed.
Click to expand it.
utilities_bioblend.py
+
10
−
7
View file @
b59d2a28
...
...
@@ -34,21 +34,24 @@ def get_galaxy_instance(instance_url, email, password):
return
instance
def
get_history
(
instance
,
history_name
):
"""
Create or set the working history to the current species one
:return:
"""
try
:
histories
=
instance
.
histories
.
get_histories
(
name
=
history_name
)
history_id
=
histories
[
0
][
"
id
"
]
logging
.
debug
(
"
History ID set for {0}: {1}
"
.
format
(
history_name
,
history_id
))
except
IndexError
:
histories
=
instance
.
histories
.
get_histories
(
name
=
str
(
history_name
))
if
len
(
histories
)
==
0
:
logging
.
info
(
"
Creating history for %s
"
%
history_name
)
hist
ory
=
instance
.
histories
.
create_history
(
name
=
history_name
)
history_id
=
hist
ory
[
"
id
"
]
hist
_dict
=
instance
.
histories
.
create_history
(
name
=
str
(
history_name
)
)
history_id
=
hist
_dict
[
"
id
"
]
logging
.
debug
(
"
History ID set for {0}: {1}
"
.
format
(
history_name
,
history_id
))
if
len
(
histories
)
==
1
:
history_id
=
histories
[
0
][
"
id
"
]
logging
.
debug
(
"
History ID set for {0}: {1}
"
.
format
(
history_name
,
history_id
))
else
:
logging
.
critical
(
"
Multiple histories exists for {0}
"
.
format
(
history_name
))
return
history_id
...
...
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