## 2 Materials and Methods
### Simulated Dataset  
To test the performance of CleanSeq for contamination detection and decontamination, several multi-bacteria hybrid test datasets were generated via dwgsim v0.1.11 ([[http://github.com/nh13/dwgsim](http://github.com/nh13/dwgsim)]([http://github.com/nh13/dwgsim](http://github.com/nh13/dwgsim)), accessed on 30 January 2022) using the reference genomes of 10 bacterial strains, including eight species (_Aeronomas hydrophila_ (JH815591.1), _Bacteroides fragilis_ (CR626927.1), _Citrobacter freundii_ (CP016762.1), _Klebsiella pneumoniae_ (FO834906.1),Mycobacterium abscess_ (CU458896.1), _Salmonella enterica_ (CP007523.1), _Staphylococcus aureus_ (AP017922.1), and _Streptococcus pyogenes_ (AE014074.1)) partially mentioned in the GAGE-B project [14; 29] in addition to _Escherichia coli_ (NZ_LR881938.1) and _Pseudomonas aeruginosa_ (CP007224.1). The following conditions were employed in dwsgim:  
1. Coverage: 3\(\times\) or 30\(\times\); mutation rate: 0.0001%; error rate: 0.01%.
2. Coverage: 30\(\times\); mutation rate: 0.01% or 0.0001%; error rate: 0.01%.  
To investigate the possible effects of genome similarity on CleanSeq, four distinct strains, _E. coli_ (NZ_LR881938.1), _P. aeruginosa_ (CP007224.1), _S. enterica_ (CP007523.1), and _Shigella flexneri_ (AE014073.1), were used to build the simulated datasets. The genome similarity was approximately 0.42% for _E. coli_ and _P. aeruginosa_, _7.73%_ for _E. coli_ and _S. enterica_, and 82.99% for _E. coli_ and _S. flexneri_, respectively. _E. coli_ was designated as the target species, while the contaminating bacteria were _P. aeruginosa_, _S. enterica_, or _S. flexneri_ for each independent dataset, respectively. The contamination degree was set differently as 5%, 10%, 30%, 50%, and 70%. Each dataset had a sample size of 1 million reads, a read length of 150 bp, and an error rate of 0.01%. All the decontaminated reads were verified again using the reference genome accession number, and the efficiency and contamination degree were calculated:  
\[\text{Efficiency}\ =\frac{\text{num of target species}^{\prime}\ \text{clean reads}}{\text{num of target species}^{\prime}\ \text{total reads}}\]  
\[\text{Contamination degree}\ =\frac{\text{num of other species}^{\prime}\ \text{reads}}{\text{num of clean reads}}\]  
To evaluate the impact of coverage and mutation rate on the efficiency and accuracy of mutation verification in CleanSeq, we simulated a series of the dataset by dwgsim from five bacteria species, _P. aeruginosa_ (CP007224.1), _E. coli_ (NZ_LR881938.1), _Citrobacter freundii_ (CP016762.1), _B. fragilis_ (CR626927.1), and _S. pyogenes_ (AE014074.1). The following parameters were considered in dwgsim: coverage = 30\(\times\) or 100\(\times\), mutation rate = 0.01%, 0.001%, or 0.0001%, error rate = 0.01%. Additionally, one publicly available contamination dataset from bacterial WGS ([[https://doi.org/10.6084/m9.figshare.c.4282706.v2](https://doi.org/10.6084/m9.figshare.c.4282706.v2)]([https://doi.org/10.6084/m9.figshare.c.4282706.v2](https://doi.org/10.6084/m9.figshare.c.4282706.v2)), accessed on 30 January 2022, [30]) was also used in this study to test CleanSeq. All the above tests were performed in triplicates (as shown in mean (SD)) and compared with the results from MutScan.  
As for the final test dataset mimicking the actual experimental results, a total of 150 million (1,425,042 after cleanup of duplicates) read mixtures of _E. coli_ (949,982, \(\sim\)2/3) and _P. aeruginosa_ (475,060, \(\sim\)1/3) were generated in dwgsim.