Skip to content

Instantly share code, notes, and snippets.

View timbitz's full-sized avatar

Tim Sterne-Weiler timbitz

View GitHub Profile
@timbitz
timbitz / principal_ratio.py
Last active May 30, 2018 05:49
principal_ratio.py
# run function from split line
def tabs_principal_ratio(tabs):
if tabs[-2] != "NA" and tabs[-3] != "NA" and tabs[-2] != "Exc_Paths" and tabs[-3] != "Inc_Paths":
return principal_ratio( tabs[-2], tabs[-3] )
# run function from last and second to last columns (must be validated already)
def principal_ratio( incl_col, excl_col ):
def arr_of_psi( string ):
ret = []
coms = string.split(',')
@timbitz
timbitz / Parallel_Seqops.jl
Last active November 7, 2017 19:58
Bitwise parallel implementations of gc_content and hasambiguity
import BioSequences: index, offset, bitindex
function parallel_gc_content( seq::BioSequence )
gc = 0
s = bitindex(seq, 1)
e = bitindex(seq, length(seq))
for i in index(s):index(e)
@inbounds data = seq.data[i]
# mask nucleotides upstream of first(seq.part)
if i == index(s)