Skip to content

Instantly share code, notes, and snippets.

Avatar

James Webber jamestwebber

View GitHub Profile
@jamestwebber
jamestwebber / cupy_dataloader.py
Created Oct 31, 2020
How to use a cupy csr_matrix in PyTorch
View cupy_dataloader.py
import torch
# cupy fails to import when there are no GPUs. This check means that the module can
# still be imported in that case, but of course the classes won't work.
if torch.cuda.is_available():
import cupy
from torch.utils.data import DataLoader, Dataset
from torch.utils.dlpack import from_dlpack
@jamestwebber
jamestwebber / filter_fastq.py
Created Jun 28, 2019
Filters fastq files for a given list of 20bp guide sequences and outputs a count file
View filter_fastq.py
#!/usr/bin/env python3
import argparse
import gzip
import itertools
import os
import multiprocessing
from collections import Counter, defaultdict
View apply_example.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jamestwebber
jamestwebber / pyro_logistic_regression.ipynb
Created Oct 23, 2018
A iPython notebook showing how to use SVI for logistic regression in Pyro
View pyro_logistic_regression.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jamestwebber
jamestwebber / pyro_scvi.ipynb
Created Sep 17, 2018
the scVI VAE model, but using Pyro-PPL for inference
View pyro_scvi.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jamestwebber
jamestwebber / nanopore_packer_build.log
Created Jan 31, 2018
Log of `PACKER_LOG=1 packer build nanopore.json`
View nanopore_packer_build.log
➜ packer-images git:(specops) ✗ PACKER_LOG=1 packer build -force nanopore.json
2018/01/30 19:06:30 [INFO] Packer version: 1.1.0
2018/01/30 19:06:30 Packer Target OS/Arch: darwin amd64
2018/01/30 19:06:30 Built with Go Version: go1.9
2018/01/30 19:06:30 Detected home directory from env var: /Users/james.webber
2018/01/30 19:06:30 Using internal plugin for vmware-iso
2018/01/30 19:06:30 Using internal plugin for vmware-vmx
2018/01/30 19:06:30 Using internal plugin for googlecompute
2018/01/30 19:06:30 Using internal plugin for hyperv-iso
2018/01/30 19:06:30 Using internal plugin for parallels-pvm
@jamestwebber
jamestwebber / wilensky.ipynb
Last active Jun 21, 2017
A Python Notebook for Wilensky's fairness illusion exercise
View wilensky.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jamestwebber
jamestwebber / qrcard notebook.ipynb
Last active Jul 15, 2019
A Jupyter notebook for making qrcodes out of existing images and adding a URL. Fixed to 41x41 (version 6) images. Depends on numpy, scipy, matplotlib, Pillow, and python-qrcode.
View qrcard notebook.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.