Skip to content

Commit

Permalink
ready to upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas HOMBERG committed Nov 29, 2024
1 parent cac650a commit 3fea427
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 806 deletions.
4 changes: 2 additions & 2 deletions phase-1_2_3/automated_docker_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ echo "Create submission program"
cd starting_kit/
rm -rf submissions
# Rscript submission_script.R >> logs
# Rscript submission_script.R
python submission_script.py
Rscript submission_script.R
# python submission_script.py
cd -
echo "Done"

Expand Down
10 changes: 5 additions & 5 deletions phase-1_2_3/bundle/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ If your submission fails on Codabench, don't panic, review the logs! You can acc

Try interactive docker or conda environnement, it is especially useful for python user!

A conda environment is provided follow this steps to install and activate it. Retrieve the file [environment-r.yml](https://github.com/bcm-uga/hadaca3/blob/main/docker/codabench_hadaca3_pyr/environment/environment-r.yml) from github as follow:
A conda environment is provided follow this steps to install and activate it. Retrieve the file [env_final_pyr.yml](https://github.com/bcm-uga/hadaca3/blob/main/docker/codabench_hadaca_final/environment/env_final_pyr.yml) from github as follow:

```
wget https://raw.githubusercontent.com/bcm-uga/hadaca3/main/docker/codabench_hadaca3_pyr/environment/environment-r.yml
conda env create -f environment-r.yml && conda activate h3
wget https://raw.githubusercontent.com/bcm-uga/hadaca3/refs/heads/main/docker/codabench_hadaca_final/environment/env_final_pyr.yml
conda env create -f env_final_pyr.yml && conda activate h3_final
```

To run the docker interactively you can run with:

```
## for the R version
sudo docker run -it -v .:/hadaca3 -w /hadaca3 hombergn/hadaca3_pyr R` and then `source("submission_script.R")
sudo docker run -it -v .:/hadaca3 -w /hadaca3 hombergn/hadaca3_final R` and then `source("submission_script.R")
## for the python version
sudo docker run -it -v .:/hadaca3 -w /hadaca3 hombergn/hadaca3_pyr python` and then `import submission_script
sudo docker run -it -v .:/hadaca3 -w /hadaca3 hombergn/hadaca3_final python` and then `import submission_script
```

Due to the usage of the super user (sudo) all files created by docker will be owned by root. In order to retrieve ownership, you can use this command:
Expand Down
6 changes: 3 additions & 3 deletions phase-1_2_3/bundle/submission.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ Then follow steps 4 and 5 described above.

```
cd starting_kit
sudo docker pull hombergn/hadaca3_pyr
sudo docker run -it -v .:/hadaca3 -w /hadaca3 hombergn/hadaca3_pyr R
sudo docker pull hombergn/hadaca3_final
sudo docker run -it -v .:/hadaca3 -w /hadaca3 hombergn/hadaca3_final R
source("submission_script.R")
chown -R $USER submissions #if necessary
```

Alternatively, run the following commande to execute the `submission_script`:

```
sudo docker run -v .:/hadaca3 -w /hadaca3 hombergn/hadaca3_pyr Rscript submission_script.R
sudo docker run -v .:/hadaca3 -w /hadaca3 hombergn/hadaca3_final Rscript submission_script.R
```

and regain ownership of the files generated with:
Expand Down
23 changes: 12 additions & 11 deletions phase-1_2_3/generate_bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,23 @@ mkdir starting_kit
# generate baselines :
rm -rf ~/projects/hadaca3/templates/tmp/
Rscript ~/projects/hadaca3/templates/generate_baselines.R Phase_1
cp ~/projects/hadaca3/templates/tmp/* starting_kit/
cp -R ~/projects/hadaca3/templates/tmp/* starting_kit/


# rm -rf starting_kit_phase1
mkdir starting_kit_phase1

rm -rf ~/projects/hadaca3/templates/tmp/
Rscript ~/projects/hadaca3/templates/generate_baselines.R Phase_1_only
cp ~/projects/hadaca3/templates/tmp/* starting_kit_phase1/
cp -R ~/projects/hadaca3/templates/tmp/* starting_kit_phase1/

rm -r ~/projects/hadaca3/templates/tmp/


#### Put input data inside the bundle !
cd starting_kit/ ; zip -FS -r ../bundle/starting_kit_phase2-3.zip * -x \*submissions\* ; cd .. ;
cd starting_kit_phase1/ ; zip -FS -r ../bundle/starting_kit_phase1.zip * -x \*submissions\* ; cd .. ;
# cd starting_kit/ ; zip -FS -r ../bundle/starting_kit_phase2-3.zip * -x \*submissions\* ; cd .. ;
# cd starting_kit_phase1/ ; zip -FS -r ../bundle/starting_kit_phase1.zip * -x \*submissions\* ; cd .. ;

zip -FS -r -j bundle/input_data_phase2.zip input_data/
zip -FS -r -j bundle/input_data_phase3.zip input_data_final/
zip -FS -r -j bundle/input_data_phase1.zip input_data_phase1/
Expand All @@ -67,15 +68,15 @@ zip -FS -j -r bundle/ground_truth_phase1.zip ground_truth_phase1/


# ##### generate starting_kit and input_data outisde bundle.zip
# cd starting_kit_phase1/ ; zip -FS -r ../bundle/starting_kit_phase1.zip * -x \*submissions\* -x \*data\* ; cd .. ;
# cd starting_kit/ ; zip -FS -r ../bundle/starting_kit_phase2-3.zip * -x \*submissions\* -x \*data\* ; cd .. ;
cd starting_kit_phase1/ ; zip -FS -r ../bundle/starting_kit_phase1.zip * -x \*submissions\* -x \*data\* ; cd .. ;
cd starting_kit/ ; zip -FS -r ../bundle/starting_kit_phase2-3.zip * -x \*submissions\* -x \*data\* ; cd .. ;

# zip -FS -r -j input_data_phase2.zip input_data/
# zip -FS -r -j input_data_phase3.zip input_data_final/
# zip -FS -r -j input_data_phase1.zip input_data_phase1/
zip -FS -r -j input_data_phase2.zip input_data/
zip -FS -r -j input_data_phase3.zip input_data_final/
zip -FS -r -j input_data_phase1.zip input_data_phase1/

# cd starting_kit/ ; zip -FS -r ../starting_kit_phase2-3.zip * -x \*submissions\* ; cd .. ;
# cd starting_kit_phase1/ ; zip -FS -r ../starting_kit_phase1.zip * -x \*submissions\* ; cd .. ;
cd starting_kit/ ; zip -FS -r ../starting_kit_phase2-3.zip * -x \*submissions\* ; cd .. ;
cd starting_kit_phase1/ ; zip -FS -r ../starting_kit_phase1.zip * -x \*submissions\* ; cd .. ;



Expand Down
2 changes: 2 additions & 0 deletions phase-1_2_3/generate_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ do
done


# rm -rf starting_kit
# rm -rf starting_kit_phase1


mkdir starting_kit/data/
Expand Down
4 changes: 1 addition & 3 deletions phase-1_2_3/ingestion_program/sub_ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
try:
# Define the target and link name
target = "../ingested_program/attachement/"
link_name = "attachement/"
link_name = "attachement"

# Create a symbolic link
os.symlink(target, link_name)
# print(f"Symbolic link created: {link_name} -> {target}")
except FileExistsError:
# Handle the case where the symbolic link already exists
os.unlink(link_name) # Remove the existing symbolic link
Expand Down
2 changes: 1 addition & 1 deletion phase-1_2_3/scoring_program/detailed_results.Rmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Visualize Results"
author: "Elise Amblard, Hugo Barbot, Florent Chuffart and Magali Richard"
# author: "Elise Amblard, Hugo Barbot, Florent Chuffart and Magali Richard"
date: "`r Sys.Date()`"
output:
# prettydoc::html_pretty: # create a styles.css file and snakemake doesn't like it
Expand Down
7 changes: 6 additions & 1 deletion phase-1_2_3/scoring_program/scoring.R
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ scoring_function <- function(A_real, A_pred) {
else if (nrow(A_pred) > nrow(A_real) & setequal(rownames(A_real), c("basal",'classic'))) { # partial ground truth only for the in vivo dataset
rmse = NA
mae = NA
aitchison = eval_Aitchison(A_real, A_pred[rownames(A_real),])
aitchison = NA
pearson_tot = NA
pearson_col = NA
pearson_row = correlationP_row(A_real, A_pred[rownames(A_real),])
Expand Down Expand Up @@ -277,6 +277,11 @@ scoring_function <- function(A_real, A_pred) {
}
judge_candidate_norm = apply(judge_candidate, 2, CenterScaleNorm)

# transform scores s.t. 1 is the best score
judge_candidate_norm = 1 - judge_candidate_norm
judge_candidate_norm[,grep("pearson",colnames(judge_candidate_norm))] = 1 - judge_candidate_norm[,grep("pearson",colnames(judge_candidate_norm))]
judge_candidate_norm[,grep("spearman",colnames(judge_candidate_norm))] = 1 - judge_candidate_norm[,grep("spearman",colnames(judge_candidate_norm))]

# Average over judges with the geometric mean for the candidate of interest
#score_aggreg = exp(mean(log(judge_candidate_norm[1,]),na.rm=T))
weights = c(1/3*1/2,1/3*1/2,
Expand Down
230 changes: 0 additions & 230 deletions phase-1_2_3/starting_kit/submission_script_installpkgcran.R

This file was deleted.

Loading

0 comments on commit 3fea427

Please sign in to comment.