[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with GNU parallel

From: Ole Tange
Subject: Re: Problems with GNU parallel
Date: Fri, 21 Jan 2011 15:21:14 +0100

Hi Ravio.

Consider using the email list for support: then you are not
dependent on me alone.

Your problem is caused by one of the features in GNU Parallel:
arguments containing spaces are quoted so they appear to be a single
argument. This is usually what you when when you are dealing with
filenames containing spaces.

What you want is to pass multiple arguments and have the space be
evaulated by the shell.

In your case the solution is easy: Simply pass the whole command to
parallel instead of just the arguments:

echo "bigWigSummary chr1 1119999 1129999 1 -type=mean" | parallel

In this situation GNU Parallel will not interpret the input as
arguments but as a complete command line and therefore the spaces will
be evaluated by the shell.

So just put 'bigWigSummary' on the start of every line and do:

cat test.txt |  parallel  -k

A good test to see if GNU Parallel quotes the spaces is to use:

"two  spaces"

as argument. If the two spaces between 'two' and 'spaces' are kept
then the spaces have been quoted. If there is only one space left then
it was evaluated by the shell. E.g.

echo "echo two  spaces" | parallel

echo "echo two  spaces" | parallel echo


On Fri, Jan 21, 2011 at 2:54 PM, Raivo Kolde <address@hidden> wrote:
> Hi
> I was trying to use GNU parallel for a task but I cannot get it
> working properly.
> There is a tool bigWigSummary that extracts information from bigWig
> files (way to hold genomic information), that works one set of genome
> coordinates at the time with command like this:
> bigWigSummary chr1 1119999 1129999 1 -type=mean
> So to get the information from several locations i thought I would
> make a file test.txt like this
> chr1 1119999 1129999 1 -type=mean
> chr1 1139999 1149999 1 -type=mean
> chr1 1159999 1169999 1 -type=mean
> Then execute it using GNU parallel like this
> cat test.txt |  parallel  -k bigWigSummary {}
> But then it gives me three times the same error, which I usually get
> when bigWigSummary parameters are incorrect. Everything seems to be
> ok, since
> cat test.txt |  parallel  -k echo  'bigWigSummary {}'
> prints
> bigWigSummary chr1 1119999 1129999 1 -type=mean
> bigWigSummary chr1 1139999 1149999 1 -type=mean
> bigWigSummary chr1 1159999 1169999 1 -type=mean
> that all can be executed one by one without problems. So I cannot
> understand why I cannot get the thing working using this parallel
> command. If you can point me to a quick fix I would be very grateful.
> Sorry, that the example is not self containing because you need a
> bigWig file and the bigWigSummary script (that should be  somewhere in
> some Albins directory in Iris).
> Best,
> Raivo

reply via email to

[Prev in Thread] Current Thread [Next in Thread]