Skip to content

Commit

Permalink
fix: handling path in tree CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
js2264 committed Oct 16, 2024
1 parent eb9d28d commit b265236
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/momics/cli/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ def tree(ctx, path):

mom = momics.Momics(path)
chrs = mom.chroms()["chrom"]
name = Path(os.path.dirname(path)).with_suffix("").name

if path.endswith("/"):
name = Path(os.path.dirname(path)).with_suffix("").name
else:
name = Path(path).with_suffix("").name

vfs = mom.cfg.vfs
chroms_uri = mom._build_uri("genome", "chroms") + ".tdb"
sequence_uri = mom._build_uri("genome", chrs[0]) + ".tdb"
Expand Down
7 changes: 6 additions & 1 deletion src/momics/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(
data: str,
label: str,
label_center: Optional[int] = None,
silent: bool = False,
) -> None:
"""Initialize the RangeGenerator object.
Expand All @@ -59,6 +60,7 @@ def __init__(
self.stop = len(ranges)
self.step = batch_size
self.current = self.start
self.silent = silent

tr = momics.tracks()
if data == "nucleotide":
Expand Down Expand Up @@ -92,8 +94,11 @@ def __next__(self) -> Tuple[np.ndarray, np.ndarray]:
if self.data != "nucleotide":
attrs.append(self.data)

logging.disable(logging.WARNING)
if self.silent:
logging.disable(logging.WARNING)
q.query_tracks(tracks=attrs)
if self.silent:
logging.disable(logging.WARNING)
logging.disable(logging.NOTSET)

# If input is a track, reshape and filter out NaN values
Expand Down

0 comments on commit b265236

Please sign in to comment.