Skip to content

Commit

Permalink
fix intervals loading and plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
ygidtu committed Jun 13, 2024
1 parent 4cfee59 commit b7e6da3
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 84 deletions.
2 changes: 1 addition & 1 deletion AppImageBuilder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ AppDir:
app_info:
id: org.appimage-crafters.trackplot
name: trackplot
version: 0.3.8
version: 0.4.0
# Set the python executable as entry point
exec: "bin/python3"
# Set the application main script path as argument. Use '$@' to forward CLI parameters
Expand Down
116 changes: 58 additions & 58 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "trackplot"
version = "0.3.8"
version = "0.4.0"
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/"
authors = ["ygidtu <[email protected]>"]
license = "BSD-3"
Expand Down
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ asciitree==0.3.3 ; python_version >= "3.8" and python_version < "3.12"
blinker==1.8.2 ; python_version >= "3.8" and python_version < "3.12"
blosc2==2.0.0 ; python_version >= "3.8" and python_version < "3.12"
cairocffi==1.7.0 ; python_version >= "3.8" and python_version < "3.12"
certifi==2024.2.2 ; python_version >= "3.8" and python_version < "3.12"
certifi==2024.6.2 ; python_version >= "3.8" and python_version < "3.12"
cffi==1.16.0 ; python_version >= "3.8" and python_version < "3.12"
charset-normalizer==3.3.2 ; python_version >= "3.8" and python_version < "3.12"
click-option-group==0.5.6 ; python_version >= "3.8" and python_version < "3.12"
Expand All @@ -17,7 +17,7 @@ cytoolz==0.12.3 ; python_version >= "3.8" and python_version < "3.12"
dill==0.3.8 ; python_version >= "3.8" and python_version < "3.12"
filetype==1.2.0 ; python_version >= "3.8" and python_version < "3.12"
flask==2.3.3 ; python_version >= "3.8" and python_version < "3.12"
fonttools==4.52.4 ; python_version >= "3.8" and python_version < "3.12"
fonttools==4.53.0 ; python_version >= "3.8" and python_version < "3.12"
h5py==3.11.0 ; python_version >= "3.8" and python_version < "3.12"
hicmatrix==15 ; python_version >= "3.8" and python_version < "3.12"
idna==3.7 ; python_version >= "3.8" and python_version < "3.12"
Expand All @@ -34,7 +34,7 @@ msgpack==1.0.8 ; python_version >= "3.8" and python_version < "3.12"
multiprocess==0.70.16 ; python_version >= "3.8" and python_version < "3.12"
numexpr==2.8.6 ; python_version >= "3.8" and python_version < "3.12"
numpy==1.24.4 ; python_version >= "3.8" and python_version < "3.12"
packaging==24.0 ; python_version >= "3.8" and python_version < "3.12"
packaging==24.1 ; python_version >= "3.8" and python_version < "3.12"
pandas==1.5.3 ; python_version >= "3.8" and python_version < "3.12"
pillow==10.3.0 ; python_version >= "3.8" and python_version < "3.12"
py-cpuinfo==9.0.0 ; python_version >= "3.8" and python_version < "3.12"
Expand All @@ -46,7 +46,7 @@ pysam==0.21.0 ; python_version >= "3.8" and python_version < "3.12"
python-dateutil==2.9.0.post0 ; python_version >= "3.8" and python_version < "3.12"
pytz==2024.1 ; python_version >= "3.8" and python_version < "3.12"
pyyaml==6.0.1 ; python_version >= "3.8" and python_version < "3.12"
requests==2.32.2 ; python_version >= "3.8" and python_version < "3.12"
requests==2.32.3 ; python_version >= "3.8" and python_version < "3.12"
scipy==1.10.1 ; python_version >= "3.8" and python_version < "3.12"
seaborn==0.12.2 ; python_version >= "3.8" and python_version < "3.12"
setuptools==70.0.0 ; python_version >= "3.8" and python_version < "3.12"
Expand All @@ -59,4 +59,4 @@ urllib3==2.2.1 ; python_version >= "3.8" and python_version < "3.12"
werkzeug==3.0.3 ; python_version >= "3.8" and python_version < "3.12"
win32-setctime==1.1.0 ; python_version >= "3.8" and python_version < "3.12" and sys_platform == "win32"
xmltodict==0.13.0 ; python_version >= "3.8" and python_version < "3.12"
zipp==3.19.0 ; python_version >= "3.8" and python_version < "3.12"
zipp==3.19.2 ; python_version >= "3.8" and python_version < "3.12"
12 changes: 3 additions & 9 deletions trackplot/file/Annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,15 +538,9 @@ def __load_interval(self):
strand = "*"
rec_name = ""

interval_target.append(
GenomicLoci(
chromosome=rec.contig,
start=rec.start,
end=rec.end,
strand=strand,
name=rec_name
)
)
interval_target.append(GenomicLoci(
chromosome=rec.contig, start=start, end=end, strand=strand, name=rec_name
))

if len(interval_target) != 0 and rec is not None:
self.data.append(Transcript(
Expand Down
2 changes: 1 addition & 1 deletion trackplot/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
faulthandler.enable()


__version__ = "0.3.8"
__version__ = "0.4.0"
__author__ = "ygidtu & Ran Zhou"
__email__ = "[email protected]"

Expand Down
23 changes: 15 additions & 8 deletions trackplot/plot_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,21 @@ def init_graph_coords(region: GenomicLoci, exons: Optional[List[List[int]]] = No
intron = [exons[i - 1][1], exons[i][0]]

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

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

intron = [exons[-1][-1], region.end]
for i in range(intron[0], intron[1]):
graph_coords[i - region.start] = graph_coords[intron[0] - region.start - 1] + (
i - intron[0] + 1) * intron_scale
if i >= region.start:
graph_coords[i - region.start] = graph_coords[intron[0] - region.start - 1] + (
i - intron[0] + 1) * intron_scale

else:
# if there is not any exons, just init graph_coords by region
for i, j in enumerate(range(region.start, region.end + 1)):
Expand Down Expand Up @@ -450,8 +454,11 @@ def plot_annotation(
# @2022.05.13
# add index to avoid label overlapping of neighbor exon
for ind, exon in enumerate(transcript.exons):
s, e, strand = region.relative(
exon.start), region.relative(exon.end), exon.strand
s, e, strand = (region.relative(exon.start),
region.relative(exon.end), exon.strand)

if s < 0 or e < 0:
continue

patches.append(plt.Rectangle(
(graph_coords[s], y_loc - exon_width / 2),
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "trackplot",
"private": true,
"version": "0.3.8",
"version": "0.4.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down

0 comments on commit b7e6da3

Please sign in to comment.