Skip to content

Commit

Permalink
fix bedgraph checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ygidtu committed Aug 15, 2023
1 parent 246a563 commit 01b87d5
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 9 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.2
version: 0.3.3
# 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
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.2"
version = "0.3.3"
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
6 changes: 3 additions & 3 deletions trackplot/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def process_file_list(infile: str, category: str = "density"):
for idx, line in __read_iter__(infile):
path, category = line[0], line[1]

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

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

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

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

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

if len(line) < 3:
Expand Down
24 changes: 23 additions & 1 deletion trackplot/file/Depth.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,30 @@ def __init__(self, path: str, label: List[str] = None, title: str = ""):
self.region = None

def __hash__(self):
return hash(tuple([hash(v) for v in self.data.items()]))
if self.data:
return hash(tuple([hash(v) for v in self.data.items()]))
return hash(tuple(self.label))

def __eq__(self, other):
return hash(self) == hash(other)

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

@property
def plus(self):
if self.data:
return np.array(self.data.values()).max(axis=0)
return np.array(0)

@property
def minus(self):
return None

@property
def wiggle(self):
return self.plus

@classmethod
def create(cls, path: str, label: List[str] = None, title: str = ""):
u"""
Expand Down Expand Up @@ -94,4 +110,10 @@ def items(self):


if __name__ == '__main__':
values = [
np.array([1, 2, 3, 4, 5]),
np.array([5, 4, 3, 2, 1])
]

print(np.zeros())
pass
5 changes: 3 additions & 2 deletions trackplot/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
faulthandler.enable()


__version__ = "0.3.2"
__version__ = "0.3.3"
__author__ = "ygidtu & Ran Zhou"
__email__ = "[email protected]"

Expand Down Expand Up @@ -1215,7 +1215,7 @@ def plot(self,
logger.info(f"plotting {p.type} at idx: {curr_idx} with height_ratio: {height_ratio[curr_idx]}")
if p.type == "density":
if isinstance(p.obj[0], Depth):
for _, readDepth in p.obj[0].data.items():
for key, readDepth in p.obj[0].data.items():
plot_density(
ax=ax_var,
data=readDepth,
Expand All @@ -1226,6 +1226,7 @@ def plot(self,
distance_between_label_axis=distance_between_label_axis,
raster=raster,
fill_step=fill_step,
y_label=key,
**self.params.get(p, {})
)
curr_idx += 1
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.1",
"version": "0.3.3",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down

0 comments on commit 01b87d5

Please sign in to comment.