Skip to content

Instantly share code, notes, and snippets.

View hiraksarkar's full-sized avatar

Hirak Sarkar hiraksarkar

View GitHub Profile
Traceback (most recent call last):
File "pymcjointModel.py", line 148, in <module>
estimateBayesFactor(Data_and_Disp)
File "pymcjointModel.py", line 135, in estimateBayesFactor
H_0, H_1, H_2, H_3 = run_pymc(x_u_r1,y_u_r1,x_t_r1,y_t_r1,r_1,r_2)
File "pymcjointModel.py", line 112, in run_pymc
step = Metropolis()
File "/usr/local/lib/python2.7/dist-packages/pymc3/step_methods/arraystep.py", line 60, in __new__
step.__init__([var], *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pymc3/step_methods/metropolis.py", line 98, in __init__
a = [1,4,5,10]
cache = {}
for i in a:
cache[i] = 1
counter = 0
#okay khub bhalo code hoyeche
def coin(x):
if not x in cache:
@hiraksarkar
hiraksarkar / ncbi_url.py
Created January 12, 2018 19:56 — forked from apfejes/gist:95405620abb347e1abc87d5708dbc003
A script for NCBI SRA downloads.
import argparse
default_prefix = "ftp.sra.ebi.ac.uk/vol1/fastq/"
ascp_prefix = "ftp.sra.ebi.ac.uk:/vol1/fastq/"
default_protocol = "ftp://"
default_suffix = "*.fastq.gz"
default_ascp_line = "ascp -QT -l 300m -i ~/.ssh/asperaweb_id_dsa.openssh anonftp@ftp.ncbi.nlm.nih.gov:{} {}"
def prepare_url(srr_name, prefix):
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hiraksarkar
hiraksarkar / bamfilter_oneliners.md
Created May 30, 2018 14:40 — forked from davfre/bamfilter_oneliners.md
SAM and BAM filtering oneliners
@hiraksarkar
hiraksarkar / spacemacs-cheshe.md
Last active October 1, 2018 16:20 — forked from robphoenix/spacemacs-cheshe.md
Spacemacs Cheat Sheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC f e d - open .spacemacs file
  • SPC f e R - reload .spacemacs file
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
#!/bin/bash
####################################
USAGE: bash auto_sub.sh <QUEUE_LIM> <MAX_JOB_NUM>
###################################
USER="$(whoami)"
MAX_LIMIT=$1
MAX_JOB_NUM=$2
@hiraksarkar
hiraksarkar / dust_python.py
Last active November 26, 2018 08:47
Native dust in python (N.B. This is not accelerated sdust)
from collections import deque
import itertools
# Make dictionary of triplets
i = 0
triplet_index = {}
inverse_triplet = {}
for x in list(itertools.product(['A','T','G','C'], repeat=3)):
triplet_index[''.join(x)] = i
inverse_triplet[i] = ''.join(x)
#From stackoverflow
def get_merged_intervals(intervals):
sorted_by_lower_bound = sorted(intervals, key=lambda tup: tup[0])
merged = []
for higher in sorted_by_lower_bound:
if not merged:
merged.append(higher)
else:
lower = merged[-1]
@hiraksarkar
hiraksarkar / read_binary_gzipped.cpp
Created December 14, 2018 18:45
Read Binary data file without boost support (using zstr header)
#include <iostream>
#include <fstream>
#include <sstream>
#include <functional>
#include <sys/stat.h>
#include <memory>
#include <vector>
#include <numeric>
#include "zstr.hpp"