offtracker 2.7.8__zip → 2.10.0__zip
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- offtracker-2.10.0/PKG-INFO +233 -0
- offtracker-2.10.0/README.md +221 -0
- {offtracker-2.7.8 → offtracker-2.10.0}/offtracker/X_offplot.py +37 -8
- {offtracker-2.7.8 → offtracker-2.10.0}/offtracker/X_sequence.py +113 -7
- offtracker-2.10.0/offtracker/_version.py +36 -0
- offtracker-2.10.0/offtracker/snakefile/Snakefile_QC.smk +66 -0
- offtracker-2.10.0/offtracker/snakefile/Snakefile_offtracker.smk +249 -0
- offtracker-2.7.8/offtracker/mapping/1.1_bed2fr_v4.5.py → offtracker-2.10.0/offtracker/utility/1.1_bed2fr.py +6 -4
- offtracker-2.10.0/offtracker.egg-info/PKG-INFO +233 -0
- offtracker-2.10.0/offtracker.egg-info/SOURCES.txt +28 -0
- {offtracker-2.7.8 → offtracker-2.10.0}/scripts/offtracker_analysis.py +20 -5
- offtracker-2.10.0/scripts/offtracker_candidates.py +318 -0
- {offtracker-2.7.8 → offtracker-2.10.0}/scripts/offtracker_config.py +28 -44
- offtracker-2.10.0/scripts/offtracker_plot.py +39 -0
- offtracker-2.10.0/scripts/offtracker_qc.py +62 -0
- {offtracker-2.7.8 → offtracker-2.10.0}/setup.py +8 -4
- offtracker-2.7.8/PKG-INFO +0 -146
- offtracker-2.7.8/README.md +0 -134
- offtracker-2.7.8/offtracker/_version.py +0 -28
- offtracker-2.7.8/offtracker/mapping/Snakefile_offtracker +0 -245
- offtracker-2.7.8/offtracker.egg-info/PKG-INFO +0 -146
- offtracker-2.7.8/offtracker.egg-info/SOURCES.txt +0 -25
- offtracker-2.7.8/scripts/offtracker_candidates.py +0 -307
- {offtracker-2.7.8 → offtracker-2.10.0}/LICENSE.txt +0 -0
- {offtracker-2.7.8 → offtracker-2.10.0}/MANIFEST.in +0 -0
- {offtracker-2.7.8 → offtracker-2.10.0}/offtracker/X_offtracker.py +0 -0
- {offtracker-2.7.8 → offtracker-2.10.0}/offtracker/__init__.py +0 -0
- {offtracker-2.7.8/offtracker/mapping → offtracker-2.10.0/offtracker/utility}/1.3_bdg_normalize_v4.0.py +0 -0
- {offtracker-2.7.8/offtracker/mapping → offtracker-2.10.0/offtracker/utility}/bedGraphToBigWig +0 -0
- {offtracker-2.7.8/offtracker/mapping → offtracker-2.10.0/offtracker/utility}/hg38.chrom.sizes +0 -0
- {offtracker-2.7.8/offtracker/mapping → offtracker-2.10.0/offtracker/utility}/mm10.chrom.sizes +0 -0
- {offtracker-2.7.8/offtracker/mapping → offtracker-2.10.0/offtracker/utility}/offtracker_blacklist_hg38.merged.bed +0 -0
- {offtracker-2.7.8/offtracker/mapping → offtracker-2.10.0/offtracker/utility}/offtracker_blacklist_mm10.merged.bed +0 -0
- {offtracker-2.7.8 → offtracker-2.10.0}/offtracker.egg-info/dependency_links.txt +0 -0
- {offtracker-2.7.8 → offtracker-2.10.0}/offtracker.egg-info/requires.txt +0 -0
- {offtracker-2.7.8 → offtracker-2.10.0}/offtracker.egg-info/top_level.txt +0 -0
- {offtracker-2.7.8 → offtracker-2.10.0}/setup.cfg +0 -0
@@ -0,0 +1,233 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: offtracker
|
3
|
+
Version: 2.10.0
|
4
|
+
Summary: Tracking-seq data analysis
|
5
|
+
Home-page: https://github.com/Lan-lab/offtracker
|
6
|
+
Author: Runda Xu
|
7
|
+
Author-email: xrd18@tsinghua.org.cn
|
8
|
+
Requires-Python: >=3.6.0
|
9
|
+
Description-Content-Type: text/markdown
|
10
|
+
License-File: LICENSE.txt
|
11
|
+
|
12
|
+
|
13
|
+
# OFF-TRACKER
|
14
|
+
|
15
|
+
OFF-TRACKER is an end to end pipeline of Tracking-seq data analysis for detecting off-target sites of any genome editing tools that generate double-strand breaks (DSBs) or single-strand breaks (SSBs).
|
16
|
+
|
17
|
+
## System requirements
|
18
|
+
|
19
|
+
* Linux/Unix
|
20
|
+
* Python >= 3.6
|
21
|
+
|
22
|
+
## Dependency
|
23
|
+
|
24
|
+
```bash
|
25
|
+
# We recommend creating a new environment using mamba/conda to avoid compatibility problems
|
26
|
+
# If you don't use mamba, just replace the code with conda
|
27
|
+
# Windows systems may not be compatible with pybedtools.
|
28
|
+
mamba create -n offtracker -c bioconda blast snakemake pybedtools chromap
|
29
|
+
```
|
30
|
+
|
31
|
+
|
32
|
+
## Installation
|
33
|
+
|
34
|
+
```bash
|
35
|
+
# Activate the environment
|
36
|
+
conda activate offtracker
|
37
|
+
|
38
|
+
# Direct installation with pip
|
39
|
+
pip install offtracker
|
40
|
+
|
41
|
+
# (Alternative) Download the offtracker from github
|
42
|
+
git clone https://github.com/Lan-lab/offtracker.git
|
43
|
+
cd offtracker
|
44
|
+
pip install .
|
45
|
+
```
|
46
|
+
|
47
|
+
|
48
|
+
## Before analyzing samples
|
49
|
+
|
50
|
+
```bash
|
51
|
+
# Build blast index (only need once for each genome)
|
52
|
+
makeblastdb -input_type fasta -title hg38 -dbtype nucl -parse_seqids \
|
53
|
+
-in /Your_Path_To_Reference/hg38_genome.fa \
|
54
|
+
-out /Your_Path_To_Reference/hg38_genome.blastdb \
|
55
|
+
-logfile /Your_Path_To_Reference/hg38_genome.blastdb.log
|
56
|
+
|
57
|
+
# Build chromap index (only need once for each genome)
|
58
|
+
chromap -i -r /Your_Path_To_Reference/hg38_genome.fa \
|
59
|
+
-o /Your_Path_To_Reference/hg38_genome.chromap.index
|
60
|
+
|
61
|
+
# Generate candidate regions by sgRNA sequence (need once for each genome and sgRNA)
|
62
|
+
# --name: a user-defined name of the sgRNA, which will be used in the following analysis.
|
63
|
+
offtracker_candidates.py -t 8 -g hg38 \
|
64
|
+
-r /Your_Path_To_Reference/hg38_genome.fa \
|
65
|
+
-b /Your_Path_To_Reference/hg38_genome.blastdb \
|
66
|
+
--name 'VEGFA2' --sgrna 'GACCCCCTCCACCCCGCCTC' --pam 'NGG' \
|
67
|
+
-o /Your_Path_To_Candidates_Folder
|
68
|
+
|
69
|
+
```
|
70
|
+
|
71
|
+
|
72
|
+
## Quality control and adapter trimming
|
73
|
+
|
74
|
+
```bash
|
75
|
+
# Generate snakemake config file for quality control and adapter trimming.
|
76
|
+
offtracker_qc.py -t 4 \
|
77
|
+
-f /Your_Path_To_Input_Folder \
|
78
|
+
--subfolder 0
|
79
|
+
|
80
|
+
cd /Your_Path_To_Input_Folder/Trimmed_data
|
81
|
+
snakemake -np # dry run to check whether everything is alright
|
82
|
+
nohup snakemake --cores 16 1>${outdir}/sm_qc.log 2>&1 &
|
83
|
+
|
84
|
+
"""
|
85
|
+
Set “--subfolder 0” if the file structure is like:
|
86
|
+
| - Input_Folder
|
87
|
+
| - sample1_R1.fastq.gz
|
88
|
+
| - sample1_R2.fastq.gz
|
89
|
+
| - sample2_R1.fastq.gz
|
90
|
+
| - sample2_R2.fastq.gz
|
91
|
+
Set “--subfolder 1” if the file structure is like:
|
92
|
+
| - Input_Folder
|
93
|
+
| - Sample1_Folder
|
94
|
+
| - sample1_R1.fastq.gz
|
95
|
+
| - sample1_R2.fastq.gz
|
96
|
+
| - Sample2_Folder
|
97
|
+
| - sample2_R1.fastq.gz
|
98
|
+
| - sample2_R2.fastq.gz
|
99
|
+
|
100
|
+
The script “offtracker_qc.py” will create a “Trimmed_data” folder under /Your_Path_To_Input_Folder.
|
101
|
+
If “-o /Your_Path_To_Output” is set, the output will be redirected to /Your_Path_To_Output.
|
102
|
+
"""
|
103
|
+
```
|
104
|
+
|
105
|
+
## Strand-specific mapping of Tracking-seq data
|
106
|
+
|
107
|
+
```bash
|
108
|
+
|
109
|
+
# Generate snakemake config file for mapping
|
110
|
+
# Results will be generated in /Your_Path_To_Output, if -o is not set, the output will be in the same folder as the fastq files
|
111
|
+
offtracker_config.py -t 8 -g hg38 --blacklist hg38 \
|
112
|
+
-r /Your_Path_To_Reference/hg38_genome.fa \
|
113
|
+
-i /Your_Path_To_Reference/hg38_genome.chromap.index \
|
114
|
+
-f /Your_Path_To_Trimmed_Data \
|
115
|
+
-o /Your_Path_To_Output \
|
116
|
+
--subfolder 0
|
117
|
+
|
118
|
+
# Warning: Do not contain "fastq" or "fq" in the folder name, otherwise the program may treat the folder as a fastq file
|
119
|
+
# This problem may be fixed in the future
|
120
|
+
|
121
|
+
# Run the snakemake program
|
122
|
+
cd /Your_Path_To_Fastq
|
123
|
+
snakemake -np # dry run
|
124
|
+
nohup snakemake --cores 16 1>sm_mapping.log 2>sm_mapping.err &
|
125
|
+
|
126
|
+
## about cores
|
127
|
+
# --cores of snakemake must be larger than -t of offtracker_config.py
|
128
|
+
# parallel number = cores/t
|
129
|
+
|
130
|
+
## about output
|
131
|
+
# This part will generate "*.fw.scaled.bw" and ".rv.scaled.bw" for IGV visualization
|
132
|
+
# "*.fw.bed" and "*.rv.bed" are used in the next part.
|
133
|
+
```
|
134
|
+
|
135
|
+
|
136
|
+
## Analyzing the genome-wide off-target sites
|
137
|
+
|
138
|
+
```bash
|
139
|
+
# In this part, multiple samples in the same condition can be analyzed in a single run by pattern recognition of sample names
|
140
|
+
|
141
|
+
offtracker_analysis.py -g hg38 --name "VEGFA2" \
|
142
|
+
--exp 'Cas9_VEGFA2' \
|
143
|
+
--control 'WT' \
|
144
|
+
--outname 'Cas9_VEGFA_293' \
|
145
|
+
-f /Your_Path_To_Output \
|
146
|
+
--seqfolder /Your_Path_To_Candidates
|
147
|
+
|
148
|
+
# --name: the same gRNA name you set when running offtracker_candidates.py
|
149
|
+
# --exp/--control: add one or multiple patterns of file name in regular expressions
|
150
|
+
# If multiple samples meet the pattern, their signals will be averaged. Thus, only samples with the same condition should be included in a single analysis.
|
151
|
+
|
152
|
+
# This step will generate Offtracker_result_{outname}.csv
|
153
|
+
# Default FDR is 0.05, which can be changed by --fdr. This will empirically make the threshold of Track score around 2.
|
154
|
+
# Sites with Track score >=2, which is a empirical threshold, are output regardless of FDR.
|
155
|
+
# Intermediate files are saved in ./temp folder, which can be deleted.
|
156
|
+
# Keeping the intermediate files can make the analysis faster if involving previously analyzed samples (e.g. using the same control samples for different analyses)
|
157
|
+
```
|
158
|
+
|
159
|
+
## Off-target sequences visualization
|
160
|
+
|
161
|
+
```bash
|
162
|
+
# After get the Offtracker_result_{outname}.csv, you can visualize the off-target sites with their genomic sequence with the following command:
|
163
|
+
|
164
|
+
offtracker_plot.py --result Your_Offtracker_Result_CSV \
|
165
|
+
--sgrna 'GACCCCCTCCACCCCGCCTC' --pam 'NGG'
|
166
|
+
|
167
|
+
# The default output is a pdf file with Offtracker_result_{outname}.pdf
|
168
|
+
# Assigning a specific output file with another suffix can change the format. e.g., "--output Offtracker_plot.png" will generate a png file.
|
169
|
+
# The orange dash line indicates the empirical threshold of Track score = 2
|
170
|
+
# Empirically, the off-target sites with Track score < 2 are less likely to be real off-target sites.
|
171
|
+
```
|
172
|
+
|
173
|
+
|
174
|
+
## Note1, when not using hg38 or mm10
|
175
|
+
|
176
|
+
The default setting only includes chr1-chr22, chrX, chrY, and chrM. (only suitable for human and mouse) \
|
177
|
+
If you are using reference genomes without "chr" at the beginning, or want to analyze all chromosomes or other species, you can set "--ignore_chr" when running offtracker_config.py to skip chromosome filter.
|
178
|
+
|
179
|
+
Currently, this software is only ready-to-use for mm10 and hg38. For any other genome, e.g., hg19, please add a genome size file named "hg19.chrom.sizes" to .\offtracker\utility. Besides, add "--blacklist none" or "--blacklist Your_Blacklist" (e.g., ENCODE blacklist) when running offtracker_config.py, because we only include blacklists for mm10 and hg38.
|
180
|
+
|
181
|
+
## Note2
|
182
|
+
|
183
|
+
The FDRs in the Tracking-seq result do not reflect the real off-target probability.
|
184
|
+
It is strongly recommended to observe the "fw.scaled.bw" and "rv.scaled.bw" using genome browser like IGV to visually inspect each target location from the Tracking-seq result.
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
# Example Data
|
189
|
+
|
190
|
+
Here are example data that contains reads of chr6 from HEK293T cells edited with Cas9 + sgRNA VEGFA2 and wild type cells:
|
191
|
+
|
192
|
+
https://figshare.com/articles/dataset/WT_HEK239T_chr6/25956034
|
193
|
+
|
194
|
+
It takes about 5-10 minutes to run the mapping (offtracker_config.py & snakemake) of example data with -t 8 and --cores 16 (2 parallel tasks)
|
195
|
+
|
196
|
+
## Signal visualization
|
197
|
+
|
198
|
+
After mapping, there will be 4 .bw files in the output folder:
|
199
|
+
```bash
|
200
|
+
Cas9_VEGFA2_chr6.fw.scaled.bw
|
201
|
+
|
202
|
+
Cas9_VEGFA2_chr6.rv.scaled.bw
|
203
|
+
|
204
|
+
WT_chr6.fw.scaled.bw
|
205
|
+
|
206
|
+
WT_chr6.rv.scaled.bw
|
207
|
+
```
|
208
|
+
These files can be visualized in genome browser like IGV:
|
209
|
+
|
210
|
+

