Renaming herbivores scripts

This commit is contained in:
Louis Lacoste 2024-05-24 16:19:00 +02:00
parent 1e952eaae3
commit beb97ad18e
3 changed files with 37 additions and 4 deletions

View file

@ -3,10 +3,12 @@ library(dplyr)
library(tidyr)
library(here)
application_name <- "herbivores"
application_folder <- file.path(here(), "code", "applications", "herbivores")
prepare_data_script_path <- file.path(
application_folder,
"01_herbi_prepare_data.R"
sprintf("01_%s_prepare_data.R", application_name)
)
source(prepare_data_script_path)
@ -35,8 +37,8 @@ stopifnot(
message("Début du clustering des données Herbivores avec le modèle ", model)
set.seed(1234, "L'Ecuyer-CMRG")
base_data_folder <- file.path(here(), "code", "data", "herbivores")
save_folder <- file.path(here(), "code", "results", "applications", "herbivores")
base_data_folder <- file.path(here(), "code", "data", application_name)
save_folder <- file.path(here(), "code", "results", "applications", application_name)
if (!dir.exists(save_folder)) {
dir.create(save_folder, recursive = TRUE)
@ -59,7 +61,7 @@ list_collection <- clusterize_bipartite_networks(
save_file <- file.path(
save_folder, paste0(
"herbivore_collection_",
sprintf("%s_collection_", application_name),
model, "_", start_time, ".Rds"
)
)

View file

@ -0,0 +1,31 @@
#!/usr/bin/env bash
#$ -V
#$ -cwd
#$ -N herbivores_app
#$ -m besa
#$ -t 1:4
#$ -q long.q
#$ -pe thread 64
#$ -M louis.lacoste+migale@agroparistech.fr
#$ -o logs/$JOB_NAME.$TASK_ID
#$ -e logs/$JOB_NAME.$TASK_ID
# Creating log directory if it doesn't exists
BASE_DIR="/home/$USER/work/mia-stage-2024"
LOG_DIR=$(echo "$BASE_DIR/logs")
if [ ! -d "$LOG_DIR" ]; then
mkdir -p $LOG_DIR
fi
# Constant data
MODELARRAY=("iid" "pi" "rho" "pirho")
MODEL=${MODELARRAY[$(($((SGE_TASK_ID - 1)) % 4))]}
# Finding directory
APPLICATIONS_DIR=$(echo "$BASE_DIR/code/applications")
echo $APPLICATIONS_DIR
Rscript "${APPLICATIONS_DIR}/herbivores/02_herbivores_clustering.R" --model $MODEL