offtracker 2.10.11__zip → 2.11.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.11/offtracker.egg-info → offtracker-2.11.0}/PKG-INFO +1 -1
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker/X_offplot.py +15 -4
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker/_version.py +3 -2
- {offtracker-2.10.11 → offtracker-2.11.0/offtracker.egg-info}/PKG-INFO +1 -1
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker.egg-info/requires.txt +1 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/scripts/offtracker_candidates.py +40 -31
- {offtracker-2.10.11 → offtracker-2.11.0}/setup.py +1 -1
- {offtracker-2.10.11 → offtracker-2.11.0}/LICENSE.txt +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/MANIFEST.in +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/README.md +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker/X_offtracker.py +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker/X_sequence.py +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker/__init__.py +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker/snakefile/Snakefile_QC.smk +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker/snakefile/Snakefile_offtracker.smk +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker/utility/1.1_bed2fr.py +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker/utility/1.3_bdg_normalize_v4.0.py +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker/utility/bedGraphToBigWig +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker/utility/hg38.chrom.sizes +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker/utility/mm10.chrom.sizes +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker/utility/offtracker_blacklist_hg38.merged.bed +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker/utility/offtracker_blacklist_mm10.merged.bed +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker.egg-info/SOURCES.txt +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker.egg-info/dependency_links.txt +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/offtracker.egg-info/top_level.txt +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/scripts/offtracker_analysis.py +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/scripts/offtracker_config.py +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/scripts/offtracker_init.py +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/scripts/offtracker_plot.py +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/scripts/offtracker_qc.py +0 -0
- {offtracker-2.10.11 → offtracker-2.11.0}/setup.cfg +0 -0
|
@@ -5,10 +5,21 @@ import matplotlib.pyplot as plt
|
|
|
5
5
|
import matplotlib.patches as patches
|
|
6
6
|
from matplotlib import rcParams
|
|
7
7
|
# 和用 plt.rcParams or matplotlib.rcParams 是一样的
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import sys
|
|
9
|
+
if sys.platform[:3] == 'win':
|
|
10
|
+
dict_rc = {
|
|
11
|
+
'pdf.fonttype': 42,
|
|
12
|
+
'font.family': ['Arial']
|
|
13
|
+
}
|
|
14
|
+
elif sys.platform[:5] == 'linux':
|
|
15
|
+
dict_rc = {
|
|
16
|
+
'pdf.fonttype': 42,
|
|
17
|
+
'font.family': ['Arial']
|
|
18
|
+
}
|
|
19
|
+
else:
|
|
20
|
+
dict_rc = {
|
|
21
|
+
'pdf.fonttype': 42,
|
|
22
|
+
}
|
|
12
23
|
rcParams.update(dict_rc)
|
|
13
24
|
|
|
14
25
|
# 2024.06.03. offtable 添加 threshold 分界线,默认为 None,常用的是 2
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
__version__ = "2.
|
|
1
|
+
__version__ = "2.11.0"
|
|
2
2
|
# 2023.08.11. v1.1.0 adding a option for not normalizing the bw file
|
|
3
3
|
# 2023.10.26. v1.9.0 prerelease for v2.0
|
|
4
4
|
# 2023.10.27. v2.0.0 大更新,还没微调
|
|
@@ -37,4 +37,5 @@ __version__ = "2.10.11"
|
|
|
37
37
|
# 2025.06.27. v2.10.8 将 chmod 放在了 setup.py 里
|
|
38
38
|
# 2025.06.28. v2.10.9 现在 pip 都是从 wheel 安装,不再运行 setup.py,所以增加一个 offtracker_init.py
|
|
39
39
|
# 2025.06.28. v2.10.10 直接塞 script 里试试
|
|
40
|
-
# 2025.06.28. v2.10.11 回滚到2.10.9外加修正
|
|
40
|
+
# 2025.06.28. v2.10.11 回滚到2.10.9外加修正
|
|
41
|
+
# 2025.07.02. v2.11.0 基于 blast 的缺陷更新 candidates
|
|
@@ -20,6 +20,7 @@ script_folder= os.path.join(script_dir, 'utility')
|
|
|
20
20
|
|
|
21
21
|
import argparse
|
|
22
22
|
import pandas as pd
|
|
23
|
+
import polars as pl
|
|
23
24
|
import pybedtools
|
|
24
25
|
import multiprocessing as mp
|
|
25
26
|
from Bio.Blast.Applications import NcbiblastnCommandline
|
|
@@ -89,18 +90,20 @@ def main():
|
|
|
89
90
|
#########
|
|
90
91
|
# BLAST #
|
|
91
92
|
#########
|
|
93
|
+
# 2025.07.02 基于 blast 的缺陷更新
|
|
94
|
+
|
|
92
95
|
if os.path.isfile(dir_sgRNA_blast):
|
|
93
96
|
print(f'{dir_sgRNA_blast} exists, skipped.')
|
|
94
97
|
else:
|
|
95
98
|
if quick_mode:
|
|
96
99
|
print('Using quick mode for BLAST')
|
|
97
100
|
blastx_cline = NcbiblastnCommandline(query=dir_sgRNA_fasta, task='blastn-short',out=dir_sgRNA_blast,
|
|
98
|
-
db=blast_db, evalue=
|
|
99
|
-
gapopen=4, gapextend=2, reward=2, word_size=
|
|
101
|
+
db=blast_db, evalue=100000,outfmt=6, num_threads=n_threads,
|
|
102
|
+
gapopen=4, gapextend=2, reward=2, word_size=6, dust='no', soft_masking=False)
|
|
100
103
|
else:
|
|
101
104
|
blastx_cline = NcbiblastnCommandline(query=dir_sgRNA_fasta, task='blastn-short',out=dir_sgRNA_blast,
|
|
102
|
-
db=blast_db, evalue=
|
|
103
|
-
gapopen=4, gapextend=2, reward=2, word_size=
|
|
105
|
+
db=blast_db, evalue=100000,outfmt=6, num_threads=n_threads,
|
|
106
|
+
gapopen=4, gapextend=2, reward=2, word_size=5, dust='no', soft_masking=False)
|
|
104
107
|
print(f'BLAST for candidate off-target sites of {sgRNA_name}.')
|
|
105
108
|
blastx_cline()
|
|
106
109
|
print(f'BLAST finished.')
|
|
@@ -109,33 +112,39 @@ def main():
|
|
|
109
112
|
# Output bed #
|
|
110
113
|
##############
|
|
111
114
|
|
|
112
|
-
|
|
115
|
+
# 2025.07.02 基于 blast 的缺陷更新
|
|
116
|
+
len_sgRNA = len(sgRNA_seq)
|
|
117
|
+
blast_regions = pl.read_csv(dir_sgRNA_blast, separator='\t',has_header=False)
|
|
113
118
|
blast_regions.columns = ['query acc.','chr','% identity','alignment length','mismatches','gap opens','q. start','q. end','st','ed','evalue','bit score']
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
blast_regions_r =
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
blast_regions =
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
blast_regions
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
#
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
blast_regions = blast_regions
|
|
133
|
-
blast_regions = blast_regions.
|
|
134
|
-
|
|
135
|
-
|
|
119
|
+
|
|
120
|
+
# reverse strand
|
|
121
|
+
blast_regions = blast_regions.with_columns((pl.col('st') > pl.col('ed')).cast(pl.Int8).alias('reverse'))
|
|
122
|
+
blast_regions_f = blast_regions.filter(pl.col('reverse') == 0)
|
|
123
|
+
blast_regions_r = blast_regions.filter(pl.col('reverse') == 1)
|
|
124
|
+
blast_regions_r = blast_regions_r.with_columns([
|
|
125
|
+
pl.col('ed').alias('st'),
|
|
126
|
+
pl.col('st').alias('ed')
|
|
127
|
+
])
|
|
128
|
+
blast_regions = pl.concat([blast_regions_f, blast_regions_r])
|
|
129
|
+
|
|
130
|
+
# add location
|
|
131
|
+
blast_regions = blast_regions.with_column(
|
|
132
|
+
(pl.col('chr') + ':' + pl.col('st').cast(str) + '-' + pl.col('ed').cast(str)).alias('location')
|
|
133
|
+
)
|
|
134
|
+
# filter, sort, dedup
|
|
135
|
+
blast_regions = blast_regions.with_columns(mis=(len_sgRNA - 1 - pl.col('q. end')+pl.col('q. start')+pl.col('mismatches')+pl.col('gap opens')).cast(pl.Int8))
|
|
136
|
+
blast_regions = blast_regions.with_columns(mis2=(len_sgRNA - pl.col('alignment length')*pl.col('% identity')/100).round().cast(pl.Int8))
|
|
137
|
+
blast_regions = blast_regions.filter((pl.col('mis')<8)|(pl.col('mis2')<8))
|
|
138
|
+
blast_regions = blast_regions.sort('mis').unique('location',keep='first', maintain_order=True)
|
|
139
|
+
blast_regions = blast_regions.select([
|
|
140
|
+
'chr', 'st', 'ed', 'query acc.', '% identity', 'alignment length', 'mismatches',
|
|
141
|
+
'gap opens', 'q. start', 'q. end', 'evalue', 'bit score', 'reverse', 'location', 'mis', 'mis2'
|
|
142
|
+
])
|
|
143
|
+
|
|
136
144
|
# 输出 bed 用于后续 alignment score 计算
|
|
137
|
-
blast_regions_bed = blast_regions[
|
|
138
|
-
|
|
145
|
+
blast_regions_bed = blast_regions.select(['chr', 'st', 'ed'])
|
|
146
|
+
blast_regions_bed.write_csv(dir_sgRNA_bed, separator='\t', has_header=False)
|
|
147
|
+
|
|
139
148
|
# 对 bed 进行排序但不合并
|
|
140
149
|
a = pybedtools.BedTool(dir_sgRNA_bed)
|
|
141
150
|
a.sort(g=dir_chrom_sizes).saveas( dir_sgRNA_bed )
|
|
@@ -155,10 +164,10 @@ def main():
|
|
|
155
164
|
bed_short = xseq.X_readbed(dir_sgRNA_bed)
|
|
156
165
|
bed_short = bed_short[bed_short['chr'].isin(common_chr)].copy()
|
|
157
166
|
bed_short['midpoint'] = ((bed_short['st'] + bed_short['ed'])/2).astype(int)
|
|
158
|
-
bed_short['st'] = bed_short['midpoint'] - half_width
|
|
167
|
+
bed_short['st'] = bed_short['midpoint'] - half_width
|
|
159
168
|
bed_short['ed'] = bed_short['midpoint'] + half_width
|
|
160
169
|
bed_short.loc[bed_short['st']<0,'st']=0
|
|
161
|
-
bed_short = bed_short.drop_duplicates()
|
|
170
|
+
bed_short = bed_short.drop_duplicates()
|
|
162
171
|
|
|
163
172
|
#########
|
|
164
173
|
# 根据 bed_f 位点 ed 前后 half_width 取基因组序列
|
|
@@ -26,7 +26,7 @@ with open(os.path.join(here, package_folder, '_version.py'),'r',encoding='utf-8'
|
|
|
26
26
|
|
|
27
27
|
# requirements
|
|
28
28
|
REQUIRED = [
|
|
29
|
-
'pandas', 'numpy', 'biopython<=1.85', 'pybedtools', 'pyyaml',
|
|
29
|
+
'pandas', 'polars>=1.19.0', 'numpy', 'biopython<=1.85', 'pybedtools', 'pyyaml',
|
|
30
30
|
]
|
|
31
31
|
## pybedtools may be not supported in Windows
|
|
32
32
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{offtracker-2.10.11 → offtracker-2.11.0}/offtracker/utility/offtracker_blacklist_hg38.merged.bed
RENAMED
|
File without changes
|
{offtracker-2.10.11 → offtracker-2.11.0}/offtracker/utility/offtracker_blacklist_mm10.merged.bed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|