I was just wondering how does sliding window in trimmomatic work?

The definition is scanning from the 5' end of the read, and removes the 3' end of the read when the average quality of a group of bases drops below a specified threshold. For example, if we have a sequence `ATCGATCGATCG` and we set `SLIDINGWINDOW: 4:15`.

It begins with the first 4 in a window, `ATCG`, but if the score is below 15, which base it will trim? Is that the last base in this window? What is the next start position of the window? 2 or 5? thanks.
The SLIDINGWINDOW trimmer will cut the leftmost position in the window where the average quality drops below the threshold and remove the rest of the read. However if there is low quality in the very beginning of the read then it will fail the minimum length tests and be removed completely - the remaining 3-prime end (even if it is good quality will not be printed)

Consider the following test file `t.fq`:

    @1\1
    AATGATCGTAGCGATGCAAGCTAGCCCGATGCCCGATCGCATCG
    +
    eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeEFCB
    @2\1
    AATGATCGTAGCGATGCAAGCTAGCCCGATGCCCGATCGCATCG
    +
    EFCBeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

and processing with:

    $ java -jar trimmomatic.jar SE -phred64 t.fq tt.fq SLIDINGWINDOW:4:15
    
    TrimmomaticSE: Started with arguments: -phred64 t.fq tt.fq SLIDINGWINDOW:4:15
    Automatically using 16 threads
    Input Reads: 2 Surviving: 1 (50.00%) Dropped: 1 (50.00%)
    TrimmomaticSE: Completed successfully

The output file looks like the following:

    @1\1
    AATGATCGTAGCGATGCAAGCTAGCCCGATGCCCGATCGC
    +
    eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

As you can see the read with the poor quality at the beginning has been removed completely