offtracker 2.7.10__zip → 2.10.1__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.
Files changed (33) hide show
  1. {offtracker-2.7.10 → offtracker-2.10.1}/PKG-INFO +64 -20
  2. offtracker-2.7.10/offtracker.egg-info/PKG-INFO → offtracker-2.10.1/README.md +221 -189
  3. {offtracker-2.7.10 → offtracker-2.10.1}/offtracker/X_offplot.py +13 -2
  4. {offtracker-2.7.10 → offtracker-2.10.1}/offtracker/X_sequence.py +113 -7
  5. {offtracker-2.7.10 → offtracker-2.10.1}/offtracker/_version.py +9 -2
  6. offtracker-2.10.1/offtracker/snakefile/Snakefile_QC.smk +66 -0
  7. offtracker-2.10.1/offtracker/snakefile/Snakefile_offtracker.smk +249 -0
  8. offtracker-2.7.10/offtracker/mapping/1.1_bed2fr_v4.5.py → offtracker-2.10.1/offtracker/utility/1.1_bed2fr.py +6 -4
  9. offtracker-2.7.10/README.md → offtracker-2.10.1/offtracker.egg-info/PKG-INFO +233 -177
  10. offtracker-2.10.1/offtracker.egg-info/SOURCES.txt +28 -0
  11. {offtracker-2.7.10 → offtracker-2.10.1}/scripts/offtracker_analysis.py +10 -3
  12. offtracker-2.10.1/scripts/offtracker_candidates.py +318 -0
  13. {offtracker-2.7.10 → offtracker-2.10.1}/scripts/offtracker_config.py +28 -44
  14. offtracker-2.10.1/scripts/offtracker_qc.py +62 -0
  15. {offtracker-2.7.10 → offtracker-2.10.1}/setup.py +5 -4
  16. offtracker-2.7.10/offtracker/mapping/Snakefile_offtracker +0 -245
  17. offtracker-2.7.10/offtracker.egg-info/SOURCES.txt +0 -26
  18. offtracker-2.7.10/scripts/offtracker_candidates.py +0 -307
  19. {offtracker-2.7.10 → offtracker-2.10.1}/LICENSE.txt +0 -0
  20. {offtracker-2.7.10 → offtracker-2.10.1}/MANIFEST.in +0 -0
  21. {offtracker-2.7.10 → offtracker-2.10.1}/offtracker/X_offtracker.py +0 -0
  22. {offtracker-2.7.10 → offtracker-2.10.1}/offtracker/__init__.py +0 -0
  23. {offtracker-2.7.10/offtracker/mapping → offtracker-2.10.1/offtracker/utility}/1.3_bdg_normalize_v4.0.py +0 -0
  24. {offtracker-2.7.10/offtracker/mapping → offtracker-2.10.1/offtracker/utility}/bedGraphToBigWig +0 -0
  25. {offtracker-2.7.10/offtracker/mapping → offtracker-2.10.1/offtracker/utility}/hg38.chrom.sizes +0 -0
  26. {offtracker-2.7.10/offtracker/mapping → offtracker-2.10.1/offtracker/utility}/mm10.chrom.sizes +0 -0
  27. {offtracker-2.7.10/offtracker/mapping → offtracker-2.10.1/offtracker/utility}/offtracker_blacklist_hg38.merged.bed +0 -0
  28. {offtracker-2.7.10/offtracker/mapping → offtracker-2.10.1/offtracker/utility}/offtracker_blacklist_mm10.merged.bed +0 -0
  29. {offtracker-2.7.10 → offtracker-2.10.1}/offtracker.egg-info/dependency_links.txt +0 -0
  30. {offtracker-2.7.10 → offtracker-2.10.1}/offtracker.egg-info/requires.txt +0 -0
  31. {offtracker-2.7.10 → offtracker-2.10.1}/offtracker.egg-info/top_level.txt +0 -0
  32. {offtracker-2.7.10 → offtracker-2.10.1}/scripts/offtracker_plot.py +0 -0
  33. {offtracker-2.7.10 → offtracker-2.10.1}/setup.cfg +0 -0
