diff options
-rwxr-xr-x | genenetwork-local-container.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/genenetwork-local-container.sh b/genenetwork-local-container.sh index 39be629..f657346 100755 --- a/genenetwork-local-container.sh +++ b/genenetwork-local-container.sh @@ -382,3 +382,34 @@ if [ "$1" = "--init-rdf" ]; then cd $curr_dir exit 0 fi + +if [ "$1" = "--init-xapian" ]; then + # Check for required tools + log INFO "Please make sure your container is running for this to work" + log INFO "This takes some time to run" + # Check if directory exists and is accessible + if [ -d "$BASE_DIR/var/lib/xapian" ]; then + if [ -w "$BASE_DIR/var/lib/xapian" ]; then + log "DEBUG" "Directory exists and is writable: $BASE_DIR/var/lib/xapian" + else + log "WARNING" "Directory exists but is not writable: $BASE_DIR/var/lib/xapian. Making this writable" + sudo chown -R "$USER" "$BASE_DIR/var/lib/xapian" + fi + continue + fi + # Check if build directory exists + if [ ! -f "$BASE_DIR/var/lib/xapian/build" ]; then + rm -rf "$BASE_DIR/var/lib/xapian/build" + fi + + env PYTHONPATH="$BASE_DIR/genenetwork3/" guix shell python-wrapper genenetwork3 \ + --share="$BASE_DIR/var/lib/xapian" -- \ + "$BASE_DIR/genenetwork3/scripts/index-genenetwork" create-xapian-index \ + "$BASE_DIR/var/lib/xapian/build" \ + "mysql://webqtlout:webqtlout@localhost/db_webqtl_local?unix_socket=/run/mysqld/mysqld.sock&charset=utf8" \ + "http://localhost:7082/sparql" + mv "$BASE_DIR/var/lib/xapian/build/*" "$BASE_DIR/var/lib/xapian/" \ + && rmdir "$BASE_DIR/var/lib/xapian/build/" + log INFO "Please restart the container to set the correct permissions" + exit 0 +fi |