Skip to content

Instantly share code, notes, and snippets.

View cschin's full-sized avatar
💭
I may be slow to respond.

Jason Chin cschin

💭
I may be slow to respond.
View GitHub Profile
@cschin
cschin / test_stream_out.py
Created March 22, 2024 16:19
example for streaming audio for Gradio
import gradio as gr
import numpy as np
import wave
def response():
def streaming():
f = wave.open("sound.wav", 'rb')
buffer = f.readframes(f.getnframes())
data = np.frombuffer(buffer, dtype=f'int{f.getsampwidth()*8}')
chunks = []
@cschin
cschin / diffusion.ipynb
Created January 17, 2024 04:00
A toy model showing how diffusion model works
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cschin
cschin / error.log
Created May 26, 2023 15:33
miniwdl singularity local run fail log
[
"Traceback (most recent call last):",
" File \"/home/ubuntu/miniconda3/lib/python3.10/site-packages/urllib3/connectionpool.py\", line 703, in urlopen",
" httplib_response = self._make_request(",
" File \"/home/ubuntu/miniconda3/lib/python3.10/site-packages/urllib3/connectionpool.py\", line 398, in _make_request",
" conn.request(method, url, **httplib_request_kw)",
" File \"/home/ubuntu/miniconda3/lib/python3.10/site-packages/urllib3/connection.py\", line 239, in request",
" super(HTTPConnection, self).request(method, url, body=body, headers=headers)",
" File \"/home/ubuntu/miniconda3/lib/python3.10/http/client.py\", line 1282, in request",
" self._send_request(method, url, body, headers, encode_chunked)",
@cschin
cschin / example
Created July 8, 2021 16:09
maybe a bug in WFA
❯ ./wfa_adapt
s0 len: 16179, s1 len: 16326 Alignment contains 16168 matches 46 mismatches, 149 insertions, and 2 deletions
The alignment length is not consitent with sequence length:
16168 + 46 + 2 = 16216 != 16179
16168 + 46 + 149 = 16363 != 16326
@cschin
cschin / hosts-yt-ads
Created December 16, 2020 07:33 — forked from ewpratten/hosts-yt-ads
youtube ads hosts file
0.0.0.0 ads.doubleclick.net
0.0.0.0 s.ytimg.com
0.0.0.0 ad.youtube.com
0.0.0.0 ads.youtube.com
0.0.0.0 clients1.google.com
0.0.0.0 dts.innovid.com
0.0.0.0 googleads4.g.doubleclick.net
0.0.0.0 pagead2.googlesyndication.com
0.0.0.0 pixel.moatads.com
0.0.0.0 rtd.tubemogul.com
@cschin
cschin / gist:4c09f2f6888703a6e1e57d782d3244e5
Created July 26, 2020 21:41
A note on evaluating genome assemblies with CHM13 BACs
+ bash getStats.sh chm13_pergrine_p_ctg_cns.fasta
Checking attempted with maximum distance from contig end of 1000 bp..Done
******************* BAC SUMMARY ******************
TOTAL : 341
BP : 51532183
************** Statistics for: chm13_p_ctg_cns.fasta ****************
BACs closed: 321 (94.1349); BACs attempted: 333 %good = 96.3964; BASES 48527269 (94.1689)
Median: 99.9878
MedianQV: 39.1364
Mean: 99.94864
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cschin
cschin / fastareader.py
Created April 7, 2019 14:19
fastareader.py
from os.path import abspath, expanduser
from io import StringIO
import contextlib
import gzip
import re
import subprocess
##
# Utility functions for FastaReader
##
```
$ cat Dockerfile
FROM ubuntu
RUN apt-get update -qq && \
apt-get install -qqy tar gzip curl jq && \
apt-get install -qqy python python-pip vim-tiny less git
RUN pip install httpie requests
RUN apt-get install -qqy curl
RUN mkdir /build && cd /build && curl -s https://nim-lang.org/download/nim-0.17.2.tar.xz > nim-0.17.2.tar.xz && \
tar xvf nim-0.17.2.tar.xz && \
@cschin
cschin / gist:be6c52a08a9535839417
Last active August 29, 2015 14:23
Sunday Day Dream: My Vision for A Quantum Pore DNA Sequencer
I currently work for PacBio as a bioinformatist developing some methods to handle single molecule data and genome assembly properly.
Recently, I feel I am so lacking of vision. I have spent most of my time helping to develop methods in hope that they will be useful for the scientific community to use PacBio data. While we were developing those methods, as far as I could tell, many of those ONT fans had zero vision about them. We openly revealed those methods for the benefit to the scientific community to understand the value of PacBio's and PacBio-like data. We naively assumed ONT would generate some great data with raw single molecule read accuracy > 96% as what Clive presented in 2012 AGBT. If so, those ONT fans would not need to use any of those methods we had developed. After a while, we find out that some of the visionary ONT fans are finally "inspired" to use some of our methods for processing some ONT data and publishing papers to show some values which some of those fan questioned about before. Wit