Skip to content

Instantly share code, notes, and snippets.

View atc3's full-sized avatar
😴
💤

Albert Tian Chen atc3

😴
💤
View GitHub Profile
@atc3
atc3 / cons.py
Last active September 26, 2019 14:43
Valdar Sequence Conservation
# Sequence conservation score function, from Valdar 2001 - https://doi.org/10.1002/1097-0134\(20010101\)42:1<108::AID-PROT110>3.0.CO;2-O
import pandas as pd
import numpy as np
# Load substitution matrix (PET91)
# https://doi.org/10.1093/bioinformatics/8.3.275
pet91 = pd.read_csv('pet91.csv', comment='!', index_col=0)
m = pet91
@atc3
atc3 / build_inclusion_list.R
Last active April 29, 2019 14:51
Build XCalibur Inclusion List
# BUILD THERMO XCALIBUR INCLUSION LIST
# returns inclusion list dataframe
build_inclusion_list <- function(
input, # dataframe, with columns:
# `Raw file`, `Modified sequence`, `Retention time`, `Charge`
file='inclusion_list.csv', # output file
rt_width=3, # width, in minutes, of the RT window on either side
mz_decimals=5, # number of decimals to round m/z to
rt_decimals=1, # number of decimals to round RT to
@atc3
atc3 / gist:e42ca11b07832ccbce02
Created July 13, 2015 21:39
Long Polling in React Native
/*--- LONG POLL --*/
/**
* Adapted from http://blog.gospodarets.com/fetch_in_action/
* many thanks!
*/
var MAX_WAITING_TIME = 5000;// in ms
var getJSON = function (params) {
var wrappedPromise = {};
@atc3
atc3 / index.ios.js
Last active August 29, 2015 14:24
React Native - Backbone fetch patch
/**
* patch to make backbone work on react native
* replaces the underlying jQuery API with the whatwg fetch API
* doesn't cover all use cases... but has worked fine with our project
*/
var Backbone = require('backbone');
var _ = require('underscore');
Backbone.sync = function(method, model, options) {