shenwei356 / rush

A cross-platform command-line tool for executing jobs in parallel
https://github.com/shenwei356/rush
MIT License
846 stars 63 forks source link

The '>' symbol in the FASTA file is being interpreted as a redirect command. #51

Open famiji opened 8 months ago

famiji commented 8 months ago

Hello, I am new to bioinformatics and recently discovered that Rush offers support for custom-defined variables and advanced embedded replacement strings. I have realized the convenience of using single-line commands to process sequences in a shell environment. However, while learning through examples, I encountered an issue when trying to execute the following command: echo -ne ">seq1\nactg\n>seq2\nAAAA\n>seq3\nCCCC"|rush It get the right result,but when i try: echo -ne ">seq1\nactg\n>seq2\nAAAA\n>seq3\nCCCC"|rush echo {} image As shown in the picture, this command only prints out the sequence lines, but the description line is not output, instead generating an empty file with the description line as the file name. So I tried the following command again and the result was the same: image It appears that the issue I encountered is related to the interpretation of the redirect command (>) by the echo command. Logically, enclosing the redirect command in quotation marks should prevent this problem. Additionally, I tried using the parallel command and obtained the correct result. image Is the situation described above a result of my incorrect usage of Rush? image

shenwei356 commented 8 months ago

Oh, I never noticed that. In rush, the {} is replaced with the input as it is. So you need to wrap the input with quotes.

$ echo -ne ">s\nactg\n" | rush  'echo "{}"'
>s
actg

parallel seems to detect the symbol > and add quotes for the input.

famiji commented 8 months ago

So I need to be careful when using rushto handle the content of FASTA file

shenwei356 commented 8 months ago

I don't recommend directly processing fasta content with rush, please use tools like seqkit.