question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Avoiding the empty gray box

See original GitHub issue

I am a new user of HiGlass, and I am trying to use it to visualize an arbitrary numpy matrix, following the example given in the “Jupyter examples” page. When I first loaded my matrix, I just got an empty viewport, like this:

image

After experimenting for a bit, I learned that it was possible for me see the matrix if I kept only a small submatrix and rescaled the values to a much smaller range. Here is what I get:

image

I achieved this result by extracting a submatrix of size 2000x2000 and raising the entire matrix to the power 0.1. I find that if I use all of the 82548 rows of the matrix or if I expand the range of values to the original range (0 to 2166895104), then I am back to the grey screen. Selecting “zoom to extent” doesn’t solve the problem.

Is there something I can do to be able to visualize this entire matrix?

Here’s the code:

import scipy.sparse as sparse 

compressed_matrix_file="DIA-S4-1.npz"
noisy_sparse = sparse.load_npz(compressed_matrix_file).tocsr()
# load the whole matrix
noisy = noisy_sparse.toarray()
# load part of the matrix
rt_min = 0
rt_max = 2000
mz_min = 38000
mz_max = 40000
noisy = noisy_sparse.toarray()[rt_min:rt_max]
noisy = np.transpose(noisy)[mz_min:mz_max]
print(noisy.shape)
noisy = np.power(noisy, 1/10)
print(noisy.min(), noisy.max())

ts = Tileset(
    tileset_info=lambda: npmatrix.tileset_info(noisy),
    tiles=lambda tids: npmatrix.tiles_wrapper(noisy, tids)
)

display, server, viewconf = higlass.display([
    View([
        Track(track_type='top-axis', position='top'),
        Track(track_type='left-axis', position='left'),
        Track(track_type='heatmap',
              position='center',
              tileset=ts,
              height=250),

    ])
])
display

DIA-S4-1.npz.gz

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
wsnoblecommented, Nov 20, 2021

Yes, after I installed the new version it works. Thanks!

0reactions
pkerpedjievcommented, Nov 19, 2021

Interesting… you must have clodius installed because it’s a dependency of higlass-python. And the tiles function here, npmatrix.tileset_info comes from the clodius package.

    tileset_info=lambda: npmatrix.tileset_info(noisy),

Are you using the same virtual environment for your notebook and the place you tried installing clodius?

I just issued a new release so you can now do pip install clodius>=0.17.1 to get the latest version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Does the Empty Grey Chat Box Mean on Snapchat?
The grey chat box could result from an issue with the Snapchat app or your device. See if restarting Snapchat or your device...
Read more >
Zoom meetings: how to eliminate gray boxes? - Super User
My approach to avoiding gray rectangles and making the user experience relatively seamless is two-fold. Show media using PowerPoint if possible.
Read more >
UIPickerView showing empty grey box Swift - Stack Overflow
The Grey window appears when I click on the textField but never shows any content. But the print statements say otherwise.
Read more >
How do you prevent empty text form fields from printing on a
Click the dialog box launcher of the Styles group in the Home tab. At the bottom of the task pane, click the button...
Read more >
How to Empty & Clean your RV Black and Grey water Tanks
The fast, easy, and simplest method. We've been using this method for over 20 years and never had a clogs, smells, or any...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found