Shell scripting

Hello,

I have this code to submit a job to cluster in a genomic analysis.

I can't fully understand the first lines of the code:

ref=$1 
read1=$2 
read1=${read1#*/} 
read=${read1%_*_*} 

ref=$1 means that ref has become a variable.
read1=$2 means that read1 has become the name of the second variable.

Is that correct? what are the meanings of the third and fourth lines. Does it have something with the names of the files?

Thanks a lot in advance.

Line 1: The variable ref is assigned the first argument to the script

Line 2: The variable read1 is assigned the second one

Line 3: In ref, everything up to the first '/' character is removed. For example, if ref was "one/two/three", it is now "two/three"

Line 4: In read1, two groups of '_' followed by a arbitrary number of non-underscore-characters is elimited at the end of the string. For example if read1 was "one_two_three_four" it is now "one_two".

Possibly useful reading:
Bash Reference Manual: Shell Parameter Expansion