trackplot 0.5.5__tar.gz → 0.5.7__tar.gz
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.
- {trackplot-0.5.5/trackplot.egg-info → trackplot-0.5.7}/PKG-INFO +2 -2
- {trackplot-0.5.5 → trackplot-0.5.7}/pyproject.toml +2 -2
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/base/ReadDepth.py +70 -63
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/cli.py +4 -2
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/file/Bam.py +13 -9
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/file/Junction.py +0 -1
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/plot.py +5 -2
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/plot_func.py +34 -57
- {trackplot-0.5.5 → trackplot-0.5.7/trackplot.egg-info}/PKG-INFO +2 -2
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot.egg-info/SOURCES.txt +8 -28
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot.egg-info/requires.txt +1 -1
- trackplot-0.5.7/trackplot.egg-info/top_level.txt +2 -0
- trackplot-0.5.7/ui/assets/Home-DZ_TnNqV.js +1 -0
- trackplot-0.5.7/ui/assets/Plot-C4RNyMVn.css +1 -0
- trackplot-0.5.7/ui/assets/Plot-Ch3Psf3q.js +17 -0
- trackplot-0.5.7/ui/assets/el-divider-C8ttpjuy.css +1 -0
- trackplot-0.5.7/ui/assets/el-divider-DnCOJT55.js +1 -0
- trackplot-0.5.7/ui/assets/index-DRYYJBwu.js +30 -0
- trackplot-0.5.7/ui/assets/index-p5klR3EI.css +1 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/index.html +2 -2
- trackplot-0.5.5/trackplot.egg-info/top_level.txt +0 -3
- trackplot-0.5.5/trackplot_issue/OA-452-DC.bam +0 -0
- trackplot-0.5.5/trackplot_issue/OA-452-DC.bam.bai +0 -0
- trackplot-0.5.5/trackplot_issue/OA-476-DC.bam +0 -0
- trackplot-0.5.5/trackplot_issue/OA-476-DC.bam.bai +0 -0
- trackplot-0.5.5/trackplot_issue/OA-479-DC.bam +0 -0
- trackplot-0.5.5/trackplot_issue/OA-479-DC.bam.bai +0 -0
- trackplot-0.5.5/trackplot_issue/OA-488-DC.bam +0 -0
- trackplot-0.5.5/trackplot_issue/OA-488-DC.bam.bai +0 -0
- trackplot-0.5.5/trackplot_issue/OA-500-DC.bam +0 -0
- trackplot-0.5.5/trackplot_issue/OA-500-DC.bam.bai +0 -0
- trackplot-0.5.5/trackplot_issue/OA-503-DC.bam +0 -0
- trackplot-0.5.5/trackplot_issue/OA-503-DC.bam.bai +0 -0
- trackplot-0.5.5/trackplot_issue/OA-506-DC.bam +0 -0
- trackplot-0.5.5/trackplot_issue/OA-506-DC.bam.bai +0 -0
- trackplot-0.5.5/trackplot_issue/OA-514-DC.bam +0 -0
- trackplot-0.5.5/trackplot_issue/OA-514-DC.bam.bai +0 -0
- trackplot-0.5.5/trackplot_issue/OA-515-DC.bam +0 -0
- trackplot-0.5.5/trackplot_issue/OA-515-DC.bam.bai +0 -0
- trackplot-0.5.5/trackplot_issue/OA-99-DC.bam +0 -0
- trackplot-0.5.5/trackplot_issue/OA-99-DC.bam.bai +0 -0
- trackplot-0.5.5/trackplot_issue/run_trackplot.sh +0 -42
- trackplot-0.5.5/trackplot_issue/samples.bam.tsv +0 -10
- trackplot-0.5.5/trackplot_issue/test.v051.pdf +0 -0
- trackplot-0.5.5/trackplot_issue/test.v053.included_junctions.log +0 -355
- trackplot-0.5.5/trackplot_issue/test.v053.included_junctions.pdf +0 -0
- trackplot-0.5.5/trackplot_issue/test.v053.included_junctions.png +0 -0
- trackplot-0.5.5/trackplot_issue/test.v053.pdf +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/LICENSE +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/README.md +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/setup.cfg +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/__init__.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/anno/AxLabel.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/anno/__init__.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/anno/theme.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/base/CoordinateMap.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/base/GenomicLoci.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/base/Junction.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/base/Protein.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/base/Readder.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/base/Stroke.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/base/Transcript.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/base/__init__.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/base/pyUniprot.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/conf/DomainSetting.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/conf/__init__.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/conf/config.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/conf/drawing.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/conf/ui.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/file/ATAC.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/file/Annotation.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/file/BedGraph.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/file/Bigwig.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/file/Depth.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/file/Fasta.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/file/File.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/file/HiCMatrixTrack.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/file/Motif.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/file/ReadSegments.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/file/__init__.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/plot_tests.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot/server.py +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/trackplot.egg-info/dependency_links.txt +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Home-7GzAh8lS.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Home-BV58jH3t.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Home-CDW3Zwoa.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Home-DOO13BH7.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Home-QmeAKOl4.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Home-RdVPWns6.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Home-jSR0MsHI.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Home-zRV7yePL.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Plot-BALbchCV.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Plot-BmqHZ4QE.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Plot-BrjU8Kwg.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Plot-Bvyo6ju9.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Plot-COvGnprQ.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Plot-CTM-EDrj.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Plot-Cnt8iJB8.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Plot-Cyj_LlDt.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Plot-DiuFnwNK.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Plot-DpL7z7tp.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Plot-hvkDteAn.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/Plot-rbQz1TOM.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/el-divider-BHm65SRq.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/el-divider-BVZhQIwQ.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/el-divider-Brt4-Qvr.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/el-divider-BuEUMHwE.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/el-divider-Cwxg0Ado.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/el-divider-DcvrsrBa.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/el-divider-IbBQ8ZK2.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/el-divider-SYT5K-ds.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/el-divider-VYjL3C7L.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/el-divider-eEJXnQD5.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/el-divider-i9JMIXVR.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/el-divider-u9f0bZWY.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/index-4hxJ_zbq.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/index-C4Mi9Kmf.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/index-CETGMNio.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/index-CWfdj0DH.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/index-Cexhr_fn.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/index-CrzyEb9s.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/index-D_Cw0sbX.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/index-Dd6Bavnk.js +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/index-DgEIiwRJ.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/index-O8P0XkxB.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/index-Sq2gI4sE.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/assets/index-ns9n7-F7.css +0 -0
- {trackplot-0.5.5 → trackplot-0.5.7}/ui/vite.svg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trackplot
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.7
|
|
4
4
|
Summary: The trackplot is a tool for visualizing various next-generation sequencing (NGS) data, including DNA-seq, RNA-seq, single-cell RNA-seq and full-length sequencing datasets. https://sashimi.readthedocs.io/
|
|
5
5
|
Author-email: ygidtu <ygidtu@gmail.com>
|
|
6
6
|
License-Expression: BSD-3-Clause
|
|
@@ -23,7 +23,7 @@ Requires-Dist: pysam>=0.23.3
|
|
|
23
23
|
Requires-Dist: requests>=2.32.4
|
|
24
24
|
Requires-Dist: scipy>=1.15.3
|
|
25
25
|
Requires-Dist: seaborn>=0.13.2
|
|
26
|
-
Requires-Dist: xmltodict>=0.
|
|
26
|
+
Requires-Dist: xmltodict>=0.15.0
|
|
27
27
|
Dynamic: license-file
|
|
28
28
|
|
|
29
29
|
# trackplot
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "trackplot"
|
|
3
|
-
version = "0.5.
|
|
3
|
+
version = "0.5.7"
|
|
4
4
|
description = "The trackplot is a tool for visualizing various next-generation sequencing (NGS) data, including DNA-seq, RNA-seq, single-cell RNA-seq and full-length sequencing datasets. https://sashimi.readthedocs.io/"
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "ygidtu", email = "ygidtu@gmail.com" }
|
|
@@ -25,7 +25,7 @@ dependencies = [
|
|
|
25
25
|
"requests>=2.32.4",
|
|
26
26
|
"scipy>=1.15.3",
|
|
27
27
|
"seaborn>=0.13.2",
|
|
28
|
-
"xmltodict>=0.
|
|
28
|
+
"xmltodict>=0.15.0",
|
|
29
29
|
]
|
|
30
30
|
|
|
31
31
|
|
|
@@ -21,13 +21,13 @@ class ReadDepth(object):
|
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
23
|
__slots__ = [
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"__junction_dict__plus___", "__junction_dict__minus__",
|
|
25
|
+
"__minus__", "__plus__", "__number_of_merged__",
|
|
26
26
|
"strand_aware", "site_plus", "site_minus",
|
|
27
27
|
]
|
|
28
28
|
|
|
29
29
|
def __init__(self,
|
|
30
|
-
wiggle: np.
|
|
30
|
+
wiggle: np.ndarray,
|
|
31
31
|
site_plus: Optional[np.array] = None,
|
|
32
32
|
site_minus: Optional[np.array] = None,
|
|
33
33
|
minus: Optional[np.array] = None,
|
|
@@ -45,58 +45,65 @@ class ReadDepth(object):
|
|
|
45
45
|
:param junction_dict_plus: these splice junction from plus strand
|
|
46
46
|
:param junction_dict_minus: these splice junction from minus strand
|
|
47
47
|
"""
|
|
48
|
-
self.
|
|
48
|
+
self.__plus__ = wiggle
|
|
49
49
|
self.strand_aware = strand_aware
|
|
50
|
-
self.
|
|
51
|
-
self.
|
|
52
|
-
self.
|
|
50
|
+
self.__minus__ = abs(minus) if minus is not None else minus
|
|
51
|
+
self.__junction_dict__plus___ = junction_dict_plus
|
|
52
|
+
self.__junction_dict__minus__ = junction_dict_minus
|
|
53
53
|
self.site_plus = site_plus
|
|
54
54
|
self.site_minus = site_minus * -1 if site_minus is not None else site_minus
|
|
55
55
|
|
|
56
|
-
self.
|
|
56
|
+
self.__number_of_merged__ = 1
|
|
57
57
|
|
|
58
58
|
@property
|
|
59
59
|
def plus(self) -> Optional[np.array]:
|
|
60
|
-
if self.
|
|
61
|
-
return self.
|
|
62
|
-
return self.
|
|
60
|
+
if self.__plus__ is not None and self.__number_of_merged__ > 0:
|
|
61
|
+
return self.__plus__ / self.__number_of_merged__
|
|
62
|
+
return self.__plus__
|
|
63
63
|
|
|
64
64
|
@property
|
|
65
65
|
def minus(self) -> Optional[np.array]:
|
|
66
|
-
if self.
|
|
67
|
-
return self.
|
|
68
|
-
return self.
|
|
66
|
+
if self.__minus__ is not None and self.__number_of_merged__ > 0:
|
|
67
|
+
return self.__minus__ / self.__number_of_merged__
|
|
68
|
+
return self.__minus__
|
|
69
69
|
|
|
70
70
|
@property
|
|
71
|
-
def wiggle(self) -> np.
|
|
72
|
-
if (self.
|
|
71
|
+
def wiggle(self) -> np.ndarray:
|
|
72
|
+
if (self.__plus__ is None or not self.__plus__.any()) and self.__minus__ is not None:
|
|
73
73
|
return self.minus
|
|
74
74
|
|
|
75
|
-
if self.
|
|
75
|
+
if self.__plus__ is not None and self.__minus__ is not None:
|
|
76
76
|
return self.plus + self.minus
|
|
77
77
|
|
|
78
78
|
return self.plus
|
|
79
79
|
|
|
80
80
|
@property
|
|
81
|
-
def
|
|
82
|
-
if self.
|
|
83
|
-
return {k: v / self.
|
|
84
|
-
return self.
|
|
81
|
+
def mean_junctions_plus(self) -> dict:
|
|
82
|
+
if self.__number_of_merged__ > 1:
|
|
83
|
+
return {k: v / self.__number_of_merged__ for k, v in self.__junction_dict__plus___.items()}
|
|
84
|
+
return self.__junction_dict__plus___
|
|
85
85
|
|
|
86
86
|
@property
|
|
87
|
-
def
|
|
88
|
-
if self.
|
|
89
|
-
return {k: v / self.
|
|
90
|
-
return self.
|
|
87
|
+
def mean_junctions_minus(self) -> dict:
|
|
88
|
+
if self.__number_of_merged__ > 1:
|
|
89
|
+
return {k: v / self.__number_of_merged__ for k, v in self.__junction_dict__minus__.items()}
|
|
90
|
+
return self.__junction_dict__minus__
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
def junctions_dict(self) -> dict:
|
|
92
|
+
def junctions_dict(self, show_mean_jxn_number: bool = False) -> dict:
|
|
94
93
|
res = {}
|
|
95
|
-
if self._junction_dict_plus_:
|
|
96
|
-
res.update(self.junctions_plus)
|
|
97
94
|
|
|
98
|
-
if
|
|
99
|
-
|
|
95
|
+
if show_mean_jxn_number:
|
|
96
|
+
if self.__junction_dict__plus___:
|
|
97
|
+
res.update(self.mean_junctions_plus)
|
|
98
|
+
|
|
99
|
+
if self.__junction_dict__minus__:
|
|
100
|
+
res.update(self.mean_junctions_minus)
|
|
101
|
+
else:
|
|
102
|
+
if self.__junction_dict__plus___:
|
|
103
|
+
res.update(self.__junction_dict__plus___)
|
|
104
|
+
|
|
105
|
+
if self.__junction_dict__minus__:
|
|
106
|
+
res.update(self.__junction_dict__minus__)
|
|
100
107
|
return res
|
|
101
108
|
|
|
102
109
|
@property
|
|
@@ -117,27 +124,27 @@ class ReadDepth(object):
|
|
|
117
124
|
if len(self.wiggle) == len(other.wiggle):
|
|
118
125
|
junc_plus, junc_minus = {}, {}
|
|
119
126
|
|
|
120
|
-
for i in [self.
|
|
127
|
+
for i in [self.__junction_dict__plus___, other.__junction_dict__plus___]:
|
|
121
128
|
if i:
|
|
122
129
|
junc_plus.update(i)
|
|
123
|
-
for i in [self.
|
|
130
|
+
for i in [self.__junction_dict__minus__, other.__junction_dict__minus__]:
|
|
124
131
|
if i:
|
|
125
132
|
junc_minus.update(i)
|
|
126
133
|
|
|
127
134
|
minus = None
|
|
128
|
-
if self.
|
|
129
|
-
minus = self.
|
|
130
|
-
elif self.
|
|
135
|
+
if self.__minus__ is not None and other.__minus__ is not None:
|
|
136
|
+
minus = self.__minus__ + other.__minus__
|
|
137
|
+
elif self.__minus__ is None and other.__minus__ is not None:
|
|
131
138
|
minus = other.minus
|
|
132
|
-
elif self.
|
|
133
|
-
minus = self.
|
|
139
|
+
elif self.__minus__ is not None and other.__minus__ is None:
|
|
140
|
+
minus = self.__minus__
|
|
134
141
|
|
|
135
142
|
merged = ReadDepth(
|
|
136
|
-
self.
|
|
143
|
+
self.__plus__ + other.__plus__, minus=minus,
|
|
137
144
|
junction_dict_plus=junc_plus,
|
|
138
145
|
junction_dict_minus=junc_minus
|
|
139
146
|
)
|
|
140
|
-
merged.
|
|
147
|
+
merged.__number_of_merged__ = self.__number_of_merged__ + other.__number_of_merged__
|
|
141
148
|
return merged
|
|
142
149
|
else:
|
|
143
150
|
raise ValueError(f"ReadDepth objects are not equal length: {len(self.wiggle)} != {len(other.wiggle)}")
|
|
@@ -164,11 +171,11 @@ class ReadDepth(object):
|
|
|
164
171
|
:return:
|
|
165
172
|
"""
|
|
166
173
|
|
|
167
|
-
for k, v in other.
|
|
168
|
-
self.
|
|
174
|
+
for k, v in other.__junction_dict__plus___:
|
|
175
|
+
self.__junction_dict__plus___[k] = v + self.__junction_dict__plus___.get(k, 0)
|
|
169
176
|
|
|
170
|
-
for k, v in other.
|
|
171
|
-
self.
|
|
177
|
+
for k, v in other.__junction_dict__minus__:
|
|
178
|
+
self.__junction_dict__minus__[k] = v + self.__junction_dict__minus__.get(k, 0)
|
|
172
179
|
|
|
173
180
|
return self.junctions_dict
|
|
174
181
|
|
|
@@ -176,11 +183,11 @@ class ReadDepth(object):
|
|
|
176
183
|
funcs = {"10": np.log10, "2": np.log2, "zscore": zscore, "e": np.log}
|
|
177
184
|
|
|
178
185
|
if log_trans in funcs.keys():
|
|
179
|
-
if self.
|
|
180
|
-
self.
|
|
186
|
+
if self.__plus__ is not None:
|
|
187
|
+
self.__plus__ = funcs[log_trans](self.__plus__ + 1)
|
|
181
188
|
|
|
182
189
|
if self.minus is not None:
|
|
183
|
-
self.
|
|
190
|
+
self.__minus__ = funcs[log_trans](self.__minus__ + 1)
|
|
184
191
|
|
|
185
192
|
def normalize(self, size_factor: float, format_: str = "normal", read_length: float = 0):
|
|
186
193
|
u"""
|
|
@@ -192,35 +199,35 @@ class ReadDepth(object):
|
|
|
192
199
|
|
|
193
200
|
if format_ == "rpkm" and read_length > 0:
|
|
194
201
|
# for rpkm the size_factor is total reads
|
|
195
|
-
self.
|
|
196
|
-
self.
|
|
202
|
+
self.__plus__ = np.divide(
|
|
203
|
+
self.__plus__,
|
|
197
204
|
np.multiply(
|
|
198
|
-
(np.sum(self.
|
|
205
|
+
(np.sum(self.__plus__ != 0) - read_length + 1) / 1e3,
|
|
199
206
|
size_factor / 1e6
|
|
200
207
|
)
|
|
201
208
|
)
|
|
202
|
-
if self.
|
|
203
|
-
self.
|
|
204
|
-
self.
|
|
209
|
+
if self.__minus__ is not None:
|
|
210
|
+
self.__minus__ = np.divide(
|
|
211
|
+
self.__minus__,
|
|
205
212
|
np.multiply(
|
|
206
|
-
(np.sum(self.
|
|
213
|
+
(np.sum(self.__minus__ != 0) - read_length + 1) / 1e3,
|
|
207
214
|
size_factor / 1e6
|
|
208
215
|
)
|
|
209
216
|
)
|
|
210
217
|
elif format_ == "cpm" and read_length > 0:
|
|
211
218
|
# for cpm the size_factor is total reads
|
|
212
|
-
self.
|
|
213
|
-
if self.
|
|
214
|
-
self.
|
|
219
|
+
self.__plus__ = np.divide(self.__plus__, np.divide(size_factor, 1e6))
|
|
220
|
+
if self.__minus__ is not None:
|
|
221
|
+
self.__minus__ = np.divide(self.__minus__, np.divide(size_factor, 1e6))
|
|
215
222
|
elif format_ == "cpm" and read_length > 0:
|
|
216
223
|
# for cpm the size_factor is total reads
|
|
217
|
-
self.
|
|
218
|
-
if self.
|
|
219
|
-
self.
|
|
224
|
+
self.__plus__ = np.divide(self.__plus__, np.divide(size_factor, 1e6))
|
|
225
|
+
if self.__minus__ is not None:
|
|
226
|
+
self.__minus__ = np.divide(self.__minus__, np.divide(size_factor, 1e6))
|
|
220
227
|
elif size_factor is not None and size_factor > 0 and format_ == "atac":
|
|
221
|
-
self.
|
|
222
|
-
if self.
|
|
223
|
-
self.
|
|
228
|
+
self.__plus__ = np.divide(self.__plus__, size_factor) # * 100
|
|
229
|
+
if self.__minus__ is not None:
|
|
230
|
+
self.__minus__ = np.divide(self.__minus__, size_factor)
|
|
224
231
|
|
|
225
232
|
|
|
226
233
|
if __name__ == '__main__':
|
|
@@ -315,6 +315,8 @@ def process_file_list(infile: str, category: str = "density"):
|
|
|
315
315
|
help="The junction id for including, chr1:1-100", show_default=True)
|
|
316
316
|
@optgroup.option("--show-junction-num", type=click.BOOL, is_flag=True, show_default=True,
|
|
317
317
|
help="Whether to show the number of junctions")
|
|
318
|
+
@optgroup.option("--show-mean-junction-num", type=click.BOOL, is_flag=True, show_default=True,
|
|
319
|
+
help="Whether to show the mean junction count averaged across multiple samples.")
|
|
318
320
|
@optgroup.option("--fill-step", type=click.Choice(["pre", "post", "mid"]), default="post", show_default=True,
|
|
319
321
|
help="""
|
|
320
322
|
Define step if the filling should be a step function, i.e. constant in between x.
|
|
@@ -523,8 +525,6 @@ def main(**kwargs):
|
|
|
523
525
|
|
|
524
526
|
size_factors = {}
|
|
525
527
|
|
|
526
|
-
# add annotation
|
|
527
|
-
# print(kwargs.keys())
|
|
528
528
|
for key in kwargs.keys():
|
|
529
529
|
if key in IMAGE_TYPE and kwargs[key] and os.path.exists(kwargs[key]):
|
|
530
530
|
if key == "annotation":
|
|
@@ -573,6 +573,7 @@ def main(**kwargs):
|
|
|
573
573
|
color=sc_colors.get(group, f.color),
|
|
574
574
|
font_size=kwargs["font_size"],
|
|
575
575
|
show_junction_number=kwargs["show_junction_num"],
|
|
576
|
+
show_mean_jxn_number=kwargs["show_mean_junction_num"],
|
|
576
577
|
n_y_ticks=kwargs["n_y_ticks"],
|
|
577
578
|
show_y_label=not kwargs["hide_y_label"],
|
|
578
579
|
show_site_plot=kwargs["show_site"],
|
|
@@ -591,6 +592,7 @@ def main(**kwargs):
|
|
|
591
592
|
color=f.color,
|
|
592
593
|
font_size=kwargs["font_size"],
|
|
593
594
|
show_junction_number=kwargs["show_junction_num"],
|
|
595
|
+
show_mean_jxn_number=kwargs["show_mean_junction_num"],
|
|
594
596
|
n_y_ticks=kwargs["n_y_ticks"],
|
|
595
597
|
show_y_label=not kwargs["hide_y_label"],
|
|
596
598
|
show_site_plot=kwargs["show_site"],
|
|
@@ -27,18 +27,20 @@ def check_junction_exists(ref: List[Junction], dst: Junction, with_strand: bool
|
|
|
27
27
|
u"""
|
|
28
28
|
判断junction是否存在于included_junctions
|
|
29
29
|
"""
|
|
30
|
-
|
|
31
|
-
ref = sorted([Junction.create_junction(x) for x in ref])
|
|
32
|
-
|
|
30
|
+
ref = sorted([Junction.create_junction(x) for x in ref], key=lambda x: (x.chromosome, x.start, x.end))
|
|
33
31
|
for i in ref:
|
|
34
|
-
if abs(i.start - dst.start) < 2 and abs(i.end - dst.end) < 2:
|
|
35
|
-
logger.warning(f"1 bp mismatch between {i} (from bam file) and {dst} (user input), please check the coordinates")
|
|
36
|
-
|
|
37
32
|
if i.is_downstream(dst):
|
|
38
33
|
return False
|
|
39
34
|
if i.eq(dst, with_strand):
|
|
40
35
|
return True
|
|
41
|
-
|
|
36
|
+
elif abs(i.start - dst.start) < 2 and abs(i.end - dst.end) < 2:
|
|
37
|
+
if (not with_strand) or (with_strand and i.strand == dst.strand):
|
|
38
|
+
# in outer code, this function will twice,
|
|
39
|
+
# with with_strand = True and False. therefore, only print log once is enough
|
|
40
|
+
logger.warning(
|
|
41
|
+
f"1 bp mismatch between {i} (from bam file) and {dst} (user input), please check the coordinates"
|
|
42
|
+
)
|
|
43
|
+
|
|
42
44
|
return False
|
|
43
45
|
|
|
44
46
|
|
|
@@ -269,7 +271,8 @@ class Bam(SingleCell):
|
|
|
269
271
|
logger.info(region)
|
|
270
272
|
logger.info(cigar_string)
|
|
271
273
|
logger.info(start, i)
|
|
272
|
-
|
|
274
|
+
logger.error(err)
|
|
275
|
+
exit(1)
|
|
273
276
|
|
|
274
277
|
# remove the deletion.
|
|
275
278
|
if cigar not in (1, 4, 5): # I, S, H
|
|
@@ -307,10 +310,11 @@ class Bam(SingleCell):
|
|
|
307
310
|
logger.debug(f"{str(k)} is included")
|
|
308
311
|
else:
|
|
309
312
|
kept = check_junction_exists(included_junctions, k, with_strand=False)
|
|
310
|
-
logger.debug(f"{str(k)} is included, but strand is ignored")
|
|
311
313
|
|
|
312
314
|
if not kept:
|
|
313
315
|
logger.debug(f"{str(k)} is not included")
|
|
316
|
+
else:
|
|
317
|
+
logger.debug(f"{str(k)} is included, but strand is ignored")
|
|
314
318
|
|
|
315
319
|
if kept:
|
|
316
320
|
if k.strand == "+":
|
|
@@ -30,8 +30,8 @@ logging.getLogger('matplotlib.font_manager').setLevel(logging.ERROR)
|
|
|
30
30
|
faulthandler.enable()
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
__version__ = "0.5.
|
|
34
|
-
__author__ = "
|
|
33
|
+
__version__ = "0.5.7"
|
|
34
|
+
__author__ = "Yiming Zhang & Ran Zhou"
|
|
35
35
|
__email__ = "ygidtu@gmail.com"
|
|
36
36
|
|
|
37
37
|
|
|
@@ -572,6 +572,7 @@ class Plot(object):
|
|
|
572
572
|
color="blue",
|
|
573
573
|
font_size: int = 8,
|
|
574
574
|
show_junction_number: bool = True,
|
|
575
|
+
show_mean_jxn_number: bool = False,
|
|
575
576
|
junction_number_font_size: int = 5,
|
|
576
577
|
n_y_ticks: int = 4,
|
|
577
578
|
show_y_label: bool = True,
|
|
@@ -601,6 +602,7 @@ class Plot(object):
|
|
|
601
602
|
:param library: should be one of [frf: "fr-firststrand", frs:"fr-secondstrand", fru:"fr-unstrand"], default: fru
|
|
602
603
|
:param font_size: the font size for ticks, y-axis label and title
|
|
603
604
|
:param show_junction_number: whether to show the number of junctions
|
|
605
|
+
:param show_mean_jxn_number:
|
|
604
606
|
:param n_y_ticks: number of y ticks
|
|
605
607
|
:param junction_number_font_size:
|
|
606
608
|
:param color: color for this density plot
|
|
@@ -652,6 +654,7 @@ class Plot(object):
|
|
|
652
654
|
self.plots.append(info)
|
|
653
655
|
self.params[info] = {
|
|
654
656
|
"show_junction_number": show_junction_number,
|
|
657
|
+
"show_mean_jxn_number": show_mean_jxn_number,
|
|
655
658
|
"junction_number_font_size": junction_number_font_size,
|
|
656
659
|
"color": color,
|
|
657
660
|
"font_size": font_size,
|