Does hisat2 --rg flag eat the "/" character in multiline definitions?
Entering edit mode
19 months ago
mkozubov • 0

Hello, I am trying to use hisat2, but I noticed something weird.

When running it like so:

hisat2 \
       -p 8 \
       --rg-id=UHR_Rep2 \
       --rg SM:UHR \
       --rg LB:UHR_Rep2_ERCC-Mix1 \
       --rg PL:ILLUMINA \
       --rg PU:CXX1234-TGACAC.1 \
       -x $RNA_REF_INDEX \
       --dta \
       --rna-strandness RF \
       -1 "$RNA_DATA_DIR/${SAMPLE}_1.fastq.gz" \
       -2 "$RNA_DATA_DIR/${SAMPLE}_2.fastq.gz" \
       -S ./sams/UHR_Rep1.sam

I would get this output on the commandline:

(ERR): hisat2-align exited with value 1
./ line 16: --rg: command not found
./ line 17: --rg: command not found
./ line 18: --rg: command not found
./ line 20: -x: command not found

I thought this was pretty strange, and after mucking about I tried this, and it worked!

hisat2 \
        -x ./$RNA_REF_INDEX \
        --dta \
        --rna-strandness RF \
        -1 $RNA_DATA_DIR/${SAMPLE}_1.fastq.gz \
        -2 $RNA_DATA_DIR/${SAMPLE}_2.fastq.gz \
        -S ./sams/UHR_Rep1.sam \
        --rg-id=UHR_Rep2 --rg SM:UHR

My question is does --rg actually eat up the "\" character? Is that why I was getting the command not found error? If so, how can I ask it to not act like this?

bash hisat2 script • 494 views
Entering edit mode
19 months ago

The backslash is a continuation character in bash, it is not transmitted to the command (in this case hisat2) the program does not even see that character, thus it cannot "eat it up" since it is never seen.

What the backslash does is:

The backslash character ‘\’ may be used to remove any special meaning for the next character read and for line continuation.

Thus it has an effect only one character out, thus if you have an space after the backslash then it effectively does nothing and bash wants to execute --rg as a command, hence the error that you see. Here is an example where the second backslash has an invisible space after it

echo hello \

echo hello \

running the script I get:

hello world
test: line 5: world: command not found

Login before adding your answer.

Traffic: 1046 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6