Menu

UsefulScripts

Dave Brondsema

scripts courtesy of pieter DOT kelchtermans AT ugent.be

Use wine to convert raw files

wine /home/compomics/.wine/drive_c/Program\ Files/ProteoWizard/ProteoWizard\ 3.0.4323/msconvert.exe "$@"

Use OpenMS tools like a linux tool

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/zsh
# This script makes OpenMS tools accept stdin input and stdout output (to chain them as normal Unix tools)
if [ $# -eq 0 ] ; then
    echo "usage: $0 OpenmsTool -ini OpenmsTool.ini < infile > outfile"
    exit 0
fi
# You'll want to have a tmpfs (RAM + SWAP if needed) disk configured with about half the size of your RAM in /etc/fstab: tmpfs /tmp tmpfs defaults,noatime,mode=1777,nosuid,size=16G 0 0
# This makes for very fast access speeds, in this case for a file collection up to about 16GB. This script makes the OpenMS tools write only to this RAM-disk, and then outputs that file to stdout

# Since /tmp is configured to be a RAM(+SWAP)-disk, let's create a random directory,
TDIR=$(mktemp -d)

# and make sure it gets deleted even if this script terminates unexpectedly.
trap "{ cd - ; rm -rf $TDIR; exit 255; }" SIGINT

# ${cat} reads stdin (binary and text data), this is then echoed into a file called "in", in this fast tmp directory
echo "$(cat)" > $TDIR/in

# $@ are the arguments of this tool, which should be equivalent to the OpenMS line you'd normally use, minus the -in and -out parameters, since those now point to temporary files on a ramdisk
# also redirect OpenMS stdout log messages to stderr, we only want the outfile on stdout of this script
# when the tool completes successfully, spew the outfile to stdout with cat
"$@" -in $TDIR/in -out $TDIR/out 1>&2 && cat $TDIR/out

# remove the temporary directory with everything in it
rm -rf $TDIR
# and get the hell out of here!
exit 0

Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.