Skip to content

Instantly share code, notes, and snippets.

View gokceneraslan's full-sized avatar

Gökçen Eraslan gokceneraslan

View GitHub Profile
@gokceneraslan
gokceneraslan / normalize-showoverlaptable.diff
Created May 15, 2012 10:55
Normalization patch for showOverlapTable function of ProDy.
diff --git a/prody/dynamics/plotting.py b/prody/dynamics/plotting.py
index 994f5f2..c5d54cf 100644
--- a/prody/dynamics/plotting.py
+++ b/prody/dynamics/plotting.py
@@ -511,7 +511,7 @@ def showCrossProjection(ensemble, mode_x, mode_y, scale=None, *args, **kwargs):
return show
-def showOverlapTable(rows, cols, *args, **kwargs):
+def showOverlapTable(rows, cols, **kwargs):
@gokceneraslan
gokceneraslan / ch.py
Last active September 28, 2017 08:48
yenimahalle-cankaya-kecioren fetcher/parser/nicer/dicer
#!/usr/bin/env python
import urllib2 as ul
from lxml import etree
def parse_votes(url):
doc = ul.urlopen(url).read()
tree = etree.HTML(doc)
res = {}
@gokceneraslan
gokceneraslan / plotlabels.R
Created June 16, 2014 14:32
Code snippet in R to produce clustering results through parallel coordinates
# labels is a NxL data.frame where N=number of observations being clustered and
# L = number of clustering results (number of vertical lines)
plot.label.distribution <- function(labels,
groupColumn,
alphaLines = 1/10,
useSplines = T,
showPoints = T,
scale='uniminmax', ...) {
@gokceneraslan
gokceneraslan / binsignal.R
Created March 5, 2015 07:21
Bin signal in a given matrix
bin.signal <- function(data, bin.width) {
if (is.matrix(data)) data <- list(data)
lapply(data, function(d) {
window.size <- ncol(d)
res <- t(apply(d, 1, function(row) {
sapply(seq(1, window.size, bin.width), function(s) sum(row[s:(s+bin.width-1)]))
}))
colnames(res) <- paste0('bin', seq_len(ncol(res)))
res

Keybase proof

I hereby claim:

  • I am gokceneraslan on github.
  • I am gokcen (https://keybase.io/gokcen) on keybase.
  • I have a public key whose fingerprint is 8755 72CC F7D6 DF05 0C63 8DCF 47D6 92B1 11C3 8A5F

To claim this, I am signing this object:

@gokceneraslan
gokceneraslan / imputeknn.R
Created September 5, 2017 20:51
Super cool t-kernel and kNN based imputation method for scRNA-seq data
library(FNN)
library(parallel)
# cnt: cell x gene matrix (can be raw count or library size normalized, but not log transformed)
impute <- function(cnt, k=30, cores=6, pca.dim=100) {
print(paste0('Starting imputation with ', nrow(cnt), ' cells and ', ncol(cnt), ' genes...'))
print('Performing PCA...')
pca <- prcomp(log(cnt+1), center = T, rank.=pca.dim)$x
import os
import numpy as np
import pandas as pd
import plotnine as p9
from tqdm import tqdm
import torch
from torch.autograd import Variable
from torch.utils.data import TensorDataset, DataLoader
import numpy as np
import pandas as pd
import plotnine as p9
import torch
from torch.autograd import Variable
from torch.utils.data import TensorDataset, DataLoader, Dataset
np.random.seed(555)
torch.manual_seed(555)
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.