@@ -1,18 +1,18 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: offtracker
3
- Version: 2.7.10
3
+ Version: 2.10.1
4
4
  Summary: Tracking-seq data analysis
5
5
  Home-page: https://github.com/Lan-lab/offtracker
6
6
  Author: Runda Xu
7
- Author-email: runda.xu@foxmail.com
7
+ Author-email: xrd18@tsinghua.org.cn
8
8
  Requires-Python: >=3.6.0
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE.txt
11
11
 
12
12
 
13
- # OFF-TRACKER
13
+ # Offtracker
14
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).
15
+ 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).
16
16
 
17
17
  ## System requirements
18
18
 
@@ -22,9 +22,10 @@ OFF-TRACKER is an end to end pipeline of Tracking-seq data analysis for detectin
22
22
  ## Dependency
23
23
 
24
24
  ```bash
25
- # We recommend creating a new enviroment using mamba/conda to avoid compatibility problems
25
+ # We recommend creating a new environment using mamba/conda to avoid compatibility problems
26
26
  # If you don't use mamba, just replace the code with conda
27
- mamba create -n offtracker -c bioconda blast snakemake pybedtools
27
+ # Windows systems may not be compatible with pybedtools.
28
+ mamba create -n offtracker -c bioconda blast snakemake pybedtools chromap
28
29
  ```
29
30
 
30
31
 
@@ -58,32 +59,69 @@ chromap -i -r /Your_Path_To_Reference/hg38_genome.fa \
58
59
  -o /Your_Path_To_Reference/hg38_genome.chromap.index
59
60
 
60
61
  # Generate candidate regions by sgRNA sequence (need once for each genome and sgRNA)
61
- # --name: the name of the sgRNA, which will be used in the following analysis
62
+ # --name: a user-defined name of the sgRNA, which will be used in the following analysis.
62
63
  offtracker_candidates.py -t 8 -g hg38 \
63
64
  -r /Your_Path_To_Reference/hg38_genome.fa \
64
65
  -b /Your_Path_To_Reference/hg38_genome.blastdb \
65
66
  --name 'VEGFA2' --sgrna 'GACCCCCTCCACCCCGCCTC' --pam 'NGG' \
66
- -o /Your_Path_To_Candidates
67
+ -o /Your_Path_To_Candidates_Folder
67
68
 
68
69
  ```
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
+
70
105
  ## Strand-specific mapping of Tracking-seq data
71
106
 
72
107
  ```bash
73
- # Generate snakemake config file
74
- # --subfolder: If different samples are in seperate folders, set this to 1
75
- # if -o is not set, the output will be in the same folder as the fastq files
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
76
111
  offtracker_config.py -t 8 -g hg38 --blacklist hg38 \
77
112
  -r /Your_Path_To_Reference/hg38_genome.fa \
78
113
  -i /Your_Path_To_Reference/hg38_genome.chromap.index \
79
- -f /Your_Path_To_Fastq \
114
+ -f /Your_Path_To_Trimmed_Data \
80
115
  -o /Your_Path_To_Output \
81
116
  --subfolder 0
82
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
+
83
121
  # Run the snakemake program
84
122
  cd /Your_Path_To_Fastq
85
123
  snakemake -np # dry run
86
- nohup snakemake --cores 16 1>snakemake.log 2>snakemake.err &
124
+ nohup snakemake --cores 16 1>sm_mapping.log 2>sm_mapping.err &
87
125
 
88
126
  ## about cores
89
127
  # --cores of snakemake must be larger than -t of offtracker_config.py
@@ -98,7 +136,7 @@ nohup snakemake --cores 16 1>snakemake.log 2>snakemake.err &
98
136
  ## Analyzing the genome-wide off-target sites
99
137
 
