From f10386dee95f3b1fbc8d1eeec52d450381ba89c5 Mon Sep 17 00:00:00 2001 From: Thomas N Lawson Date: Fri, 13 Sep 2024 12:54:13 +0100 Subject: [PATCH] V1.28.0+galaxy1 (Galaxy tool fixes for purityX and purityA) (#57) * Filename fix for purityA output * Fix for purityX xset object read * Update pr.yaml * Update pr.yaml - version bump for upload artifact * Update pr.yaml artifact version bump * Update filterFragSpectra.R - update filenames - ensure as character * Update filterFragSpectra.R - revert - not required * Update pr.yaml - version bump actions * Update purityX.xml - update xml wrapper to remove ref to xcms object name * clean up --- .github/workflows/pr.yaml | 40 +++++++++++++++++++------------------- README.rst | 8 ++++++-- tools/msPurity/purityA.R | 2 +- tools/msPurity/purityX.R | 7 +++---- tools/msPurity/purityX.xml | 6 +----- 5 files changed, 31 insertions(+), 32 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 8223785..b1d48ba 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -35,18 +35,18 @@ jobs: run: echo "GALAXY_HEAD_SHA=$(git ls-remote ${{ env.GALAXY_REPO }} refs/heads/${{ env.GALAXY_RELEASE }} | cut -f1)" >> $GITHUB_ENV - name: Save latest galaxy commit to artifact file run: echo $GALAXY_HEAD_SHA > galaxy.sha - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: Workflow artifacts path: galaxy.sha - name: Cache .cache/pip - uses: actions/cache@v2 + uses: actions/cache@v3 id: cache-pip with: path: ~/.cache/pip key: pip_cache_py_${{ matrix.python-version }}_gxy1_$GALAXY_HEAD_SHA - name: Cache .planemo - uses: actions/cache@v2 + uses: actions/cache@v3 id: cache-planemo with: path: ~/.planemo @@ -63,7 +63,7 @@ jobs: run: | touch tool.xml PIP_QUIET=2 planemo test --galaxy_python_version ${{ matrix.python-version }} --no_conda_auto_init --galaxy_source $GALAXY_REPO --galaxy_branch $GALAXY_RELEASE - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 # The range of commits to check for changes is: @@ -88,7 +88,7 @@ jobs: run: planemo ci_find_repos --changed_in_commit_range $COMMIT_RANGE --exclude packages --exclude deprecated --exclude_from .tt_skip --output changed_repositories.list - name: Show repo list run: cat changed_repositories.list - - uses: actions/upload-artifact@v2.0.1 + - uses: actions/upload-artifact@v3 with: name: Workflow artifacts path: changed_repositories.list @@ -105,20 +105,20 @@ jobs: steps: # checkout the repository # and use it as the current working directory - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 1 - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: Workflow artifacts path: ../workflow_artifacts/ - name: Determine latest galaxy commit run: echo "GALAXY_HEAD_SHA=$(cat ../workflow_artifacts/galaxy.sha)" >> $GITHUB_ENV - name: Cache .cache/pip - uses: actions/cache@v2 + uses: actions/cache@v3 id: cache-pip with: path: ~/.cache/pip @@ -144,20 +144,20 @@ jobs: steps: # checkout the repository to master # and use it as the current working directory - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 1 - uses: actions/setup-python@v1 with: python-version: ${{ matrix.python-version }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: Workflow artifacts path: ../workflow_artifacts/ - name: Determine latest galaxy commit run: echo "GALAXY_HEAD_SHA=$(cat ../workflow_artifacts/galaxy.sha)" >> $GITHUB_ENV - name: Cache .cache/pip - uses: actions/cache@v2 + uses: actions/cache@v3 id: cache-pip with: path: ~/.cache/pip @@ -200,7 +200,7 @@ jobs: - uses: actions/setup-python@v1 with: python-version: ${{ matrix.python-version }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: Workflow artifacts path: ../workflow_artifacts/ @@ -267,7 +267,7 @@ jobs: run: | mkdir upload mv tool_test_output.json tool_test_output.html upload/ - - uses: actions/upload-artifact@v2.0.1 + - uses: actions/upload-artifact@v3 with: name: 'Tool test output ${{ matrix.chunk }}' path: upload @@ -286,7 +286,7 @@ jobs: # This job runs on Linux runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: path: artifacts - uses: actions/setup-python@v1 @@ -295,7 +295,7 @@ jobs: - name: Determine latest galaxy commit run: echo "GALAXY_HEAD_SHA=$(cat ../workflow_artifacts/galaxy.sha)" >> $GITHUB_ENV - name: Cache .cache/pip - uses: actions/cache@v2 + uses: actions/cache@v3 id: cache-pip with: path: ~/.cache/pip @@ -312,7 +312,7 @@ jobs: run: | mkdir upload mv tool_test_output.json tool_test_output.html upload/ - - uses: actions/upload-artifact@v2.0.1 + - uses: actions/upload-artifact@v3 with: name: 'All tool test results' path: upload @@ -333,20 +333,20 @@ jobs: runs-on: ubuntu-latest if: github.ref == 'refs/heads/master' && github.repository_owner == 'computational-metabolomics' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 1 - uses: actions/setup-python@v1 with: python-version: ${{ matrix.python-version }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: Workflow artifacts path: ../workflow_artifacts/ - name: Determine latest galaxy commit run: echo "GALAXY_HEAD_SHA=$(cat ../workflow_artifacts/galaxy.sha)" >> $GITHUB_ENV - name: Cache .cache/pip - uses: actions/cache@v2 + uses: actions/cache@v3 id: cache-pip with: path: ~/.cache/pip diff --git a/README.rst b/README.rst index 4125801..6093408 100644 --- a/README.rst +++ b/README.rst @@ -3,13 +3,13 @@ msPurity for Galaxy |Git| |Bioconda| |License| -Version v1.28.0+galaxy0 +Version v1.28.0+galaxy1 ------------------------ - msPurity - bioconductor-mspurity v1.28.0 - Galaxy tools - - v0 + - v1 About ------ @@ -52,6 +52,10 @@ Authors, contributors & contacts Changes ------------------------- +v1.28.0-galaxy1 + - Further fix for purityX galaxy tool (https://github.com/computational-metabolomics/mspurity-galaxy/issues/53) + - Fix for purityA file naming (https://github.com/computational-metabolomics/mspurity-galaxy/issues/56) + v1.28.0-galaxy0 - Version bump to v1.28.0 - createMSP now uses the median precursor MZ and precursor RT in the MSP files diff --git a/tools/msPurity/purityA.R b/tools/msPurity/purityA.R index 7fe924b..c4e368b 100644 --- a/tools/msPurity/purityA.R +++ b/tools/msPurity/purityA.R @@ -124,7 +124,7 @@ if (!is.null(opt$galaxy_names)) { print(pa) save(pa, file = file.path(opt$out_dir, "purityA_output.RData")) -pa@puritydf$filename <- sapply(pa@puritydf$fileid, function(x) names(pa@fileList)[as.integer(x)]) +pa@puritydf$filename <- sapply(as.character(pa@puritydf$fileid), function(x) names(pa@fileList)[as.integer(x)]) print(head(pa@puritydf)) write.table(pa@puritydf, file.path(opt$out_dir, "purityA_output.tsv"), row.names = FALSE, sep = "\t") diff --git a/tools/msPurity/purityX.R b/tools/msPurity/purityX.R index 54eb548..8fd6c86 100644 --- a/tools/msPurity/purityX.R +++ b/tools/msPurity/purityX.R @@ -16,7 +16,6 @@ option_list <- list( make_option("--singleFile", default = 0), make_option("--cores", default = 4), make_option("--xgroups", type = "character"), - make_option("--rdata_name", default = "xset"), make_option("--camera_xcms", default = "xset"), make_option("--files", type = "character"), make_option("--galaxy_files", type = "character"), @@ -63,10 +62,10 @@ if (is.null(opt$rtraw_columns)) { rtraw_columns <- TRUE } -loadRData <- function(rdata_path, xset_name) { +loadRData <- function(rdata_path, xnames) { # loads an RData file, and returns the named xset object if it is there load(rdata_path) - return(get(ls()[ls() == xset_name])) + return(get(ls()[ls() %in% xnames])) } @@ -90,7 +89,7 @@ getxcmsSetObject <- function(xobject) { } } -target_obj <- loadRData(opt$xset_path, opt$rdata_name) +target_obj <- loadRData(opt$xset_path, c('xset', 'xa', 'xdata')) if (opt$camera_xcms == "camera") { xset <- target_obj@xcmsSet diff --git a/tools/msPurity/purityX.xml b/tools/msPurity/purityX.xml index 00e129a..403d870 100644 --- a/tools/msPurity/purityX.xml +++ b/tools/msPurity/purityX.xml @@ -18,11 +18,7 @@ --xgroups='$xgroups.xgroups_value' #end if --camera_xcms=$camera_xcms - #if $camera_xcms == "camera" - --rdata_name=xa - #else - --rdata_name=xset - #end if + --iwNorm=$iw_norm --ilim=$ilim #if $isotopes.isotopes == "exclude_default"