PreKO 0.3.1
PreKO: Precise KO system
Requires Python: >=3.8
Keywords: CRISPR, analysis, bioinformatics, gene, genetics, genome-editing, knockout, python

# PreKO: Precise KO system
Analysis pipeline for PreKO project

### Installation
PreKO에 대한 분석 프로그램은 아래와 같이 설치할 수 있습니다. 

```
pip install PreKO
```


### InDelSearcher: Cas9 nuclease indel analyzer
InDelSearcher는 target sequence에서 indel frequency를 분석하고 계산해주는 파이프라인이다. 특히, high-throughput screening 데이터에서 barcode에 따른 indel frequency를 분석하는 것에 특화되어 있다. 

분석을 위해서, 아래와 같이 barcode와 target sequence 정보가 담긴 csv 파일이 필요하다. 


| Barcode             | Target_region               | Reference_sequence                                            |
| ------------------- | --------------------------- | ------------------------------------------------------------- |
| TTTGCTGTGAGCACTGCTG | TTGTGAACATAGATCCATTTTTCTTGG | CTTGAAAAAGTGGCACCGAGTCGGTGCTTTTTTNNNNNNNNTTTGCTGTGAGCACTGCTGT |
| TTTGGACGTCATAGTGAGA | TCCAGATAGTCATCAACTTTTTGTTGG | CTTGAAAAAGTGGCACCGAGTCGGTGCTTTTTTNNNNNNNNTTTGGACGTCATAGTGAGAT |
| TTTGGCTATCTGCACGTGC | GTGGGGGGCCTGGGGCCTGGAGCCTGG | CTTGAAAAAGTGGCACCGAGTCGGTGCTTTTTTNNNNNNNNTTTGGCTATCTGCACGTGCG |
| TTTGATGCGCATCTCTACG | CCCAGGCAAAACTGCAGTTTTACCTGG | CTTGAAAAAGTGGCACCGAGTCGGTGCTTTTTTNNNNNNNNTTTGATGCGCATCTCTACGC |
| TTTGACTCGAGTCTCTCAC | ACGAGGTGGCCCTGGGGGGCCCCCTGG | CTTGAAAAAGTGGCACCGAGTCGGTGCTTTTTTNNNNNNNNTTTGACTCGAGTCTCTCACA |


barcode 파일과 분석할 FASTQ 파일이 있다면, InDelSearcher를 이용한 분석을 할 수 있다. 

```python
import pandas as pd
from PreKO.indel import InDelSearcher

# Setting: required information
DIR_FASTQ   = f'NGS_data/Cas9_FASTQ_combined/'
barcode     = f'ref_Small_Cas9_KO_Lib.csv'

sample_name = f'HCT_Cas9_R1_Day7'
fastq_file  = f'{DIR_FASTQ}/{sample_name}.fastq'

ids = InDelSearcher()

# Run and show summary
df_summary = ids.run(strFq=fastq_file, barcode=barcode, sample_name=sample_name, thread=25)
df_summary.to_csv(f'InDel_Summary_{sample_name}.csv')
```

InDelSearcher.run의 output (pd.DataFrame)은 아래와 같이 나온다.

| Barcode      | Target_region               | intSwitching | intNumOfTotal | intNumOfIns | intNumOfDel | intNumofCom | intFrame_0 | intFrame_1 | intFrame_2 | IndelFrequency |
| ------------ | --------------------------- | ------------ | ------------- | ----------- | ----------- | ----------- | ---------- | ---------- | ---------- | -------------- |
| ATGTGATCATGC | CAGGAAAAAATATGTGCTATGGAGGGG | 8            | 17            | 1           | 7           | 0           | 9          | 2          | 6          | 47.05882       |
| GACTCTCGTCGA | TTTTAGAGAATATTCACCGTGTCACGG | 8            | 18            | 0           | 12          | 1           | 6          | 9          | 3          | 72.22222       |
| GACTGATACTGT | ACAAAGTCAACTGCCTTCAAACAAGGG | 13           | 22            | 1           | 14          | 0           | 8          | 2          | 12         | 68.18182       |
| GCTGCGCGCACT | CTTCTATAACAAGAAATCTGATGTGGG | 11           | 25            | 2           | 18          | 1           | 13         | 4          | 8          | 84             |
| TCGCTGTGACTC | CCGCGCCGCGCGTTACCTTCCGCGGGG | 6            | 11            | 0           | 11          | 0           | 2          | 0          | 9          | 100            |


이를 `to_csv()` 등의 함수로 저장해서 이후 분석에 사용한다.

# Environments
These codes were tested in Ubuntu 22.04 LTS environments.

# Requirements
- Python >= 3.8
- biopython
- pandas
- numpy
- pydantic
- tqdm