100
138
  ```bash
101
- # In this part, multiple samples in the same condition can be analyzed in a single run by pattern recogonization of sample names
139
+ # In this part, multiple samples in the same condition can be analyzed in a single run by pattern recognition of sample names
102
140
 
103
141
  offtracker_analysis.py -g hg38 --name "VEGFA2" \
104
142
  --exp 'Cas9_VEGFA2' \
@@ -127,19 +165,18 @@ offtracker_plot.py --result Your_Offtracker_Result_CSV \
127
165
  --sgrna 'GACCCCCTCCACCCCGCCTC' --pam 'NGG'
128
166
 
129
167
  # The default output is a pdf file with Offtracker_result_{outname}.pdf
130
- # Change the suffix of the output file to change the format (e.g.: .png)
168
+ # Assigning a specific output file with another suffix can change the format. e.g., "--output Offtracker_plot.png" will generate a png file.
131
169
  # The orange dash line indicates the empirical threshold of Track score = 2
132
170
  # Empirically, the off-target sites with Track score < 2 are less likely to be real off-target sites.
133
171
  ```
134
172
 
135
173
 
136
- ## Note1
174
+ ## Note1, when not using hg38 or mm10
137
175
 
138
- The default setting only includes chr1-chr22, chrX, chrY, and chrM. Please make sure the reference genome contains "chr" at the beginning.
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.
139
178
 
140
- Currently, this software is only ready-to-use for mm10 and hg38. For any other genome, e.g., hg19, please add genome size file named "hg19.chrom.sizes" to .\offtracker\mapping and instal manually. Besides, add "--blacklist none" or "--blacklist Your_Blacklist" (e.g., ENCODE blacklist) when running offtracker_config.py, because we only provide blacklists for mm10 and hg38.
141
-
142
- If you have a requirement for species other than human/mouse, please post an issue.
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.
143
180
 
144
181
  ## Note2
145
182
 
@@ -172,6 +209,7 @@ These files can be visualized in genome browser like IGV:
172
209
 
