Does hisat2 --rg flag eat the "/" character in multiline definitions?
1
0
Entering edit mode
2.5 years 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
./align_command.sh: line 16: --rg: command not found
./align_command.sh: line 17: --rg: command not found
./align_command.sh: line 18: --rg: command not found
./align_command.sh: 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 • 692 views
ADD COMMENT
1
Entering edit mode
2.5 years 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 \
world

echo hello \
world

running the script I get:

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

Login before adding your answer.

Traffic: 2599 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

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

Powered by the version 2.3.6