Question: 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. :)

Answer: Final Edit:
Calling it like this will work:

cat vals.txt | parallel --verbose "echo -e mhc_i/examples/input_sequence.fasta | mhc_i/src/predict_binding.py smm {} 9"

parallel --verbose "echo -e mhc_i/examples/input_sequence.fasta | mhc_i/src/predict_binding.py {}" ::: smm ::: HLA-C*15:02 HLA-E*01:01 ::: 9

The script predict_binding.py looks also for sys.stdin (l301-303) and adds an empty argument to the list if you call it with parallel in the way you tried. I'm not sure why this happens, but if you pipe the input fasta file to the script you can also run it with parallel.

---
Old Answer:

I am not sure if I understand the question correctly but for me this seems to work if the 2nd argument is a list of arguments:

`parallel --verbose ./predict_binding ::: argA ::: argB1 argB2 argB3 ::: argC ::: ./file.txt`

`parallel --verbose ./predict_binding ::: argA ::: argB* ::: argC ::: ./file.txt`
(e.g. if arguments are files)

parallel --verbose ./script.sh ::: argA ::: argB* ::: argC ::: file.txt

./script.sh argA argB argC file.txt
./script.sh argA argB1 argC file.txt
./script.sh argA argB2 argC file.txt