Skip to content

Instantly share code, notes, and snippets.

View ivirshup's full-sized avatar
💭
🫠

Isaac Virshup ivirshup

💭
🫠
View GitHub Profile
@ivirshup
ivirshup / travis-output.log
Created April 1, 2019 12:09
test_marker_overlap heisenbug log output
travis_fold:start:worker_info
Worker information
hostname: 4c70b58b-1d92-4cdb-8dc0-547cc4c52f41@1.production-1-worker-org-gce-xd4f
version: v6.2.0 https://github.com/travis-ci/worker/tree/5e5476e01646095f48eec13196fdb3faf8f5cbf7
instance: travis-job-1c73a386-5e3e-4462-9423-877511d99d2d travis-ci-garnet-trusty-1512502259-986baf0 (via amqp)
startup: 6.583484338s
travis_fold:end:worker_info
travis_fold:start:system_info
Build system information
Build language: python
@ivirshup
ivirshup / dblt_detect.py
Created April 10, 2019 03:48
Doublet prediction via projecting simulated doublets into a UMAP representation of real data
import scanpy as sc
import numpy as np
import pandas as pd
from scipy import sparse
from umap import UMAP
from itertools import repeat, chain
# Define functions
@ivirshup
ivirshup / umap_anndata_bug.py
Last active April 14, 2019 06:35
Weird data projection bug
import scanpy as sc
import numpy as np
import pandas as pd
from scipy import sparse
from umap import UMAP
from itertools import repeat, chain
def preprocess(adata):
# adata.var["mito"] = adata.var["gene_symbols"].str.startswith("MT-")
# sc.pp.calculate_qc_metrics(adata, qc_vars=["mito"], inplace=True)
@ivirshup
ivirshup / scanpy_chain.py
Last active April 23, 2019 03:33
chainable scanpy methods
import scanpy as sc
from anndata import AnnData
from functools import partial, partialmethod, wraps
from inspect import isfunction, getmembers
class Mapper(object):
def __init__(self, parent, mod):
self._parent = parent
self._mod = mod
self._modfuncs = getmembers(mod, isfunction)
@ivirshup
ivirshup / aligned_mapping.py
Last active April 24, 2019 09:34
AlignedMapping skeleton
from abc import ABC
from collections.abc import MutableMapping
class AlignedMapping(MutableMapping, ABC):
@property
@abstractmethod
def isview(self):
pass
@ivirshup
ivirshup / oz.geojson
Created July 10, 2019 10:47
test geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ivirshup
ivirshup / traceback.py
Created September 2, 2019 01:41
Full numba traceback for trying to call `list(x)` where x is numpy array of unicode
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
/usr/local/lib/python3.7/site-packages/numba/errors.py in new_error_context(fmt_, *args, **kwargs)
661 try:
--> 662 yield
663 except NumbaError as e:
/usr/local/lib/python3.7/site-packages/numba/lowering.py in lower_block(self, block)
257 loc=self.loc, errcls_=defaulterrcls):
--> 258 self.lower_inst(inst)
@ivirshup
ivirshup / ipython_session.py
Created October 14, 2019 05:37
h5py memory cache performance
Python 3.7.4 (default, Sep 7 2019, 18:27:02)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.8.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import h5py
In [2]: import numpy as np
In [3]: indices = np.sort(np.random.choice(int(1e7), int(1e4), replace=False))
@ivirshup
ivirshup / ipython_session.py
Last active October 14, 2019 05:49
hdf5 cache performance testing
Python 3.7.4 (default, Sep 7 2019, 18:27:02)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.8.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import h5py
In [2]: import numpy as np
In [3]: indices = np.sort(np.random.choice(int(1e7), int(1e4), replace=False))
@ivirshup
ivirshup / black_error.log
Created November 29, 2019 05:08
Black error log
--- src
+++ dst
@@ -2612,10 +2612,20 @@
) # /Load
id=
'C', # str
) # /Name
) # /Assign
+ Return(
+ value=