Skip to content

Commit

Permalink
Merge pull request #23 from mfleisch/update-3.0+sirius6.1.0
Browse files Browse the repository at this point in the history
update to 3.0.1+sirius6.1.0
  • Loading branch information
mfleisch authored Jan 6, 2025
2 parents 0d143c7 + 192bd48 commit 68b2450
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/azure-pipelines-linux.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .azure-pipelines/azure-pipelines-win.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .ci_support/linux_64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ channel_sources:
channel_targets:
- conda-forge main
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
- quay.io/condaforge/linux-anvil-x86_64:alma9
target_platform:
- linux-64
5 changes: 3 additions & 2 deletions .scripts/run_osx_build.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .scripts/run_win_build.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions build-locally.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#{% set siriusVersion = "6.0.4" %}
#{% set apiVersion = "2.1" %}
{% set version = "2.1+sirius6.0.7" %}
{% set version = "3.0.1+sirius6.1.0" %}
{% set name = "r-sirius-ms" %}

package:
Expand All @@ -9,11 +7,11 @@ package:

source:
url: https://github.com/sirius-ms/sirius-client-openAPI/archive/refs/tags/{{ version }}.zip
sha256: 6f0226586aea6f8bb411a5cdaf206f88885e7bfb19825a167e30e2e880d4fbaf
sha256: c483fe575fb4154f4f75a166fe4d5a1e9a367a2601df73fc9e7fc9296097b730

build:
noarch: generic
number: 1
number: 0
merge_build_host: True # [win]
rpaths:
- lib/R/lib/
Expand All @@ -39,7 +37,7 @@ requirements:
- r-base64enc
- r-stringr
- r-processx
- sirius-ms >=6.0.7
- sirius-ms >=6.1.0

test:
files:
Expand Down
6 changes: 0 additions & 6 deletions recipe/run_test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,5 @@ ECHO "### [EXE] RUN ILP SOLVER TEST"
%R% -e "source('%RECIPE_DIR:\=/%/test_script.R')"
if errorlevel 1 exit 1

ECHO "### [EXE] CHECK ILP SOLVER TEST"
If not exist "%cd%\test_fragtree.json" (
echo "Framgentation tree test [EXE] failed!"
exit 1
)

echo "Success!"
exit 0
6 changes: 1 addition & 5 deletions recipe/run_test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh

set -ex pipefail
echo "### TEST ENV INFO"
echo "PREFIX=$PREFIX"
echo "CONDA_PREFIX=$CONDA_PREFIX"
Expand All @@ -20,11 +21,6 @@ echo "### [JAVA] Try run $JAVA_HOME"
echo "### [SIRIUS API] Run Sirius test script"
$R -e "source('$RECIPE_DIR/test_script.R')"

echo "### [SIRIUS] Check SIRIUS test script results"
if [ ! -f "test_fragtree.json" ]; then
echo "Framgentation tree test failed!"
exit 1
fi

echo "Success!"
exit 0
36 changes: 30 additions & 6 deletions recipe/test_script.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ options(error = traceback)

library('Rsirius')



sdk <- SiriusSDK$new()
sirius_api <- sdk$attach_or_start_sirius()

wait_for_job <- function(project_id, job) {
while (sirius_api$jobs_api$GetJob(project_id, job$id)$progress$state != "DONE") {
wait_for_job <- function(pid, job) {
while (!(sirius_api$jobs_api$GetJob(pid, job$id)$progress$state == "DONE")) {
Sys.sleep(1)
}
}

project_id <- "test_project"
project_dir <- paste(Sys.getenv('SRC_DIR'), project_id, sep="/")
sirius_api$projects_api$CreateProjectSpace(project_id, project_dir)
sirius_api$projects_api$CreateProject(project_id, project_dir)

data <- file.path(Sys.getenv('SRC_DIR'),"Kaempferol.ms")
sirius_api$projects_api$ImportPreprocessedData(project_id, input_files=data)
Expand All @@ -26,12 +28,34 @@ job_submission$structureDbSearchParams$enabled <- FALSE
job_submission$canopusParams$enabled <- FALSE
job_submission$msNovelistParams$enabled <- FALSE
job <- sirius_api$jobs_api$StartJob(project_id, job_submission)

# Wait for job to finish
wait_for_job(project_id, job)

aligned_feature_id <- sirius_api$features_api$GetAlignedFeatures(project_id)[[1]]$alignedFeatureId
formula_id <- sirius_api$features_api$GetFormulaCandidates(project_id, aligned_feature_id)[[1]]$formulaId
tree <- sirius_api$features_api$GetFragTree(project_id, aligned_feature_id, formula_id)
write(tree$toJSONString(), "test_fragtree.json")
formula_candidate <- sirius_api$features_api$GetFormulaCandidates(project_id, aligned_feature_id)[[1]]
tree <- sirius_api$features_api$GetFragTree(project_id, aligned_feature_id, formula_candidate$formulaId)

print("### [SIRIUS API] Test if formula candidate is non null and has correct type.")
if (!inherits(formula_candidate, "FormulaCandidate")) {
print("Formula candidate is null or has wrong type. Test FAILED!")
quit(status = 1)
}

print("### [SIRIUS API] Test if tree is non null and has correct type.")
if (!inherits(tree, "FragmentationTree")) {
print("Tree is null or has wrong type. Test FAILED!")
quit(status = 1)
}

print("### [SIRIUS API] Test if formula is correct.")
if ( "C15H10O6" != formula_candidate$molecularFormula) {
print(sprintf(
"Expected formula result to be C15H10O6 but found %s. Test FAILED!",
formula_candidate$molecularFormula
))
quit(status = 1)
}

sirius_api$projects_api$CloseProjectSpace(project_id)
unlink(project_dir, recursive=TRUE)
Expand Down

0 comments on commit 68b2450

Please sign in to comment.