Hi I have a burning question,
I want to run a script named "predict_binding.py". Its syntax is:
./predict_binding.py [argA] [argB] [argC] ./file.txt
file.txt has a column of strings with the same length:
string_1
string_2
string_3
...
string_n
predict_binding.py works with the first 3 arguments and string_1, then the 3 arguments and string_2, and so on.
That's fine, but now I have m argB, and I want to test all of them. I want to use the cluster for this, and this looks like a perfect job for parallel, isn't it?
After reading the manual and spending hours to try to make it work I realised I need some help.
What works so far (and is trivial) is:
parallel --verbose ./predict_binding ::: argA ::: argBi ::: argC ::: ./file.txt
This gives the same result as:
./predict_binding.py argA argBi argC ./file.txt
And indeed the flag --verbose says that the command looks like
./predict_binidng.py argA argBi argC ./file.txt
but I want to test all arg2, so I made a file called args.txt, which looks like this:
argA argB1 argC ./file.txt
argA argB2 argC ./file.txt
...
argA argBm argC ./file.txt
If I do:
cat args.txt | parallel --verbose ./predict_binding.py {}
I get an error from ./predict_binding saying:
predict_binding.py: error: incorrect number of arguments
And verbose says that the command looks like:
./predict_binding.py argA\ argBi\ argC\ ./file.txt
So, maybe those backslashes are affecting the input of ./predict_binding? How could I avoid them?
I have tried using double and single quotations " ', backslash \, backslash with single quote \', none has work!
I also tried:
cat ./args.txt | parallel --verbose echo | ./predict_binding
Same error as above.
And also I tried to use a function like:
binding_func ( ) { ./predict_binding argA $1 argC ./file.txt}
Interestingly, binding_func works for:
parallel binding_func ::: argB1
But if I do:
parallel binding_func ::: argB1 argB2
It gives the result for one arg but fails (same error as above) for the other.
If I put only argB1 in the args.txt file and do:
cat args.txt | parallel --verbose binding_func {}
It fails miserably with the same error: predict_binding.py: error: incorrect number of arguments
It seems a very trivial and easy problem but I haven't been able to solve it }:(
I would appreciate very much any help provided. :)
It is unclear whether you have spent an hour walking through the tutorial (man parallel_tutorial or www.gnu.org/software/parallel/parallel_tutorial.html ).
Can you clear that up?