|
211
|
+
|
212
|
+
The signal (coverage) for each sample is normalized to 1e7/total_reads. As only reads mapping to chr6 were extracted in the example data, the signal range is much higher than that of the whole genome samples.
|
213
|
+
|
214
|
+
## Whole genome off-target analysis
|
215
|
+
|
216
|
+
For analyzing the signals (offtracker_analysis.py), it takes about 3-5 minutes and outputs a file named "Offtracker_result_{outname}.csv"
|
217
|
+
|
218
|
+
After that, you can visualize the off-target sites with their genomic sequence (offtracker_plot.py) and get an image like this:
|
219
|
+
|
220
|
+

|
221
|
+
|
222
|
+
# Citation
|
223
|
+
|
224
|
+
If you use Tracking-seq or OFF-TRACKER in your research, please cite the following paper:
|
225
|
+
|
226
|
+
Zhu, M., Xu, R., Yuan, J., Wang, J. et al. Tracking-seq reveals the heterogeneity of off-target effects in CRISPR–Cas9-mediated genome editing. Nat Biotechnol (2024). https://doi.org/10.1038/s41587-024-02307-y
|
227
|
+
|
228
|
+
The signal visualization of .bw file here was generated by the Integrative Genomics Viewer (IGV) software. The signal visualization in the Tracking-seq article above was generated by either IGV or pyGenomeTracks:
|
229
|
+
|
230
|
+
Robinson, J., Thorvaldsdóttir, H., Winckler, W. et al. Integrative genomics viewer. Nat Biotechnol 29, 24–26 (2011). https://doi.org/10.1038/nbt.1754
|
231
|
+
|
232
|
+
Lopez-Delisle L, Rabbani L, Wolff J, Bhardwaj V, Backofen R, Grüning B, Ramírez F, Manke T. pyGenomeTracks: reproducible plots for multivariate genomic data sets. Bioinformatics. 2020 Aug 3:btaa692. doi: 10.1093/bioinformatics/btaa692.
|
233
|
+
|
@@ -0,0 +1,221 @@
|
|
1
|
+
# Offtracker
|
2
|
+
|
3
|
+
Offtracker is an end to end pipeline of Tracking-seq data analysis for detecting off-target sites of any genome editing tools that generate double-strand breaks (DSBs) or single-strand breaks (SSBs).
|
4
|
+
|
5
|
+
## System requirements
|
6
|
+
|
7
|
+
* Linux/Unix
|
8
|
+
* Python >= 3.6
|
9
|
+
|
10
|
+
## Dependency
|
11
|
+
|
12
|
+
```bash
|
13
|
+
# We recommend creating a new environment using mamba/conda to avoid compatibility problems
|
14
|
+
# If you don't use mamba, just replace the code with conda
|
15
|
+
# Windows systems may not be compatible with pybedtools.
|
16
|
+
mamba create -n offtracker -c bioconda blast snakemake pybedtools chromap
|
17
|
+
```
|
18
|
+
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
```bash
|
23
|
+
# Activate the environment
|
24
|
+
conda activate offtracker
|
25
|
+
|
26
|
+
# Direct installation with pip
|
27
|
+
pip install offtracker
|
28
|
+
|
29
|
+
# (Alternative) Download the offtracker from github
|
30
|
+
git clone https://github.com/Lan-lab/offtracker.git
|
31
|
+
cd offtracker
|
32
|
+
pip install .
|
33
|
+
```
|
34
|
+
|
35
|
+
|
36
|
+
## Before analyzing samples
|
37
|
+
|
38
|
+
```bash
|
39
|
+
# Build blast index (only need once for each genome)
|
40
|
+
makeblastdb -input_type fasta -title hg38 -dbtype nucl -parse_seqids \
|
41
|
+
-in /Your_Path_To_Reference/hg38_genome.fa \
|
42
|
+
-out /Your_Path_To_Reference/hg38_genome.blastdb \
|
43
|
+
-logfile /Your_Path_To_Reference/hg38_genome.blastdb.log
|
44
|
+
|
45
|
+
# Build chromap index (only need once for each genome)
|
46
|
+
chromap -i -r /Your_Path_To_Reference/hg38_genome.fa \
|
47
|
+
-o /Your_Path_To_Reference/hg38_genome.chromap.index
|
48
|
+
|
49
|
+
# Generate candidate regions by sgRNA sequence (need once for each genome and sgRNA)
|
50
|
+
# --name: a user-defined name of the sgRNA, which will be used in the following analysis.
|
51
|
+
offtracker_candidates.py -t 8 -g hg38 \
|
52
|
+
-r /Your_Path_To_Reference/hg38_genome.fa \
|
53
|
+
-b /Your_Path_To_Reference/hg38_genome.blastdb \
|
54
|
+
--name 'VEGFA2' --sgrna 'GACCCCCTCCACCCCGCCTC' --pam 'NGG' \
|
55
|
+
-o /Your_Path_To_Candidates_Folder
|
56
|
+
|
57
|
+
```
|
58
|
+
|
59
|
+
|
60
|
+
## Quality control and adapter trimming
|
61
|
+
|
62
|
+
```bash
|
63
|
+
# Generate snakemake config file for quality control and adapter trimming.
|
64
|
+
offtracker_qc.py -t 4 \
|
65
|
+
-f /Your_Path_To_Input_Folder \
|
66
|
+
--subfolder 0
|
67
|
+
|
68
|
+
cd /Your_Path_To_Input_Folder/Trimmed_data
|
69
|
+
snakemake -np # dry run to check whether everything is alright
|
70
|
+
nohup snakemake --cores 16 1>${outdir}/sm_qc.log 2>&1 &
|
71
|
+
|
72
|
+
"""
|
73
|
+
Set “--subfolder 0” if the file structure is like:
|
74
|
+
| - Input_Folder
|
75
|
+
| - sample1_R1.fastq.gz
|
76
|
+
| - sample1_R2.fastq.gz
|
77
|
+
| - sample2_R1.fastq.gz
|
78
|
+
| - sample2_R2.fastq.gz
|
79
|
+
Set “--subfolder 1” if the file structure is like:
|
80
|
+
| - Input_Folder
|
81
|
+
| - Sample1_Folder
|
82
|
+
| - sample1_R1.fastq.gz
|
83
|
+
| - sample1_R2.fastq.gz
|
84
|
+
| - Sample2_Folder
|
85
|
+
| - sample2_R1.fastq.gz
|
86
|
+
| - sample2_R2.fastq.gz
|
87
|
+
|
88
|
+
The script “offtracker_qc.py” will create a “Trimmed_data” folder under /Your_Path_To_Input_Folder.
|
89
|
+
If “-o /Your_Path_To_Output” is set, the output will be redirected to /Your_Path_To_Output.
|
90
|
+
"""
|
91
|
+
```
|
92
|
+
|
93
|
+
## Strand-specific mapping of Tracking-seq data
|
94
|
+
|
95
|
+
```bash
|
96
|
+
|
97
|
+
# Generate snakemake config file for mapping
|
98
|
+
# Results will be generated in /Your_Path_To_Output, if -o is not set, the output will be in the same folder as the fastq files
|
99
|
+
offtracker_config.py -t 8 -g hg38 --blacklist hg38 \
|
100
|
+
-r /Your_Path_To_Reference/hg38_genome.fa \
|
101
|
+
-i /Your_Path_To_Reference/hg38_genome.chromap.index \
|
102
|
+
-f /Your_Path_To_Trimmed_Data \
|
103
|
+
-o /Your_Path_To_Output \
|
104
|
+
--subfolder 0
|
105
|
+
|
106
|
+
# Warning: Do not contain "fastq" or "fq" in the folder name, otherwise the program may treat the folder as a fastq file
|
107
|
+
# This problem may be fixed in the future
|
108
|
+
|
109
|
+
# Run the snakemake program
|
110
|
+
cd /Your_Path_To_Fastq
|
111
|
+
snakemake -np # dry run
|
112
|
+
nohup snakemake --cores 16 1>sm_mapping.log 2>sm_mapping.err &
|
113
|
+
|
114
|
+
## about cores
|
115
|
+
# --cores of snakemake must be larger than -t of offtracker_config.py
|
116
|
+
# parallel number = cores/t
|
117
|
+
|
118
|
+
## about output
|
119
|
+
# This part will generate "*.fw.scaled.bw" and ".rv.scaled.bw" for IGV visualization
|
120
|
+
# "*.fw.bed" and "*.rv.bed" are used in the next part.
|
121
|
+
```
|
122
|
+
|
123
|
+
|
124
|
+
## Analyzing the genome-wide off-target sites
|
125
|
+
|
126
|
+
```bash
|
127
|
+
# In this part, multiple samples in the same condition can be analyzed in a single run by pattern recognition of sample names
|
128
|
+
|
129
|
+
offtracker_analysis.py -g hg38 --name "VEGFA2" \
|
130
|
+
--exp 'Cas9_VEGFA2' \
|
131
|
+
--control 'WT' \
|
132
|
+
--outname 'Cas9_VEGFA_293' \
|
133
|
+
-f /Your_Path_To_Output \
|
134
|
+
--seqfolder /Your_Path_To_Candidates
|
135
|
+
|
136
|
+
# --name: the same gRNA name you set when running offtracker_candidates.py
|
137
|
+
# --exp/--control: add one or multiple patterns of file name in regular expressions
|
138
|
+
# If multiple samples meet the pattern, their signals will be averaged. Thus, only samples with the same condition should be included in a single analysis.
|
139
|
+
|
140
|
+
# This step will generate Offtracker_result_{outname}.csv
|
141
|
+
# Default FDR is 0.05, which can be changed by --fdr. This will empirically make the threshold of Track score around 2.
|
142
|
+
# Sites with Track score >=2, which is a empirical threshold, are output regardless of FDR.
|
143
|
+
# Intermediate files are saved in ./temp folder, which can be deleted.
|
144
|
+
# Keeping the intermediate files can make the analysis faster if involving previously analyzed samples (e.g. using the same control samples for different analyses)
|
145
|
+
```
|
146
|
+
|
147
|
+
## Off-target sequences visualization
|
148
|
+
|
149
|
+
```bash
|
150
|
+
# After get the Offtracker_result_{outname}.csv, you can visualize the off-target sites with their genomic sequence with the following command:
|
151
|
+
|
152
|
+
offtracker_plot.py --result Your_Offtracker_Result_CSV \
|
153
|
+
--sgrna 'GACCCCCTCCACCCCGCCTC' --pam 'NGG'
|
154
|
+
|
155
|
+
# The default output is a pdf file with Offtracker_result_{outname}.pdf
|
156
|
+
# Assigning a specific output file with another suffix can change the format. e.g., "--output Offtracker_plot.png" will generate a png file.
|
157
|
+
# The orange dash line indicates the empirical threshold of Track score = 2
|
158
|
+
# Empirically, the off-target sites with Track score < 2 are less likely to be real off-target sites.
|
159
|
+
```
|
160
|
+
|
161
|
+
|
162
|
+
## Note1, when not using hg38 or mm10
|
163
|
+
|
164
|
+
The default setting only includes chr1-chr22, chrX, chrY, and chrM. (only suitable for human and mouse) \
|
165
|
+
If you are using reference genomes without "chr" at the beginning, or want to analyze all chromosomes or other species, you can set "--ignore_chr" when running offtracker_config.py to skip chromosome filter.
|
166
|
+
|
167
|
+
Currently, this software is only ready-to-use for mm10 and hg38. For any other genome, e.g., hg19, please add a genome size file named "hg19.chrom.sizes" to .\offtracker\utility. Besides, add "--blacklist none" or "--blacklist Your_Blacklist" (e.g., ENCODE blacklist) when running offtracker_config.py, because we only include blacklists for mm10 and hg38.
|
168
|
+
|
169
|
+
## Note2
|
170
|
+
|
171
|
+
The FDRs in the Tracking-seq result do not reflect the real off-target probability.
|
172
|
+
It is strongly recommended to observe the "fw.scaled.bw" and "rv.scaled.bw" using genome browser like IGV to visually inspect each target location from the Tracking-seq result.
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
# Example Data
|
177
|
+
|
178
|
+
Here are example data that contains reads of chr6 from HEK293T cells edited with Cas9 + sgRNA VEGFA2 and wild type cells:
|
179
|
+
|
180
|
+
https://figshare.com/articles/dataset/WT_HEK239T_chr6/25956034
|
181
|
+
|
182
|
+
It takes about 5-10 minutes to run the mapping (offtracker_config.py & snakemake) of example data with -t 8 and --cores 16 (2 parallel tasks)
|
183
|
+
|
184
|
+
## Signal visualization
|
185
|
+
|
186
|
+
After mapping, there will be 4 .bw files in the output folder:
|
187
|
+
```bash
|
188
|
+
Cas9_VEGFA2_chr6.fw.scaled.bw
|
189
|
+
|
190
|
+
Cas9_VEGFA2_chr6.rv.scaled.bw
|
191
|
+
|
192
|
+
WT_chr6.fw.scaled.bw
|
193
|
+
|
194
|
+
WT_chr6.rv.scaled.bw
|
195
|
+
```
|
196
|
+
These files can be visualized in genome browser like IGV:
|
197
|
+
|
198
|
+

|
199
|
+
|
200
|
+
The signal (coverage) for each sample is normalized to 1e7/total_reads. As only reads mapping to chr6 were extracted in the example data, the signal range is much higher than that of the whole genome samples.
|
201
|
+
|
202
|
+
## Whole genome off-target analysis
|
203
|
+
|
204
|
+
For analyzing the signals (offtracker_analysis.py), it takes about 3-5 minutes and outputs a file named "Offtracker_result_{outname}.csv"
|
205
|
+
|
206
|
+
After that, you can visualize the off-target sites with their genomic sequence (offtracker_plot.py) and get an image like this:
|
207
|
+
|
208
|
+

|
209
|
+
|
210
|
+
# Citation
|
211
|
+
|
212
|
+
If you use Tracking-seq or OFF-TRACKER in your research, please cite the following paper:
|
213
|
+
|
214
|
+
Zhu, M., Xu, R., Yuan, J., Wang, J. et al. Tracking-seq reveals the heterogeneity of off-target effects in CRISPR–Cas9-mediated genome editing. Nat Biotechnol (2024). https://doi.org/10.1038/s41587-024-02307-y
|
215
|
+
|
216
|
+
The signal visualization of .bw file here was generated by the Integrative Genomics Viewer (IGV) software. The signal visualization in the Tracking-seq article above was generated by either IGV or pyGenomeTracks:
|
217
|
+
|
218
|
+
Robinson, J., Thorvaldsdóttir, H., Winckler, W. et al. Integrative genomics viewer. Nat Biotechnol 29, 24–26 (2011). https://doi.org/10.1038/nbt.1754
|
219
|
+
|
220
|
+
Lopez-Delisle L, Rabbani L, Wolff J, Bhardwaj V, Backofen R, Grüning B, Ramírez F, Manke T. pyGenomeTracks: reproducible plots for multivariate genomic data sets. Bioinformatics. 2020 Aug 3:btaa692. doi: 10.1093/bioinformatics/btaa692.
|
221
|
+
|
@@ -1,13 +1,23 @@
|
|
1
|
-
|
2
|
-
import matplotlib.patches as patches
|
1
|
+
|
3
2
|
import pandas as pd
|
4
3
|
import numpy as np
|
4
|
+
import matplotlib.pyplot as plt
|
5
|
+
import matplotlib.patches as patches
|
6
|
+
from matplotlib import rcParams
|
7
|
+
# 和用 plt.rcParams or matplotlib.rcParams 是一样的
|
8
|
+
dict_rc = {
|
9
|
+
'pdf.fonttype': 42,
|
10
|
+
'font.family': ['Arial']
|
11
|
+
}
|
12
|
+
rcParams.update(dict_rc)
|
13
|
+
|
14
|
+
# 2024.06.03. offtable 添加 threshold 分界线,默认为 None,常用的是 2
|
5
15
|
|
6
|
-
def offtable(offtargets, target_guide,
|
16
|
+
def offtable(offtargets, target_guide, length_pam = 3,
|
7
17
|
col_seq='best_target', col_score='track_score', col_mismatch='mismatch', col_loc='target_location',
|
8
18
|
title=None, font='Arial', font_size=9,
|
9
|
-
box_size_x=15, box_size_y=20, box_gap=1,
|
10
|
-
x_offset=15, y_offset=35, dpi=
|
19
|
+
box_size_x=15, box_size_y=20, box_gap=1, threshold=None,
|
20
|
+
x_offset=15, y_offset=35, dpi=300, savefig=None):
|
11
21
|
# Facecolor
|
12
22
|
color_dict = {
|
13
23
|
'A': 'lightgreen',
|
@@ -19,10 +29,15 @@ def offtable(offtargets, target_guide,
|
|
19
29
|
'-': 'orange'
|
20
30
|
}
|
21
31
|
|
32
|
+
|
33
|
+
|
22
34
|
# If offtargets is a DataFrame, convert to list of dictionaries
|
23
35
|
if isinstance(offtargets, pd.DataFrame):
|
36
|
+
if threshold is not None:
|
37
|
+
n_positive = sum(offtargets[col_score]>=threshold)
|
24
38
|
offtargets = offtargets.to_dict(orient='records')
|
25
39
|
|
40
|
+
|
26
41
|
# Configuration
|
27
42
|
# title=None
|
28
43
|
# font='Arial'
|
@@ -95,16 +110,30 @@ def offtable(offtargets, target_guide,
|
|
95
110
|
ax.text(x + box_size_x / 2, y + box_size_y / 2, "." if c == target_guide[i] else c, ha='center', va='center', family=font, fontsize=font_size, weight='bold')
|
96
111
|
|
97
112
|
# Annotations for score, mismatches, and location coordinates
|
98
|
-
|
113
|
+
# 2025.06.05. 如果有负数的,用红色显示
|
114
|
+
if seq[col_score]>0:
|
115
|
+
text_color = 'black'
|
116
|
+
else:
|
117
|
+
text_color = 'red'
|
118
|
+
ax.text(x_offset + (len(target_guide) + 2) * box_size_x, y + box_size_y / 2, round(seq[col_score],2), ha='center', va='center', family=font, fontsize=font_size, color=text_color)
|
99
119
|
#ax.text(x_offset + (len(target_guide) + 7) * box_size_x, y + box_size_y / 2, "Target" if seq[col_mismatch] == 0 else seq[col_mismatch], ha='center', va='center', family=font, fontsize=font_size, color='red' if seq[col_mismatch] == 0 else 'black')
|
100
|
-
ax.text(x_offset + (len(target_guide) + 4) * box_size_x, y + box_size_y / 2, seq[col_loc], ha='left', va='center', family=font, fontsize=font_size)
|
120
|
+
ax.text(x_offset + (len(target_guide) + 4) * box_size_x, y + box_size_y / 2, seq[col_loc], ha='left', va='center', family=font, fontsize=font_size, color=text_color)
|
101
121
|
|
122
|
+
|
102
123
|
# add a vertical line to indicate the PAM
|
103
|
-
x_line = x_offset + (len(target_guide) -
|
124
|
+
x_line = x_offset + (len(target_guide) - length_pam) * box_size_x
|
104
125
|
y_start = y_offset # + box_size_y / 2
|
105
126
|
y_end = y_start + (len(offtargets)+1) * (box_size_y + box_gap)
|
106
127
|
ax.vlines(x=x_line, ymin=y_start, ymax=y_end, color='indianred', linestyle='--')
|
107
128
|
|
129
|
+
# 2024.06.03. add a horizontal line to indicate the threshold
|
130
|
+
if threshold is not None:
|
131
|
+
thresh_x_start = x_offset
|
132
|
+
thresh_x_end = x_offset + len(target_guide) * box_size_x
|
133
|
+
thresh_y = y_offset + (n_positive+1) * (box_size_y + box_gap) - box_gap*0.5
|
134
|
+
ax.hlines(y=thresh_y, xmin=thresh_x_start, xmax=thresh_x_end, color='orange', linestyle='--')
|
135
|
+
|
136
|
+
|
108
137
|
# Styling and save
|
109
138
|
ax.set_xlim(0, width*1.1) # location 的文字太长了,所以要加长一点
|
110
139
|
ax.set_ylim(height, 0)
|