173
210
  ![signal](https://github.com/Lan-lab/offtracker/blob/main/example_output/signals_example.png?raw=true)
174
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.
175
213
 
176
214
  ## Whole genome off-target analysis
177
215
 
@@ -183,7 +221,13 @@ After that, you can visualize the off-target sites with their genomic sequence (
183
221
 
184
222
  # Citation
185
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
186
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:
187
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
188
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.
189
233
 
@@ -1,189 +1,221 @@
1
- Metadata-Version: 2.1
2
- Name: offtracker
3
- Version: 2.7.10
4
- Summary: Tracking-seq data analysis
5
- Home-page: https://github.com/Lan-lab/offtracker
6
- Author: Runda Xu
7
- Author-email: runda.xu@foxmail.com
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 enviroment using mamba/conda to avoid compatibility problems
26
- # If you don't use mamba, just replace the code with conda
27
- mamba create -n offtracker -c bioconda blast snakemake pybedtools
28
- ```
29
-
30
-
31
- ## Installation
32
-
33
- ```bash
34
- # Activate the environment
35
- conda activate offtracker
36
-
37
- # Direct installation with pip
38
- pip install offtracker
39
-
40
- # (Alternative) Download the offtracker from github
41
- git clone https://github.com/Lan-lab/offtracker.git
42
- cd offtracker
43
- pip install .
44
- ```
45
-
46
-
47
- ## Before analyzing samples
48
-
49
- ```bash
50
- # Build blast index (only need once for each genome)
51
- makeblastdb -input_type fasta -title hg38 -dbtype nucl -parse_seqids \
52
- -in /Your_Path_To_Reference/hg38_genome.fa \
53
- -out /Your_Path_To_Reference/hg38_genome.blastdb \
54
- -logfile /Your_Path_To_Reference/hg38_genome.blastdb.log
55
-
56
- # Build chromap index (only need once for each genome)
57
- chromap -i -r /Your_Path_To_Reference/hg38_genome.fa \
58
- -o /Your_Path_To_Reference/hg38_genome.chromap.index
59
-
60
- # Generate candidate regions by sgRNA sequence (need once for each genome and sgRNA)
61
- # --name: the name of the sgRNA, which will be used in the following analysis
62
- offtracker_candidates.py -t 8 -g hg38 \
63
- -r /Your_Path_To_Reference/hg38_genome.fa \
64
- -b /Your_Path_To_Reference/hg38_genome.blastdb \
65
- --name 'VEGFA2' --sgrna 'GACCCCCTCCACCCCGCCTC' --pam 'NGG' \
66
- -o /Your_Path_To_Candidates
67
-
68
- ```
69
-
70
- ## Strand-specific mapping of Tracking-seq data
71
-
72
- ```bash
73
- # Generate snakemake config file
74
- # --subfolder: If different samples are in seperate folders, set this to 1
75
- # if -o is not set, the output will be in the same folder as the fastq files
76
- offtracker_config.py -t 8 -g hg38 --blacklist hg38 \
77
- -r /Your_Path_To_Reference/hg38_genome.fa \
78
- -i /Your_Path_To_Reference/hg38_genome.chromap.index \
79
- -f /Your_Path_To_Fastq \
80
- -o /Your_Path_To_Output \
81
- --subfolder 0
82
-
83
- # Run the snakemake program
84
- cd /Your_Path_To_Fastq
85
- snakemake -np # dry run
86
- nohup snakemake --cores 16 1>snakemake.log 2>snakemake.err &
87
-
88
- ## about cores
89
- # --cores of snakemake must be larger than -t of offtracker_config.py
90
- # parallel number = cores/t
91
-
92
- ## about output
93
- # This part will generate "*.fw.scaled.bw" and ".rv.scaled.bw" for IGV visualization
94
- # "*.fw.bed" and "*.rv.bed" are used in the next part.
95
- ```
96
-
97
-
98
- ## Analyzing the genome-wide off-target sites
99
-
100
- ```bash
101
- # In this part, multiple samples in the same condition can be analyzed in a single run by pattern recogonization of sample names
102
-
103
- offtracker_analysis.py -g hg38 --name "VEGFA2" \
104
- --exp 'Cas9_VEGFA2' \
105
- --control 'WT' \
106
- --outname 'Cas9_VEGFA_293' \
107
- -f /Your_Path_To_Output \
108
- --seqfolder /Your_Path_To_Candidates
109
-
110
- # --name: the same gRNA name you set when running offtracker_candidates.py
111
- # --exp/--control: add one or multiple patterns of file name in regular expressions
112
- # 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.
113
-
114
- # This step will generate Offtracker_result_{outname}.csv
115
- # Default FDR is 0.05, which can be changed by --fdr. This will empirically make the threshold of Track score around 2.
116
- # Sites with Track score >=2, which is a empirical threshold, are output regardless of FDR.
117
- # Intermediate files are saved in ./temp folder, which can be deleted.
118
- # Keeping the intermediate files can make the analysis faster if involving previously analyzed samples (e.g. using the same control samples for different analyses)
119
- ```
120
-
121
- ## Off-target sequences visualization
122
-
123
- ```bash
124
- # After get the Offtracker_result_{outname}.csv, you can visualize the off-target sites with their genomic sequence with the following command:
125
-
126
- offtracker_plot.py --result Your_Offtracker_Result_CSV \
127
- --sgrna 'GACCCCCTCCACCCCGCCTC' --pam 'NGG'
128
-
129
- # The default output is a pdf file with Offtracker_result_{outname}.pdf
130
- # Change the suffix of the output file to change the format (e.g.: .png)
131
- # The orange dash line indicates the empirical threshold of Track score = 2
132
- # Empirically, the off-target sites with Track score < 2 are less likely to be real off-target sites.
133
- ```
134
-
135
-
136
- ## Note1
137
-
138
- The default setting only includes chr1-chr22, chrX, chrY, and chrM. Please make sure the reference genome contains "chr" at the beginning.
139
-
140
- Currently, this software is only ready-to-use for mm10 and hg38. For any other genome, e.g., hg19, please add genome size file named "hg19.chrom.sizes" to .\offtracker\mapping and instal manually. Besides, add "--blacklist none" or "--blacklist Your_Blacklist" (e.g., ENCODE blacklist) when running offtracker_config.py, because we only provide blacklists for mm10 and hg38.
141
-
142
- If you have a requirement for species other than human/mouse, please post an issue.
143
-
144
- ## Note2
145
-
146
- The FDRs in the Tracking-seq result do not reflect the real off-target probability.
147
- 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.
148
-
149
-
150
-
151
- # Example Data
152
-
153
- Here are example data that contains reads of chr6 from HEK293T cells edited with Cas9 + sgRNA VEGFA2 and wild type cells:
154
-
155
- https://figshare.com/articles/dataset/WT_HEK239T_chr6/25956034
156
-
157
- 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)
158
-
159
- ## Signal visualization
160
-
161
- After mapping, there will be 4 .bw files in the output folder:
162
- ```bash
163
- Cas9_VEGFA2_chr6.fw.scaled.bw
164
-
165
- Cas9_VEGFA2_chr6.rv.scaled.bw
166
-
167
- WT_chr6.fw.scaled.bw
168
-
169
- WT_chr6.rv.scaled.bw
170
- ```
171
- These files can be visualized in genome browser like IGV:
172
-
173
- ![signal](https://github.com/Lan-lab/offtracker/blob/main/example_output/signals_example.png?raw=true)
174
-
175
-
176
- ## Whole genome off-target analysis
177
-
178
- For analyzing the signals (offtracker_analysis.py), it takes about 3-5 minutes and outputs a file named "Offtracker_result_{outname}.csv"
179
-
180
- After that, you can visualize the off-target sites with their genomic sequence (offtracker_plot.py) and get an image like this:
181
-
182
- ![offtarget](https://github.com/Lan-lab/offtracker/blob/main/example_output/sequences_example.png?raw=true)
183
-
184
- # Citation
185
-
186
-
187
-
188
-
189
-
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
+ ![signal](https://github.com/Lan-lab/offtracker/blob/main/example_output/signals_example.png?raw=true)
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
+ ![offtarget](https://github.com/Lan-lab/offtracker/blob/main/example_output/sequences_example.png?raw=true)
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
+
@@ -12,6 +12,7 @@ dict_rc = {
12
12
  rcParams.update(dict_rc)
13
13
 
14
14
  # 2024.06.03. offtable 添加 threshold 分界线,默认为 None,常用的是 2
15
+
15
16
  def offtable(offtargets, target_guide, length_pam = 3,
16
17
  col_seq='best_target', col_score='track_score', col_mismatch='mismatch', col_loc='target_location',
17
18
  title=None, font='Arial', font_size=9,
@@ -28,12 +29,15 @@ def offtable(offtargets, target_guide, length_pam = 3,
28
29
  '-': 'orange'
29
30
  }
30
31
 
32
+
33
+
31
34
  # If offtargets is a DataFrame, convert to list of dictionaries
32
35
  if isinstance(offtargets, pd.DataFrame):
33
36
  if threshold is not None:
34
37
  n_positive = sum(offtargets[col_score]>=threshold)
35
38
  offtargets = offtargets.to_dict(orient='records')
36
39
 
40
+
37
41
  # Configuration
38
42
  # title=None
39
43
  # font='Arial'
@@ -106,10 +110,16 @@ def offtable(offtargets, target_guide, length_pam = 3,
106
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')
107
111
 
108
112
  # Annotations for score, mismatches, and location coordinates
109
- 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)
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)
110
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')
111
- 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)
112
121
 
122
+
113
123
  # add a vertical line to indicate the PAM
114
124
  x_line = x_offset + (len(target_guide) - length_pam) * box_size_x
115
125
  y_start = y_offset # + box_size_y / 2
@@ -123,6 +133,7 @@ def offtable(offtargets, target_guide, length_pam = 3,
123
133
  thresh_y = y_offset + (n_positive+1) * (box_size_y + box_gap) - box_gap*0.5
124
134
  ax.hlines(y=thresh_y, xmin=thresh_x_start, xmax=thresh_x_end, color='orange', linestyle='--')
125
135
 
136
+
126
137
  # Styling and save
127
138
  ax.set_xlim(0, width*1.1) # location 的文字太长了,所以要加长一点
128
139
  ax.set_ylim(height, 0)