# PLORC: A Pipelined Lossless Reference-Free Compression Architecture for FASTQ Files
## 2 Proposed Compressor
### The ID Encoder Module  
Figure 4 shows an example of IDs randomly selected from a FASTQ file. The characters in an ID can be divided into two categories:  
* Numbers and English letters. Figure 3: Block diagram for the proposed compressor. Figure 2: An example of one read in a FASTQ file. * Special characters other than numbers and English letters, such as '@', '. ', and space. The IDs from a FASTQ file are of a identical format [33]. Each ID is divided into several areas by special characters. The areas contain different information about this read. The differences between these IDs are merely a few symbols. Therefore, the IDs from the same FASTQ file show high structural similarity. We designed an encoding method based on character comparison utilizing structural similarity. The method divides the character comparison process into eight different input patterns and employs different strategies. We used segments in the comparison to illustrate the strategies. The segments are shown in Figures 5 and 6. The patterns in Figure 6 are the special cases of those in Figure 5. They are defined as'special patterns' because they require special treatments compared with common patterns. The '_base_ID'_ stores the ID from the previous read to participate in the comparison. For the first read, the '_base_ID'_ is itself extracted by the FASTQ Splitter module. The length of the '_base_ID'_ in bytes is also stored. The '_input_ID'_ represents the streaming ID input. The '_base_ptr_ represents which symbol in the '_base_ID'_ is participating in the comparison, which is named '_c_base'_. The character from the '_input_ID'_ is referred to as the '_c_input'_. The first 4 bits of the result are the difference between the length of the current input ID and the previous ID in bytes, which is called the '_len_diff_'. The encoding process decides which pattern the current comparison between the '_c_base_' and '_c_input_' belongs to and then applies the corresponding strategy. The strategies for common patterns shown in Figure 5 are listed below. In Figure 5a, there are continuous identical characters. A 1-byte register named '_same_cnt'_ is used to store the number of identical characters. Figure 4: An example of IDs from a FASTQ file. Figure 5: The common pattern segments in the ID encoding process: (**a**) Continuous identical characters. (**b**) Continuous different characters. (**c**) A pair of identical characters before different characters. (**d**) A pair of different characters before identical characters. In Figure 5b, there are continuous different characters. Another 1-byte register _'diff_cnt'_ calculates the number of different characters. Its value is negative to separate itself from the _'same_cnt'_ register. The _'diff_sym'_ register stores the input character. The number of characters contained in _'diff_sym'_ is recorded for future output. * In Figure 5c, a pair of identical characters appear before different characters. The comparison status is changed. Therefore, the value of _'same_cnt'_ becomes the output signal _'ID output'_ in Figure 3 and is then set as zero. The _'ID bits'_ is 8 because _'same_cnt'_ is a 1-byte register. * In Figure 5d, a pair of different characters appear before identical characters. The output is generated from _'diff_sym'_ nad _'diff_cnt'_. The strategies for special patterns shown in Figure 6 are listed below. * In Figure 6a, the _'c_base'_ becomes a special character before _'c_input'_. It is a special case of Figure 5d, and it means the same special character will appear after some characters in _input_ID_ because of the high structural similarity. The _'base_ptr'_ should remain unchanged. The _'diff_sym'_ and _'diff_cnt'_ are required to update continuously until the special character in _'input_ID'_ arrives. The following operations are the same as in Figure 5d. * In Figure 6b, the _'c_input'_ becomes a special character before 'c_base'. This pattern is also a special case of Figure 5d.