Skip to content

Instantly share code, notes, and snippets.

@jbellamycarter
Last active May 6, 2021 20:27
Show Gist options
  • Save jbellamycarter/74f59c1c16efb310a5c7adf337c80a3c to your computer and use it in GitHub Desktop.
Save jbellamycarter/74f59c1c16efb310a5c7adf337c80a3c to your computer and use it in GitHub Desktop.
Run `msconvert` on Linux/MacOS. A bash script to parse standard arguments to an `msconvert` Docker container. #docker
#!/bin/bash
# Script to run Proteowizard `msconvert` installed through Docker on Linux/MacOS systems.
# Parses standard command line arguments for `msconvert`. e.g.
# `docker-msconvert data.RAW --zlib --filter "zeroSamples removeExtra" --mz5`
# Requires `msconvert` Docker-container installed as on https://hub.docker.com/r/chambm/pwiz-skyline-i-agree-to-the-vendor-licenses
# Assumes `msconvert` is installed in an environment named 'default', replace this with the appropriate environment name.
# 2019 Jedd Bellamy-Carter
# Modify path strings for docker environment
newargs+=("/data/$1")
for ((i = 2; i <= $#; i++ )); do
if [[ "${!i}" = "-o" ]]; then
newargs+=("${!i}")
((i+=1))
newargs+=("/data/${!i}")
else
newargs+=("${!i}")
fi
done
# Check directory
if [ ${1:0:1} = "/" ]; then
dir="/"
else
dir="$PWD/"
fi
# Check status of docker-machine and start it if necessary
if docker-machine status default | grep -q "Stopped"; then
echo "Docker not running"
echo "Starting docker-machine"
eval $(docker-machine start default)
echo "Docker now running"
else
echo "Docker already running"
fi
# Evaluate docker-machine environment
eval $(docker-machine env default)
# Run msconvert through docker
docker run -it --rm -e WINEDEBUG=-all -v $dir:/data chambm/pwiz-skyline-i-agree-to-the-vendor-licenses wine msconvert "${newargs[@]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment