Skip to content

Instantly share code, notes, and snippets.

View Puriney's full-sized avatar

Yun YAN Puriney

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Puriney
Puriney / hsmm.R
Created May 16, 2018 20:10
Minimum example to run Monocle2 with either the ICA or a custom function
# load libs
library(monocle)
library(HSMMSingleCell)
library(rsvd)
library(ggplot2)
library(ggpubr)
# load data
data("HSMM_expr_matrix")
data("HSMM_sample_sheet")
@Puriney
Puriney / GP.ipynb
Last active June 21, 2017 01:38 — forked from AustinRochford/GP.iypnb
Bayesian GP PyMC3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Puriney
Puriney / colored_overlay_opencv.ipynb
Created May 29, 2017 16:30
Add colored and transparent overlay on colored or gray image
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Puriney
Puriney / scatter_plot_R.ipynb
Last active May 17, 2017 04:25
R ggplot2 v.s. Python Seaborn: Scatter Plot of Iris dataset (Log10 scale of Y and Color by iris species)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Puriney
Puriney / pandas_sparse_matrix.ipynb
Created May 15, 2017 19:54
Working on sparse matrix in Python: Create Pandas sparse data frame from matrix-market format.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Puriney
Puriney / remove_edge.R
Last active February 14, 2017 03:39
Minimum example to remove edges connecting nodes of interest
set.seed(1234)
g <- sample_gnp(n=10, 0.15) #make_ring(10)
V(g)$name <- letters[1:10]
plot(g)
rm_e <- combinations(n=3, r=2, v=c('b', 'i', 'c'))
rm_e_do <- apply(rm_e, 1, function(r) are.connected(g, r[1], r[2]))
rm_e <- rm_e[rm_e_do, ] %>% apply(., 1, paste, collapse='|')
par(mfrow=c(1, 2))
plot(g)
plot(g - edge(rm_e))
@Puriney
Puriney / fail_loop_ruffus.py
Created August 24, 2016 13:59
Demo of failing run loop in ruffus
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@contact: Yun Yan ([email protected])
"""
from ruffus import *
from helper import *
@Puriney
Puriney / README.md
Last active August 24, 2016 13:20
Mini example of showing intra-package importing

Folder structure:

__init__.py is a blank file.

├── RandInit_HMM_Py
│   ├── __init__.py
│   ├── demoRunPkg.py
│   ├── demoRunIn.py
|.. ├── helper.py
@Puriney
Puriney / demoParallel.py
Last active August 23, 2016 19:52
Run parallel bash jobs in python by multiprocessing and subprocess modules
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
- multiprossing 101
- whether multiprocessing could contain subprocess work
@contact: Yun Yan ([email protected])
"""
import subprocess
from multiprocessing import Pool
import os