diff --git a/Manifest.toml b/Manifest.toml index 3dd7435fcfb4200b13b1b8e756002f8e20c6de07..74690b3e58fab18085d329575fef7b50042e1397 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -1037,11 +1037,11 @@ version = "0.3.3" [[deps.PlanarLarvae]] deps = ["DelimitedFiles", "HDF5", "JSON3", "LinearAlgebra", "MAT", "Meshes", "OrderedCollections", "Random", "SHA", "StaticArrays", "Statistics", "StatsBase", "StructTypes"] -git-tree-sha1 = "6b2dc28d56bcef101672cbf2bb784bbd5d88d579" +git-tree-sha1 = "d964d040e319fe3bd9140e5bf91d648de6acc96f" repo-rev = "main" repo-url = "https://gitlab.pasteur.fr/nyx/PlanarLarvae.jl" uuid = "c2615984-ef14-4d40-b148-916c85b43307" -version = "0.15.0" +version = "0.16.0" [[deps.PlotUtils]] deps = ["ColorSchemes", "Colors", "Dates", "PrecompileTools", "Printf", "Random", "Reexport", "Statistics"] diff --git a/Project.toml b/Project.toml index 7041c66a1c027cc90344a8ba2d6347be9df2f656..8fb6e4f15ce38d27ccbeb2e40db042577ce8ef3b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "LarvaTagger" uuid = "8b3b36f1-dfed-446e-8561-ea19fe966a4d" authors = ["François Laurent", "Institut Pasteur"] -version = "0.17.1" +version = "0.18" [deps] Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" diff --git a/recipes/Dockerfile b/recipes/Dockerfile index f73b1b4a5d03ac91969225027e82e040ee583406..c09163d71126f2024fcf6912d9d8f9814eb87c0b 100644 --- a/recipes/Dockerfile +++ b/recipes/Dockerfile @@ -77,6 +77,7 @@ RUN if [ -z $TAGGINGBACKENDS_BRANCH ]; then \ && git clone --depth 1 --no-tags --single-branch -b $(echo $BACKEND | cut -d/ -f2) https://gitlab.pasteur.fr/nyx/MaggotUBA-adapter MaggotUBA \ && cd MaggotUBA \ && rm -rf .git \ + && (cat requirements.txt | xargs -I % sh -c 'poetry add "%"') \ && poetry install --only main \ && poetry add "pynvml==11.4.1" \ && if [ "$(echo $BACKEND | cut -d/ -f2)" = "main" ] || [ "$(echo $BACKEND | cut -d/ -f2)" = "dev" ]; then \ diff --git a/recipes/README.md b/recipes/README.md index 19d5223a5cc57eaf46a98d4caf505d6389c8b145..d13b72db0b1b1172fbff13c419ee060b7ca702cd 100644 --- a/recipes/README.md +++ b/recipes/README.md @@ -173,7 +173,7 @@ docker pull flaur/larvatagger ``` Beware that images that ship with a tagging backend are relatively large files (>5GB on disk). -If you are not interested in automatic tagging, use the `flaur/larvatagger:0.17.1-standalone` image instead. +If you are not interested in automatic tagging, use the `flaur/larvatagger:0.18-standalone` image instead. ### Upgrading diff --git a/test/deploy_and_test.sh b/test/deploy_and_test.sh index 4d3ca51c7c3f1c59d122a296b6a3df53a4ea53f6..45c5a8dfc874ddd2bea4c00bff80eb3f06db634f 100755 --- a/test/deploy_and_test.sh +++ b/test/deploy_and_test.sh @@ -37,7 +37,7 @@ if ! julia -v &> /dev/null; then # do NOT use juliaup to install Julia module load Python &> /dev/null # Maestro python3 -m pip install jill - python3 -m jill install -v 1.9.1 -c + python3 -m jill install -v 1.10.0 -c fi # h5diff (for tests) on Maestro @@ -82,7 +82,7 @@ ln -s $(realpath MaggotUBA-adapter) MaggotUBA # the step below may not be necessary (cd TaggingBackends && JULIA_PROJECT=$(pwd) poetry run python -c 'import julia; julia.install()') -(cd MaggotUBA && poetry env use python3.8 && poetry install -v && poetry remove taggingbackends && poetry add ../TaggingBackends && scripts/make_models.jl default) +(cd MaggotUBA && poetry env use python3.8 && (cat requirements.txt | xargs -I % sh -c 'poetry add "%"') && poetry install -v && poetry remove taggingbackends && poetry add ../TaggingBackends && scripts/make_models.jl default) cd LarvaTagger || exit 1 julia --project=. -e 'using Pkg; Pkg.instantiate(); Pkg.develop(path="../PlanarLarvae")' @@ -97,7 +97,7 @@ if [ -f ../../LarvaTagger_test_data.tgz ]; then # KEEP_MODEL_FILES=1 ./deploy_and_test.sh # cd LarvaTagger/LarvaTagger.jl # rm -rf test/data/test_train_* - # cp -ra ../MaggotUBA/models/test_train_* test/data/ + # cp -Rp ../MaggotUBA/models/test_train_* test/data/ # tar zcvf LarvaTagger_test_data.tgz test/data/* # mv LarvaTagger_test_data.tgz ../../ tar zxvf ../../LarvaTagger_test_data.tgz diff --git a/test/scenarii.sh b/test/scenarii.sh index cfe2784ad504372ec4396e644b400137203a0839..2d4c31022437bdd616878ae7e24f29cf9f28ff11 100755 --- a/test/scenarii.sh +++ b/test/scenarii.sh @@ -50,9 +50,10 @@ endTest() { prepareTestData() { tmpdir="$SHUNIT_TMPDIR/$1" + shift rm -rf "$tmpdir" mkdir -p "$tmpdir" - for file in sample.spine sample.outline; do + for file in sample.spine sample.outline $@; do cp "$datapath/$file" "$tmpdir/" || exit 1 done echo $tmpdir @@ -123,6 +124,33 @@ testPredictDefault() { endTest } +# requires: sample.spine sample.outline trx.mat original_predictions.label test_train_default/predicted.label +testPredictWithConflictingInput() { + tagger="test_train_default$tagger_suffix" + # make test data + touch "$datapath/spurious.txt" + tmpdir=$(prepareTestData $tagger trx.mat original_predictions.label spurious.txt) + # restore the model + mkdir -p "$maggotuba/models" + rm -rf "$maggotuba/models/$tagger" + echo "cp -Rp \"$datapath/$tagger\" \"$maggotuba/models/\"" + cp -Rp "$datapath/$tagger" "$maggotuba/models/" + [ -f "$maggotuba/models/$tagger/clf_config.json" ] || exit 1 + # run + cd "$project_root" + echo "\"$larvataggerjl\" predict \"$maggotuba\" $tagger \"$tmpdir\" --debug" + "$larvataggerjl" predict "$maggotuba" $tagger "$tmpdir" --debug + # compare + filename=predicted.label + predictions="$tmpdir/$filename" + expected_labels="$datapath/$tagger/$filename" + assertFalse "\`predict\` failed to generate file $filename" '[ -z "$predictions" ]' + assertTrue "\`predict\` failed to reproduce file $filename" '$(cmp "$expected_labels" "$predictions")' + # clean up + rm -f "$datapath/spurious.txt" + endTest +} + # requires: sample.spine sample.outline original_predictions.label test_train_default/* testTrainDefault() { tagger="test_train_default$tagger_suffix" @@ -238,7 +266,7 @@ postTrain() { assertTrue "\`train\` failed to reproduce file $enc_weights" '$(cmp "$expected_tagger_dir/$enc_weights" "$enc_weights_path")' assertTrue "\`train\` failed to reproduce file $enc_config" '$(cmp "$expected_tagger_dir/$enc_config" "$enc_config_path")' assertTrue "\`train\` failed to reproduce file $clf_weights" '$(cmp "$expected_tagger_dir/$clf_weights" "$clf_weights_path")' - assertTrue "\`train\` failed to reproduce file $clf_config" '$(cmp "$expected_tagger_dir/$clf_config" "$clf_config_path")' + assertTrue "\`train\` failed to reproduce file $clf_config" '[ -z "$(diff "$expected_tagger_dir/$clf_config" "$clf_config_path" | grep -E "^[<>] " | grep -vE larva_dataset_.*[.]hdf5)" ]' # test the predictions echo "\"$larvataggerjl\" predict \"$maggotuba\" $tagger \"$tmpdir/sample.spine\""