-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimport.sh
executable file
·65 lines (53 loc) · 1.9 KB
/
import.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
source "${0%/*}/utils.sh"
if [ ! -d "$CBIO_DEPLOY_FOLDER" ]; then
echo "Error: Cbioportal folder '$CBIO_DEPLOY_FOLDER' does not exist."
exit 3
fi
if [ ! -d "$CBIO_STUDY_FOLDER" ]; then
echo "Error: Study folder '$CBIO_STUDY_FOLDER' does not exist."
exit 3
fi
cd $CBIO_DEPLOY_FOLDER
if [ -d "$CBIO_TEMP_FOLDER" ]; then
exists_temp=0
else
exists_temp=1
fi
# if [ -e "$CBIO_TEMP_FOLDER/portalinfo" ]; then
# echo "Error: Folder '$CBIO_TEMP_FOLDER/portalinfo' must not exist - it will be rewritten with existing data."
# exit 3
# fi
# First, start the container
docker rm -f cbioportal-container-csv2cbio 2>/dev/null #preemptive
try_run "" \
docker compose run \
-v "$CBIO_STUDY_FOLDER:/_to_import_" \
-v "$CBIO_TEMP_FOLDER/portalinfo:/portalinfo" \
-w /core/scripts \
-d --rm --no-deps --name cbioportal-container-csv2cbio \
cbioportal sleep infinity
# Then, export the portalinfo metadata
try_run "Failed to export cbioportal page metadata required for study validation!" \
docker exec cbioportal-container-csv2cbio ./dumpPortalInfo.pl /portalinfo
if [ ! -z "${CBIO_STUDY_FOLDER}" ]; then
CBIO_IMPORT_ARGS=" $CBIO_IMPORT_ARGS"
else
CBIO_IMPORT_ARGS=""
fi
echo "#######################################################################"
echo "Importing the content of '$CBIO_STUDY_FOLDER'":
ls $CBIO_STUDY_FOLDER
echo
echo Note: CBIO_IMPORT_ARGS $CBIO_IMPORT_ARGS
echo "\$> metaImport.py -p $CBIO_TEMP_FOLDER/portalinfo -s $CBIO_STUDY_FOLDER --html=$CBIO_STUDY_FOLDER/report.html ${CBIO_IMPORT_ARGS}"
echo
try_run "Failed to import study!" \
docker exec cbioportal-container-csv2cbio /core/scripts/importer/metaImport.py -p /portalinfo -s /_to_import_ --html=/_to_import_/report.html$CBIO_IMPORT_ARGS
if [ $exists_temp ]; then
rm -rf "$CBIO_TEMP_FOLDER/portalinfo"
else
rm -rf "$CBIO_TEMP_FOLDER"
fi
# Cleanup
docker rm -f cbioportal-container-csv2cbio