Skip to content

Commit b7e6da3

Browse files
committed
fix intervals loading and plotting
1 parent 4cfee59 commit b7e6da3

8 files changed

Lines changed: 85 additions & 84 deletions

File tree

AppImageBuilder.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ AppDir:
1111
app_info:
1212
id: org.appimage-crafters.trackplot
1313
name: trackplot
14-
version: 0.3.8
14+
version: 0.4.0
1515
# Set the python executable as entry point
1616
exec: "bin/python3"
1717
# Set the application main script path as argument. Use '$@' to forward CLI parameters

poetry.lock

Lines changed: 58 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "trackplot"
3-
version = "0.3.8"
3+
version = "0.4.0"
44
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/"
55
authors = ["ygidtu <ygidtu@gmail.com>"]
66
license = "BSD-3"

requirements.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ asciitree==0.3.3 ; python_version >= "3.8" and python_version < "3.12"
33
blinker==1.8.2 ; python_version >= "3.8" and python_version < "3.12"
44
blosc2==2.0.0 ; python_version >= "3.8" and python_version < "3.12"
55
cairocffi==1.7.0 ; python_version >= "3.8" and python_version < "3.12"
6-
certifi==2024.2.2 ; python_version >= "3.8" and python_version < "3.12"
6+
certifi==2024.6.2 ; python_version >= "3.8" and python_version < "3.12"
77
cffi==1.16.0 ; python_version >= "3.8" and python_version < "3.12"
88
charset-normalizer==3.3.2 ; python_version >= "3.8" and python_version < "3.12"
99
click-option-group==0.5.6 ; python_version >= "3.8" and python_version < "3.12"
@@ -17,7 +17,7 @@ cytoolz==0.12.3 ; python_version >= "3.8" and python_version < "3.12"
1717
dill==0.3.8 ; python_version >= "3.8" and python_version < "3.12"
1818
filetype==1.2.0 ; python_version >= "3.8" and python_version < "3.12"
1919
flask==2.3.3 ; python_version >= "3.8" and python_version < "3.12"
20-
fonttools==4.52.4 ; python_version >= "3.8" and python_version < "3.12"
20+
fonttools==4.53.0 ; python_version >= "3.8" and python_version < "3.12"
2121
h5py==3.11.0 ; python_version >= "3.8" and python_version < "3.12"
2222
hicmatrix==15 ; python_version >= "3.8" and python_version < "3.12"
2323
idna==3.7 ; python_version >= "3.8" and python_version < "3.12"
@@ -34,7 +34,7 @@ msgpack==1.0.8 ; python_version >= "3.8" and python_version < "3.12"
3434
multiprocess==0.70.16 ; python_version >= "3.8" and python_version < "3.12"
3535
numexpr==2.8.6 ; python_version >= "3.8" and python_version < "3.12"
3636
numpy==1.24.4 ; python_version >= "3.8" and python_version < "3.12"
37-
packaging==24.0 ; python_version >= "3.8" and python_version < "3.12"
37+
packaging==24.1 ; python_version >= "3.8" and python_version < "3.12"
3838
pandas==1.5.3 ; python_version >= "3.8" and python_version < "3.12"
3939
pillow==10.3.0 ; python_version >= "3.8" and python_version < "3.12"
4040
py-cpuinfo==9.0.0 ; python_version >= "3.8" and python_version < "3.12"
@@ -46,7 +46,7 @@ pysam==0.21.0 ; python_version >= "3.8" and python_version < "3.12"
4646
python-dateutil==2.9.0.post0 ; python_version >= "3.8" and python_version < "3.12"
4747
pytz==2024.1 ; python_version >= "3.8" and python_version < "3.12"
4848
pyyaml==6.0.1 ; python_version >= "3.8" and python_version < "3.12"
49-
requests==2.32.2 ; python_version >= "3.8" and python_version < "3.12"
49+
requests==2.32.3 ; python_version >= "3.8" and python_version < "3.12"
5050
scipy==1.10.1 ; python_version >= "3.8" and python_version < "3.12"
5151
seaborn==0.12.2 ; python_version >= "3.8" and python_version < "3.12"
5252
setuptools==70.0.0 ; python_version >= "3.8" and python_version < "3.12"
@@ -59,4 +59,4 @@ urllib3==2.2.1 ; python_version >= "3.8" and python_version < "3.12"
5959
werkzeug==3.0.3 ; python_version >= "3.8" and python_version < "3.12"
6060
win32-setctime==1.1.0 ; python_version >= "3.8" and python_version < "3.12" and sys_platform == "win32"
6161
xmltodict==0.13.0 ; python_version >= "3.8" and python_version < "3.12"
62-
zipp==3.19.0 ; python_version >= "3.8" and python_version < "3.12"
62+
zipp==3.19.2 ; python_version >= "3.8" and python_version < "3.12"

trackplot/file/Annotation.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -538,15 +538,9 @@ def __load_interval(self):
538538
strand = "*"
539539
rec_name = ""
540540

541-
interval_target.append(
542-
GenomicLoci(
543-
chromosome=rec.contig,
544-
start=rec.start,
545-
end=rec.end,
546-
strand=strand,
547-
name=rec_name
548-
)
549-
)
541+
interval_target.append(GenomicLoci(
542+
chromosome=rec.contig, start=start, end=end, strand=strand, name=rec_name
543+
))
550544

551545
if len(interval_target) != 0 and rec is not None:
552546
self.data.append(Transcript(

trackplot/plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
faulthandler.enable()
3030

3131

32-
__version__ = "0.3.8"
32+
__version__ = "0.4.0"
3333
__author__ = "ygidtu & Ran Zhou"
3434
__email__ = "ygidtu@gmail.com"
3535

trackplot/plot_func.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,21 @@ def init_graph_coords(region: GenomicLoci, exons: Optional[List[List[int]]] = No
147147
intron = [exons[i - 1][1], exons[i][0]]
148148

149149
for j in range(intron[0], intron[1]):
150-
graph_coords[j - region.start] = graph_coords[intron[0] - region.start - 1] + (
151-
j - intron[0] + 1) * intron_scale
150+
if j >= region.start:
151+
graph_coords[j - region.start] = graph_coords[intron[0] - region.start - 1] + (
152+
j - intron[0] + 1) * intron_scale
152153

153154
for j in range(exon[0], exon[1] + 1):
154-
graph_coords[j - region.start] = graph_coords[exon[0] - region.start - 1] + (
155-
j - exon[0] + 1) * exon_scale
155+
if j >= region.start:
156+
graph_coords[j - region.start] = graph_coords[exon[0] - region.start - 1] + (
157+
j - exon[0] + 1) * exon_scale
156158

157159
intron = [exons[-1][-1], region.end]
158160
for i in range(intron[0], intron[1]):
159-
graph_coords[i - region.start] = graph_coords[intron[0] - region.start - 1] + (
160-
i - intron[0] + 1) * intron_scale
161+
if i >= region.start:
162+
graph_coords[i - region.start] = graph_coords[intron[0] - region.start - 1] + (
163+
i - intron[0] + 1) * intron_scale
164+
161165
else:
162166
# if there is not any exons, just init graph_coords by region
163167
for i, j in enumerate(range(region.start, region.end + 1)):
@@ -450,8 +454,11 @@ def plot_annotation(
450454
# @2022.05.13
451455
# add index to avoid label overlapping of neighbor exon
452456
for ind, exon in enumerate(transcript.exons):
453-
s, e, strand = region.relative(
454-
exon.start), region.relative(exon.end), exon.strand
457+
s, e, strand = (region.relative(exon.start),
458+
region.relative(exon.end), exon.strand)
459+
460+
if s < 0 or e < 0:
461+
continue
455462

456463
patches.append(plt.Rectangle(
457464
(graph_coords[s], y_loc - exon_width / 2),

web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "trackplot",
33
"private": true,
4-
"version": "0.3.8",
4+
"version": "0.4.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

0 commit comments

Comments
 (0)