<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to UsefulScripts</title><link>https://sourceforge.net/p/open-ms/wiki/UsefulScripts/</link><description>Recent changes to UsefulScripts</description><atom:link href="https://sourceforge.net/p/open-ms/wiki/UsefulScripts/feed" rel="self"/><language>en</language><lastBuildDate>Wed, 22 Jan 2014 17:43:04 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/open-ms/wiki/UsefulScripts/feed" rel="self" type="application/rss+xml"/><item><title>UsefulScripts modified by Dave Brondsema</title><link>https://sourceforge.net/p/open-ms/wiki/UsefulScripts/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;scripts courtesy of pieter DOT kelchtermans AT ugent.be &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Use wine to convert raw files&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;wine /home/compomics/.wine/drive_c/Program\ Files/ProteoWizard/ProteoWizard\ 3.0.4323/msconvert.exe "$@" &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Use OpenMS tools like a linux tool&lt;/strong&gt;&lt;/p&gt;
&lt;table class="codehilitetable"&gt;&lt;tr&gt;&lt;td class="linenos"&gt;&lt;div class="linenodiv"&gt;&lt;pre&gt; 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&lt;/pre&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class="code"&gt;&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="c"&gt;#!/bin/zsh&lt;/span&gt;
&lt;span class="c"&gt;# This script makes OpenMS tools accept stdin input and stdout output (to chain them as normal Unix tools)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;$# &lt;/span&gt;-eq 0 &lt;span class="o"&gt;]&lt;/span&gt; ; &lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="k"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;usage: $0 OpenmsTool -ini OpenmsTool.ini &amp;lt; infile &amp;gt; outfile&amp;quot;&lt;/span&gt;
    &lt;span class="nb"&gt;exit &lt;/span&gt;0
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;span class="c"&gt;# 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&lt;/span&gt;
&lt;span class="c"&gt;# 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&lt;/span&gt;

&lt;span class="c"&gt;# Since /tmp is configured to be a RAM(+SWAP)-disk, let's create a random directory,&lt;/span&gt;
&lt;span class="nv"&gt;TDIR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;mktemp -d&lt;span class="k"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;# and make sure it gets deleted even if this script terminates unexpectedly.&lt;/span&gt;
&lt;span class="nb"&gt;trap&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;{ cd - ; rm -rf $TDIR; exit 255; }&amp;quot;&lt;/span&gt; SIGINT

&lt;span class="c"&gt;# ${cat} reads stdin (binary and text data), this is then echoed into a file called &amp;quot;in&amp;quot;, in this fast tmp directory&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;$(cat)&amp;quot;&lt;/span&gt; &amp;gt; &lt;span class="nv"&gt;$TDIR&lt;/span&gt;/in

&lt;span class="c"&gt;# $@ 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&lt;/span&gt;
&lt;span class="c"&gt;# also redirect OpenMS stdout log messages to stderr, we only want the outfile on stdout of this script&lt;/span&gt;
&lt;span class="c"&gt;# when the tool completes successfully, spew the outfile to stdout with cat&lt;/span&gt;
&lt;span class="s2"&gt;&amp;quot;$@&amp;quot;&lt;/span&gt; -in &lt;span class="nv"&gt;$TDIR&lt;/span&gt;/in -out &lt;span class="nv"&gt;$TDIR&lt;/span&gt;/out 1&amp;gt;&amp;amp;2 &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; cat &lt;span class="nv"&gt;$TDIR&lt;/span&gt;/out

&lt;span class="c"&gt;# remove the temporary directory with everything in it&lt;/span&gt;
rm -rf &lt;span class="nv"&gt;$TDIR&lt;/span&gt;
&lt;span class="c"&gt;# and get the hell out of here!&lt;/span&gt;
&lt;span class="nb"&gt;exit &lt;/span&gt;0
&lt;/pre&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dave Brondsema</dc:creator><pubDate>Wed, 22 Jan 2014 17:43:04 -0000</pubDate><guid>https://sourceforge.neta65b45eb32dd8d707fecc16f66f8e7ab94744d3b</guid></item></channel></rss>