Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved the prettiness of the print methods. #4

Merged
merged 2 commits into from
Oct 31, 2023
Merged

Conversation

LTLA
Copy link
Member

@LTLA LTLA commented Oct 31, 2023

from iranges import IRanges
X = IRanges(start=[1, 2, 3, 4], width=[10, 20, 30, 40])
print(X)
## IRanges object with 4 ranges and 0 metadata columns
##         start       end     width
##     <ndarray> <ndarray> <ndarray>
## [0]         1        11        10
## [1]         2        22        20
## [2]         3        33        30
## [3]         4        44        40

import numpy as np
from biocframe import BiocFrame
Y = X.set_mcols(BiocFrame({ "A": [ True, False, False, True ], "B": np.array([0,1,2,3]) }))
print(Y)
## IRanges object with 4 ranges and 2 metadata columns
##         start       end     width        A         B
##     <ndarray> <ndarray> <ndarray>   <list> <ndarray>
## [0]         1        11        10 |   True         0
## [1]         2        22        20 |  False         1
## [2]         3        33        30 |  False         2
## [3]         4        44        40 |   True         3

Z = Y.set_metadata({ "FOO":1, "BAR": 2})
print(Z)
## IRanges object with 4 ranges and 2 metadata columns
##         start       end     width        A         B
##     <ndarray> <ndarray> <ndarray>   <list> <ndarray>
## [0]         1        11        10 |   True         0
## [1]         2        22        20 |  False         1
## [2]         3        33        30 |  False         2
## [3]         4        44        40 |   True         3
## ------
## metadata (2): 'FOO' 'BAR'

@jkanche jkanche merged commit a21937c into master Oct 31, 2023
5 checks passed
@jkanche jkanche deleted the pretty-show branch October 31, 2023 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants