Skip to content

Commit

Permalink
Create links to FragPipe installation files in $CONDA_PREFIX. Because…
Browse files Browse the repository at this point in the history
… FragPipe creates cache relative to the lib location, this allows a local FragPipe cache.
  • Loading branch information
reid-wagner committed Jun 29, 2024
1 parent 2995038 commit 3031e8f
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 1 deletion.
65 changes: 65 additions & 0 deletions tools/fragpipe/fragpipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash

# Modified version of the Bioconda wrapper of the script for command-line FragPipe, calling a local link to fragpipe instead of the version in $CONDA_PREFIX.
# Ensures the user agrees to MSFragger and IonQuant academic licenses.

license_agreement_text='
Please accept the academic license.
FragPipe uses tools that are available freely for academic research and educational purposes only.
Please provide license keys for MSFragger and IonQuant with the --msfragger_key and --ionquant_key flags. By passing these, you verify that you have read the ACADEMIC licenses for the MSFragger and IonQuant tools. You may obtain these keys by agreeing to the terms at http://msfragger-upgrader.nesvilab.org/upgrader/ and https://msfragger.arsci.com/ionquant/.'

declare -a fragpipe_args

while [[ $# -gt 0 ]]; do
case "$1" in
--msfragger_key)
shift
msfragger_key=$1
;;
--ionquant_key)
shift
ionquant_key=$1
;;
--workflow)
fragpipe_args+=("$1")
shift
workflow_file="$1"
fragpipe_args+=("$1")
;;
*)
fragpipe_args+=("$1")
;;
esac
shift
done

if [[ ! -z "$workflow_file" ]]; then
# Because the DIA-NN license is incompatible with bioconda, we remove the feature.
grep 'diann.run-dia-nn=true' "$workflow_file" >/dev/null
if [[ $? -eq 0 ]]; then
echo "Error: DIA-NN is disabled in the FragPipe bioconda package."
exit 1
fi
fi

if [[ -z $msfragger_key || -z $ionquant_key ]]; then
echo "$license_agreement_text"
exit 1
else
msfragger --key $msfragger_key --help | grep 'License key verified' >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo "Error: Invalid MSFragger license key"
echo "$license_agreement_text"
exit 1
fi
ionquant --key $ionquant_key --help | grep 'License key verified' >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo "Error: Invalid IonQuant license key"
echo "$license_agreement_text"
exit 1
fi
fi

sh fragpipe_local/bin/fragpipe "${fragpipe_args[@]}"
2 changes: 1 addition & 1 deletion tools/fragpipe/fragpipe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
@PREPARE_DATABASE@
## Run FragPipe
fragpipe
'$__tool_directory__/fragpipe'
--msfragger_key f28c4be2-759b0a11-6c1ea652-1240565a
--ionquant_key 47cb2953-b4bf7726-2c96f5fe-8f1013aa
--headless
Expand Down
8 changes: 8 additions & 0 deletions tools/fragpipe/macros.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
Prepares enviroment variables for FragPipe.
-->
<token name="@PREPARE_ENVIRONMENT@"><![CDATA[
mkdir -p fragpipe_local/lib &&
for dir in bin philosopher tools workflows; do
ln -s \${CONDA_PREFIX}/share/fragpipe*/\${dir} fragpipe_local/\${dir};
done &&
for file in \${CONDA_PREFIX}/share/fragpipe*/lib/*; do
ln -s \${file} fragpipe_local/lib/\$(basename \${file});
done &&
cp \${CONDA_PREFIX}/share/fragpipe*/lib/fragpipe-*.jar fragpipe_local/lib/ &&
mkdir .cache .config tmp &&
export XDG_CONFIG_HOME=\$(pwd)/.config &&
export XDG_CACHE_HOME=\$(pwd)/.cache &&
Expand Down

0 comments on commit 3031e8f

Please sign in to comment.