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 numpy as np | |
# These methods assume that x and y have been normalized by dividing by their maximum value in order | |
# to get xcorr scores comparable to those seen in common Sequest-ish search engines. | |
def xcorr_score(x, y, k=75): | |
'''Based on blogpost by Will Fondrie: | |
https://willfondrie.com/2019/02/an-intuitive-look-at-the-xcorr-score-function-in-proteomics/ | |
''' | |
y_p = y * 0 |
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
cimport cython | |
import numpy as np | |
cimport numpy as np | |
np.import_array() | |
ctypedef cython.floating floating_t | |
ctypedef fused numeric_collection: |
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
/* | |
* levmarq.c | |
* | |
* This file contains an implementation of the Levenberg-Marquardt algorithm | |
* for solving least-squares problems, together with some supporting routines | |
* for Cholesky decomposition and inversion. No attempt has been made at | |
* optimization. In particular, memory use in the matrix routines could be | |
* cut in half with a little effort (and some loss of clarity). | |
* | |
* It is assumed that the compiler supports variable-length arrays as |
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
#!/home/inorton/bin/pywin | |
import comtypes, comtypes.client | |
from ctypes import * | |
from comtypes.automation import * | |
import sys | |
import numpy | |
# GetMassListFromScanNum(long FAR* pnScanNumber, LPCTSTR szFilter, | |
# long nIntensityCutoffType, long nIntensityCutoffValue, | |
# long nMaxNumberOfPeaks, BOOL bCentroidResult, |
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
// Utility | |
function getParameterByName(name) { | |
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); | |
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), | |
results = regex.exec(location.search); | |
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); | |
} | |
// On Ready Handler | |
$(function(){ |
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 sqlitedict | |
import psutil | |
from uuid import uuid4 | |
class ResourceTracker(object): | |
def __init__(self, cpu_usage_total=0, memory_usage_total=0, runtime_total=0, pid=None): | |
self.cpu_total = cpu_usage_total | |
self.memory_total = memory_usage_total | |
self.runtime_total = runtime_total | |
self.pid = pid |
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
var zlib = require("zlib"), | |
fs = require("fs"); | |
var datum = new Buffer(JSON.stringify({cats: [1, 2]})) | |
zlib.gzip(datum, function(error, results){ | |
if (error !== null){ | |
throw error | |
} | |
console.log(results) |
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 os | |
import random | |
import subprocess | |
root_log_dir = "./log_home" | |
def get_random_file_name(length=25): | |
rand_part = ''.join([chr(random.randint(65,122)) for i in range(length)]) | |
return "logfile_%s.txt" % randpart |
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
matrixHierarchicalClustering <- function (x, Rowv = NULL, Colv = if (symm) "Rowv" else NULL, | |
distfun = dist, hclustfun = hclust, reorderfun = function(d, | |
w) reorder(d, w), add.expr, symm = FALSE, revC = identical(Colv, | |
"Rowv"), scale = c("row", "column", "none"), na.rm = TRUE, | |
margins = c(5, 5), ColSideColors, RowSideColors, cexRow = 0.2 + | |
1/log10(nr), cexCol = 0.2 + 1/log10(nc), labRow = NULL, | |
labCol = NULL, main = NULL, xlab = NULL, ylab = NULL, keep.dendro = FALSE, | |
verbose = getOption("verbose"), ...) | |
{ | |
scale <- if (symm && missing(scale)) |
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 csv | |
tsvreader = csv.reader(open('my_file_name', 'rb'), delimiter = '\t') | |
best_matches = [match for match in [line for line in tsvreader] if int(match[2]) == 100] |