Skip to content

Instantly share code, notes, and snippets.

View dakl's full-sized avatar
💌
ML Engineer @ Epidemic Sound

Daniel Klevebring dakl

💌
ML Engineer @ Epidemic Sound
  • Epidemic Sound
  • Stockholm
View GitHub Profile
# This function takes A and M-values (or any X and Y )
lowessNormalization <- function(x, y, include = TRUE, line = NULL,
...) {
isFinite <- (is.finite(x) & is.finite(y))
if (any(isFinite)){
if (is.null(line)) {
line <- lowess(x[isFinite & include], y[isFinite &
include], ...)
}
y[isFinite] <- y[isFinite] - approx(line, xout = x[isFinite],
lowessNormalization <- function(x, y, include = TRUE, line = NULL,
...) {
isFinite <- (is.finite(x) & is.finite(y))
if (any(isFinite)){
if (is.null(line)) {
line <- lowess(x[isFinite & include], y[isFinite &
include], ...)
}
y[isFinite] <- y[isFinite] - approx(line, xout = x[isFinite],
ties = mean)$y
lowessNormalization <- function(x, y, include = TRUE, line = NULL,
...) {
isFinite <- (is.finite(x) & is.finite(y))
if (any(isFinite)){
if (is.null(line)) {
line <- lowess(x[isFinite & include], y[isFinite &
include], ...)
}
y[isFinite] <- y[isFinite] - approx(line, xout = x[isFinite],
ties = mean)$y
# filter flags
ff <- function(f, flags){
## if !all(dim(mat) == dim(flags)) break say "data and flags must have identical dimensions"
for(k in 1:ncol(f)){
idx.flags <- which( flags[,k] < 0 )
f[idx.flags,k] <- NA
cat("Number features filtered on slide ", k, ": ", length(idx.flags), "\n", sep="")
}
f
}
@dakl
dakl / -
Created September 24, 2014 07:04
From 5f60239292d8d963997aeb14201e2e9eb2635c63 Mon Sep 17 00:00:00 2001
From: Daniel Klevebring <daniel.klevebring@gmail.com>
Date: Wed, 24 Sep 2014 06:42:15 +0000
Subject: [PATCH] added quotes around to build on centos 6.5
---
Analysis/CMakeLists.txt | 2 +-
buildTools/cmake/CMakeLists.compiler.txt | 4 ++--
buildTools/cmake/CMakeLists.dependencies.txt | 26 +++++++++++++-------------
buildTools/cmake/CMakeLists.version.txt | 6 +++---
circle <- function(x, y, r, ...) {
ang <- seq(0, 2*pi, length = 100)
xx <- x + r * cos(ang)
yy <- y + r * sin(ang)
polygon(xx, yy, ...)
}
venndia <- function(A, B, C, alab="A", blab="B", clab="C", getdata=FALSE, cex.text=2, cex.num=2, plot=TRUE, xlim=c(0,9), ylim=c(0,9), ...){
cMissing <- missing(C)
if(cMissing){ C <- c() }
@dakl
dakl / brew install sailfish -v
Created October 23, 2014 11:56
log from running `brew install sailfish -v`
$ brew install sailfish -v
tbb: OS X Lion or newer is required.
==> Downloading https://github.com/kingsfordgroup/sailfish/releases/download/v0.6.2/Sailfish-0.6.2-Source.tar.gz
Already downloaded: /home/kleve/.cache/Homebrew/sailfish-0.6.2.tar.gz
==> Verifying sailfish-0.6.2.tar.gz checksum
tar xf /home/kleve/.cache/Homebrew/sailfish-0.6.2.tar.gz
==> cmake .. -DCMAKE_INSTALL_PREFIX=/gulo/glob/kleve/private/linuxbrew/Cellar/sailfish/0.6.2 -DCMAKE_BUILD_TYPE=None -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_VERBOSE_MAKEFILE=ON -Wno-dev
-- The C compiler identification is GNU 4.9.1
-- The CXX compiler identification is GNU 4.9.1
-- Check for working C compiler: /gulo/glob/kleve/private/linuxbrew/bin/gcc-4.9
# This function sorts the matrix for better visualization of mutual exclusivity across genes
memoSort <- function(M) {
geneOrder <- sort(rowSums(M), decreasing=TRUE, index.return=TRUE)$ix;
scoreCol <- function(x) {
score <- 0;
for(i in 1:length(x)) {
if(x[i]) {
score <- score + 2^(length(x)-i);
}
}
#!/usr/bin/perl
use strict;
######################################################
# vcfsorter.pl
#
# Copyright (C) 2011 German Gaston Leparc
#
# sorts VCF by reference genome
#
#Define the list of machines
machines = {
:reportcreatormahcine => {
:hostname => "reportcreatormahcine",
:ipaddress => "10.10.10.99" #gretzky
},
}
#--------------------------------------
# General provisioning inline script