Skip to content

Instantly share code, notes, and snippets.

View sergpolly's full-sized avatar

Sergey Venev sergpolly

  • University of Massachusetts Medical School
  • Worcester, MA
View GitHub Profile
@sergpolly
sergpolly / snip_helpers.py
Created February 14, 2024 14:50
helper functions for snipping module in cooltools
def triu(arr, value=np.nan, k=0, copy=False):
"""
Upper triangle of an array.
Modifies input array, such that its elements below the k-th diagonal
are filled with value (returns modified copy, when requested instead).
Assumes that the input array is 2D.
Parameters
----------
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sergpolly
sergpolly / saddle.py
Created December 5, 2023 15:18
flexible saddles by distance
import pandas as pd
import numpy as np
from itertools import combinations
from functools import partial
from scipy.linalg import toeplitz
import pandas as pd
from cooltools.lib.checks import (
is_compatible_viewframe,
is_valid_expected,
is_cooler_balanced,
@sergpolly
sergpolly / cooler-query.py
Created February 7, 2023 20:06
new cooler query engine
f = clr.open('r')
reader = cooler.core._rangequery.CSRReader(f['pixels'], f['indexes/bin1_offset'][:])
sel = cooler.core._rangequery.DirectRangeQuery2D(reader, "count", bbox=[0,1000,0,1000], chunksize=1_000_000)
sel_low = cooler.core._rangequery.FillLowerRangeQuery2D(reader, "count", bbox=[0,1000,0,1000], chunksize=1_000_000)
cooler.core._rangequery.FillLowerRangeQuery2D
plt.imshow(np.log(sel_low.to_array()))
sel.tasks
for g in sel:
print(g)
@sergpolly
sergpolly / dots-dump-scores.ipynb
Created February 3, 2023 22:39
dotfinder based notebook that ends with an iterator of scored pixels
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sergpolly
sergpolly / JointEigendecomposition.ipynb
Created March 11, 2021 18:50
attempt at join eigendecomposition on 2 samples
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sergpolly
sergpolly / expected_schema_region_table.ipynb
Created March 1, 2021 22:09
trying schemas for expected and sanitized reading (region_table guaranteed)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sergpolly
sergpolly / try_intpolated_expected.ipynb
Created February 17, 2021 16:42
checking out Max's logbin_expected PR - mostly about the dense mat_expected editing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.