This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@contextlib.contextmanager | |
def fasta_sequence(file): | |
with open(file, 'r') as f: | |
f.next() #loose the header row | |
def generator(): | |
for line in f: | |
for char in line.strip(): | |
yield char | |
yield generator() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
def hetrozygosity(reads): | |
base_count = Counter(reads) | |
return 1.0-(float(base_count.most_common(1)[0][1])/sum(base_count.values())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#USAGE: python mat2png FILENAME.mat MATRIXNAME | |
import h5py | |
import sys | |
import png | |
import numpy as np | |
mat = h5py.File(sys.argv[1], 'r') | |
print mat['OutputStructure'].keys() | |
print mat['OutputStructure']['PreProcess'].keys() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Draggable handle='.header' | |
start={initPosition.toObject()} | |
moveOnStartChange={true} | |
onStop={this.handleMoveStop}> | |
<Resizable width={initSize.get('width')} height={initSize.get('height')} | |
minConstraints={[150, 150]} | |
maxConstraints={[500, 300]} | |
onResize={this.handleResize} | |
onResizeStop={this.handleResizeStop}> | |
<div className="popup" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sql>explain select * from "variants" order by "QD" limit 1000; | |
+------------------------------------------------------------------------------------------------------+ | |
| mal | | |
+======================================================================================================+ | |
| function user.s3_1{autoCommit=true}():void; | | |
| X_1124:void := querylog.define("explain select * from \"variants\" order by \"QD\" limit 1000;", | | |
: "default_pipe",6416); : | |
| barrier X_10651 := language.dataflow(); | | |
| X_455 := bat.new(nil:oid,nil:str); | | |
| X_463 := bat.append(X_455,"Ag1000G.variants"); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def dl(path, filename): | |
try: | |
r = requests.get(path, stream=True) | |
if r.status_code == 200: | |
with open(filename, 'wb') as f: | |
for chunk in r: | |
f.write(chunk) | |
print "done", path |
I hereby claim:
- I am benjeffery on github.
- I am benjeffery (https://keybase.io/benjeffery) on keybase.
- I have a public key whose fingerprint is 1C75 E073 EDB5 D3D0 69FB 1D7A 22D6 43C3 578A A838
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function chooseMode(jsProps, cssProps) { | |
if (cssProps.length == 0 && jsProps.length == 0) // IE <10, other early browser, no method works there. In Opera CSS works though | |
return bowser.opera ? 'css' : 'warning'; | |
if (cssProps.length == 0 && jsProps.length > 0) // IE >10 even EDGE... sigh | |
return 'js'; | |
if (cssProps.length == 1 && cssProps[0] == 'optimiseSpeed' && jsProps.length == 0) //A few earlier browsers report this prop, but it only works for images | |
return 'warning'; | |
if (_.includes(cssProps, '-webkit-optimize-contrast') || _.includes(cssProps, '-moz-crisp-edges') || _.includes(cssProps, 'crisp-edges') || _.includes(cssProps, 'pixelated')) { | |
if (!bowser.check({chrome: "41"})) //Earlier chromes only support css on IMG | |
return 'js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
accountsservice/xenial-updates,now 0.6.40-2ubuntu11.3 amd64 [installed] | |
acl/xenial,now 2.2.52-3 amd64 [installed] | |
acpi-support/xenial,now 0.142 amd64 [installed] | |
acpid/xenial,now 1:2.0.26-1ubuntu2 amd64 [installed] | |
add-apt-key/xenial,xenial,now 1.0-0.5 all [installed] | |
adduser/xenial,xenial,now 3.113+nmu3ubuntu4 all [installed] | |
adobe-flashplugin/now 1:20170214.1-0ubuntu0.16.04.1 amd64 [installed,upgradable to: 1:20170616.1-0ubuntu0.16.04.1] | |
adwaita-icon-theme/sarah,sarah,now 3.18.0-2ubuntu3mint2 all [installed] | |
adwaita-icon-theme-full/sarah,sarah,now 3.18.0-2ubuntu3mint2 all [installed] | |
alsa-base/xenial,xenial,now 1.0.25+dfsg-0ubuntu5 all [installed] |
OlderNewer