Skip to content

Instantly share code, notes, and snippets.

View DannyArends's full-sized avatar

Danny Arends DannyArends

View GitHub Profile
@DannyArends
DannyArends / gist:1729221
Created February 3, 2012 09:22
Install the latest R version on Debian

Install R on Debian

Add the following debian source provider to /etc/apt/sources.list

    deb-src http://cran.r-project.org/bin/linux/debian squeeze-cran/

Download the KEY from Johannes Ranke (CRAN Debian archive)

@DannyArends
DannyArends / gist:1809392
Created February 12, 2012 16:13
Unittests in D-coding repos

D-coding unittest, needs to import

    import std.stdio;
    import std.conv;
    import std.string;

The unittest layout:

@DannyArends
DannyArends / RqtlTutorial.md
Created February 21, 2012 15:13
Small demo tutorial for R/qtl

R and R/qtl tutorial

Loading example data

R/qtl provides many example data sets in several species and crosses. After loading the package by using either a library() or require() call, these can be loaded into the work space by using the data() function. To load the hyper data set containing measurements on hypertension in mice give the following commands in the R interpreter:

 library(qtl) #Load the R/qtl library
@DannyArends
DannyArends / gist:1950648
Created March 1, 2012 15:53
PBS and Maui config
#Stop maui
ps -ef | grep maui
kill <pid>
#Start maui
/usr/local/maui/sbin/maui
#Terminate PBS quick n dirty
qterm -t quick
@DannyArends
DannyArends / callR.d
Created April 2, 2012 13:50
Calling into R (R.dll/ Rlib.so/ Rlib.dylib) from the D programming language
/**
A minimal example to use the random number generator of R (calling into Rlib.so from D)
dmd test_rlib.d ; ./test_rlib
It is a copy of the C code I wrote for BioLib
(c) Pjotr Prins, 2012
Win32 support was added by Danny Arends
See the latest version at: https://github.com/pjotrp/qtlHD/blob/master/src/D/test/rlib/test_rlib.d
*/
module test.rlib.test_rlib;
@DannyArends
DannyArends / gist:2932914
Created June 14, 2012 20:58
Though about the cross
import std.stdio;
interface CrossDef{
abstract int init();
abstract int emit();
}
class RIL : CrossDef{
int init(){ return 1; }
int emit(){ return 2; }

Reset to the commit before the wrong one

 git reset YYY --hard
 git push origin master --force

Update to the current 'blessed repos'

 git pull molgenis master

Get any commits we did AFTER the wrong one

@DannyArends
DannyArends / gist:3526430
Created August 30, 2012 11:10
Sine and Cosine using CTFE
module cordicalgorithm;
import std.traits, std.conv;
immutable PI = 3.14159265359;
immutable trigono = gen_trigonometric!double();
pure int degreeloop(int deg){
while(deg < 0 || deg >= 360){
(deg < 0) ? deg += 360 : deg -= 360;
@DannyArends
DannyArends / gist:3560459
Created August 31, 2012 22:51
Code for my second blog post on CTFE in D 2/0
module rotationmatrices;
import std.stdio;
import cordicalgorithm;
struct mat(T = float){
T[][] data;
pure mat!T opBinary(string op)(mat!T rhs){
static if (op == "*" || op == "+" || op == "-"){
@DannyArends
DannyArends / .gitignore
Last active December 18, 2015 06:59
Some code to test 4store. Store r/qtl cross object as N3 formatted file. We then use 2 shell commands (printed by R): (1) converts n3 to rdf, (2) upload to the 4store database using curl. After this we can use: 'rdmd tripleStore.d' to query the triple store.
*~
*.rdf
*.n3