Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Packages
chemical_checker
Commits
7f356ea1
Commit
7f356ea1
authored
Dec 23, 2021
by
Martina Locatelli
🍁
Browse files
Rearranging steps order in cc_web and fixing small bug for overwrite parameter in similars.py
parent
8374931b
Pipeline
#2597
passed with stages
in 94 minutes and 48 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
package/chemicalchecker/util/pipeline/tasks_web/scripts/similars.py
View file @
7f356ea1
...
...
@@ -37,11 +37,10 @@ save_file_path = sys.argv[5]
dbname
=
sys
.
argv
[
6
]
version
=
sys
.
argv
[
7
]
CC_ROOT
=
sys
.
argv
[
8
]
overwrite
=
Tru
e
overwrite
=
Fals
e
# input is a chunk of universe inchikey
inchikeys
=
pickle
.
load
(
open
(
filename
,
'rb'
))[
task_id
]
# for each molecule check if json is already available
if
not
overwrite
:
notdone
=
list
()
...
...
@@ -61,7 +60,7 @@ if not overwrite:
print
(
'All molecules already present, nothing to do.'
)
sys
.
exit
()
else
:
inchikey
=
notdone
inchikey
s
=
notdone
# for each molecule which spaces are available in sign1?
print
(
'for each molecule which spaces are available in sign1?'
)
...
...
pipelines/cc_web.py
View file @
7f356ea1
...
...
@@ -172,11 +172,12 @@ def main(args):
universe_list
=
cc
.
get_signature
(
'sign3'
,
'full'
,
'A1.001'
).
keys
universe_file
=
os
.
path
.
join
(
cachedir
,
"universe.h5"
)
with
h5py
.
File
(
universe_file
,
"w"
)
as
h5
:
h5
.
create_dataset
(
"keys"
,
data
=
np
.
array
(
universe_list
,
DataSignature
.
string_dtype
()))
h5
.
create_dataset
(
"keys"
,
data
=
DataSignature
.
h5_str
(
universe_list
))
# h5.create_dataset("keys", data=np.array(
# universe_list, DataSignature.string_dtype()))
# also save as json (used by the web)
bioactive_mol_set
=
os
.
path
.
join
(
cachedir
,
"bioactive_mol_set.json"
)
json
.
dump
(
universe_list
,
open
(
bioactive_mol_set
,
'w'
))
json
.
dump
(
universe_list
.
tolist
()
,
open
(
bioactive_mol_set
,
'w'
))
universe_task
=
PythonCallable
(
name
=
"create_universe"
,
python_callable
=
create_uni_fn
,
...
...
@@ -240,14 +241,8 @@ def main(args):
libraries
=
libraries
)
pp
.
add_task
(
libs_task
)
# TASK: Create json of similar molecules for explore page
similars_task
=
Similars
(
name
=
'similars'
,
DB
=
args
.
new_web_db
,
CC_ROOT
=
args
.
cc_root
,
MOLECULES_PATH
=
args
.
molecule_path
)
pp
.
add_task
(
similars_task
)
# TASK: Link/copy generated files to webpage repository (mosaic)
def
links_to_web_repo
(
cc_root
,
web_repo_path
,
tmpdir
):
def
links_to_web_repo
(
cc_root
,
web_repo_path
,
tmpdir
,
cachedir
):
# link plots dir
src_dir
=
os
.
path
.
join
(
cc_root
,
'plots_web'
)
if
not
os
.
path
.
isdir
(
src_dir
):
...
...
@@ -269,7 +264,7 @@ def main(args):
os
.
remove
(
dst_dir
)
os
.
symlink
(
src_dir
,
dst_dir
)
# copy bioactive_mol_set.json (aka cc universe)
src_path
=
os
.
path
.
join
(
tmp
dir
,
'bioactive_mol_set.json'
)
src_path
=
os
.
path
.
join
(
cache
dir
,
'bioactive_mol_set.json'
)
dst_path
=
os
.
path
.
join
(
web_repo_path
,
'app'
,
'shared'
,
'data'
,
'bioactive_mol_set.json'
)
shutil
.
copyfile
(
src_path
,
dst_path
)
...
...
@@ -291,7 +286,7 @@ def main(args):
links_task
=
PythonCallable
(
name
=
"links_to_web_repo"
,
python_callable
=
links_to_web_repo
,
op_args
=
[
args
.
cc_root
,
args
.
web_repo_path
,
pp
.
tmpdir
])
op_args
=
[
args
.
cc_root
,
args
.
web_repo_path
,
pp
.
tmpdir
,
pp
.
cachedir
])
pp
.
add_task
(
links_task
)
# TASK: Export signature 3 to ftp directory
...
...
@@ -308,6 +303,12 @@ def main(args):
op_args
=
[
args
.
cc_root
])
pp
.
add_task
(
export_task
)
# TASK: Create json of similar molecules for explore page
similars_task
=
Similars
(
name
=
'similars'
,
DB
=
args
.
new_web_db
,
CC_ROOT
=
args
.
cc_root
,
MOLECULES_PATH
=
args
.
molecule_path
)
pp
.
add_task
(
similars_task
)
# RUN the pipeline!
main
.
_log
.
info
(
'TASK SEQUENCE: %s'
%
', '
.
join
([
t
.
name
for
t
in
pp
.
tasks
]))
if
not
args
.
dry_run
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment