Skip to content

Commit 01b87d5

Browse files
committed
fix bedgraph checks
1 parent 246a563 commit 01b87d5

6 files changed

Lines changed: 32 additions & 9 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.2
14+
version: 0.3.3
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

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.2"
3+
version = "0.3.3"
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"

trackplot/cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def process_file_list(infile: str, category: str = "density"):
9393
for idx, line in __read_iter__(infile):
9494
path, category = line[0], line[1]
9595

96-
if category not in ["bam", "bigwig", "bw", "depth", "igv", "atac"]:
96+
if category not in ["bam", "bigwig", "bw", "depth", "igv", "atac", "bedgraph", "bg"]:
9797
raise ValueError(f"{category} is not supported in density plot.")
9898

9999
if len(line) < 3:
@@ -112,7 +112,7 @@ def process_file_list(infile: str, category: str = "density"):
112112
for idx, line in __read_iter__(infile):
113113
path, category = line[0], line[1]
114114

115-
if category not in ["bam", "bigwig", "bw", "depth", "atac"]:
115+
if category not in ["bam", "bigwig", "bw", "depth", "atac", "bedgraph", "bg"]:
116116
raise ValueError(f"{category} is not supported in heatmap plot.")
117117

118118
if len(line) < 3:
@@ -134,7 +134,7 @@ def process_file_list(infile: str, category: str = "density"):
134134
for idx, line in __read_iter__(infile):
135135
path, category = line[0], line[1]
136136

137-
if category not in ["bam", "bigwig", "bw", "depth"]:
137+
if category not in ["bam", "bigwig", "bw", "depth", "bedgraph", "bg"]:
138138
raise ValueError(f"{category} is not supported in density plot.")
139139

140140
if len(line) < 3:

trackplot/file/Depth.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,30 @@ def __init__(self, path: str, label: List[str] = None, title: str = ""):
3131
self.region = None
3232

3333
def __hash__(self):
34-
return hash(tuple([hash(v) for v in self.data.items()]))
34+
if self.data:
35+
return hash(tuple([hash(v) for v in self.data.items()]))
36+
return hash(tuple(self.label))
3537

3638
def __eq__(self, other):
3739
return hash(self) == hash(other)
3840

3941
def __len__(self) -> int:
4042
return len(self.data)
4143

44+
@property
45+
def plus(self):
46+
if self.data:
47+
return np.array(self.data.values()).max(axis=0)
48+
return np.array(0)
49+
50+
@property
51+
def minus(self):
52+
return None
53+
54+
@property
55+
def wiggle(self):
56+
return self.plus
57+
4258
@classmethod
4359
def create(cls, path: str, label: List[str] = None, title: str = ""):
4460
u"""
@@ -94,4 +110,10 @@ def items(self):
94110

95111

96112
if __name__ == '__main__':
113+
values = [
114+
np.array([1, 2, 3, 4, 5]),
115+
np.array([5, 4, 3, 2, 1])
116+
]
117+
118+
print(np.zeros())
97119
pass

trackplot/plot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
faulthandler.enable()
3131

3232

33-
__version__ = "0.3.2"
33+
__version__ = "0.3.3"
3434
__author__ = "ygidtu & Ran Zhou"
3535
__email__ = "ygidtu@gmail.com"
3636

@@ -1215,7 +1215,7 @@ def plot(self,
12151215
logger.info(f"plotting {p.type} at idx: {curr_idx} with height_ratio: {height_ratio[curr_idx]}")
12161216
if p.type == "density":
12171217
if isinstance(p.obj[0], Depth):
1218-
for _, readDepth in p.obj[0].data.items():
1218+
for key, readDepth in p.obj[0].data.items():
12191219
plot_density(
12201220
ax=ax_var,
12211221
data=readDepth,
@@ -1226,6 +1226,7 @@ def plot(self,
12261226
distance_between_label_axis=distance_between_label_axis,
12271227
raster=raster,
12281228
fill_step=fill_step,
1229+
y_label=key,
12291230
**self.params.get(p, {})
12301231
)
12311232
curr_idx += 1

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.1",
4+
"version": "0.3.3",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

0 commit comments

Comments
 (0)