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 re | |
def getVocabulary(wordFileName): | |
ret = set() | |
with open(wordFileName) as wordFile: | |
for w in wordFile: | |
ret.add(w.strip()) | |
return ret | |
import string |
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
#' Read a file in chunks | |
#' | |
#' @param theConn providing the data, e.g., file('data/transactions.csv', 'r'). | |
#' @param headers of the data being read. | |
#' @param leftOver rows that were not read but not returned by the previous invocation of this function. | |
#' @param col on which the data is grouped. | |
#' @return a list of two elements: data provided by the current invocation and leftOver to be used during the next invocation. | |
getDataFrameForNextId <- function(theFile, headers, leftOver, col) { | |
while (NROW(leftOver) == 0 || NROW(unique(leftOver[,col])) < 2) { | |
tmp1 <- read.csv(theFile, nrows=100000) |
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 pytest # added | |
from _pytest import runner, _code # added | |
def pytest_runtest_makereport(item, call): | |
when = call.when | |
duration = call.stop-call.start | |
keywords = dict([(x,1) for x in item.keywords]) | |
excinfo = call.excinfo | |
sections = [] | |
if not call.excinfo: |
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
fileSize = 2 ** 16 * 1000 | |
def getStatsWith(closure) { | |
buffSizes = (8..15) | |
iterations = (0..10) | |
buffSize2runtimes = buffSizes.collectEntries { [(2 ** it):[]] } | |
iterations.each { | |
buffSize2runtimes.each { buffSize, runtimes -> | |
runtimes << closure(buffSize) * 1000 / 1024 / 1024 |
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
/* | |
* Run this with ASM 5.1 (http://forge.ow2.org/project/showfiles.php?group_id=23) to generate X.class. | |
* Loading the generated X.class will cause the following error with JDK 9-ea, JDK 1.8.0_112, and Zulu 1.8.0_112. | |
* | |
Error: A JNI error has occurred, please check your installation and try again | |
Exception in thread "main" java.lang.VerifyError: Stack map does not match the one at exception handler 13 | |
Exception Details: | |
Location: | |
X.<init>(LX;)V @13: athrow | |
Reason: |
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
# Python -- v3.6 | |
# https://docs.pytest.org/en/latest/ -- v3.2.1 | |
# http://hypothesis.readthedocs.io/en/latest/ -- v3.7 | |
from hypothesis import assume, given | |
from hypothesis.strategies import text | |
import pytest | |
rep2int = { | |
'1':1, |
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
# python2.7 | |
# | |
# Before using the script, execute the following. | |
# PYTHONPATH=~/.pip easy_install --install-dir=~/.pip intervaltree | |
# PYTHONPATH=~/.pip easy_install --install-dir=~/.pip plac | |
# | |
# To run the script, use the following command | |
# PYTHONPATH=~/.pip python2.7 mapper-par.py <desc> <gff> <bam> <output> | |
# <# cores> |
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
# Python -- v3.6 | |
import begin | |
import multiprocessing | |
import time | |
def worker(varying_data, aux_data): | |
t = 0 | |
for j in range(1, 10000): |
OlderNewer