Skip to content

Instantly share code, notes, and snippets.

# Stephen Turner
# http://StephenTurner.us/
# http://GettingGeneticsDone.blogspot.com/
# See license at http://gettinggeneticsdone.blogspot.com/p/copyright.html
# Last updated: Tuesday, April 19, 2011
# R code for making manhattan plots and QQ plots from plink output files.
# manhattan() with GWAS data this can take a lot of memory, recommended for use on 64bit machines only, for now.
# Altnernatively, use bmanhattan() , i.e., base manhattan. uses base graphics. way faster.
@donny-dont
donny-dont / aligned_allocator.cpp
Created December 13, 2011 09:11
An aligned allocator for placing SIMD types in std::vector
#ifdef _WIN32
#include <malloc.h>
#endif
#include <cstdint>
#include <vector>
#include <iostream>
/**
* Allocator for aligned data.
@PhDP
PhDP / randgsl.c
Created April 12, 2012 11:13
Random numbers with gsl
//: clang -DHAVE_INLINE -O3 randgsl.c -o randgsl -lgsl -lgslcblas
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
int main(int argc, const char *argv[])
@geofferyzh
geofferyzh / gist:2494809
Created April 26, 2012 00:39
Similarity Metrics Calculation in R (LLR,Correlation,Vector,Tanimoto)
##########################################################################
# -----------------------------------------------------------------------#
# -------------------- Similarity Metrics (CF) --------------------------#
# ---------------------Author: Shaohua Zhang ---------------------------#
##########################################################################
# sample data 1
Mov1 <- c(4,4,3,4,2)
Mov2 <- c(NA,2,NA,4,1)
@romainfrancois
romainfrancois / biglist.cpp
Created October 23, 2013 12:15
create lists with more than 20 elements
#include <Rcpp.h>
using namespace Rcpp ;
template <typename T>
inline void set_item_impl( List& target, int i, const T& obj, CharacterVector& names, traits::true_type ){
target[i] = obj.object ;
names[i] = obj.name ;
}
template <typename T>
@romainfrancois
romainfrancois / gist:7117691
Last active April 12, 2020 17:22
create list with more than 20 elements (different syntax)
#include <Rcpp.h>
using namespace Rcpp ;
template <typename T>
inline void set_item_impl( List& target, int i, const T& obj, CharacterVector& names, traits::true_type ){
target[i] = obj.object ;
names[i] = obj.name ;
}
template <typename T>
@gizmaa
gizmaa / Plot_Examples.md
Last active June 10, 2024 02:44
Various Julia plotting examples using PyPlot
@rsobik
rsobik / boost.sh
Created November 17, 2013 13:20
Build Boost 1.55.0 for iOS 7 and OS X including 64 Bit
#===============================================================================
# Filename: boost.sh
# Author: Pete Goodliffe
# Copyright: (c) Copyright 2009 Pete Goodliffe
# Licence: Please feel free to use this, with attribution
# Modified version
#===============================================================================
#
# Builds a Boost framework for the iPhone.
# Creates a set of universal libraries that can be used on an iPhone and in the
@trestletech
trestletech / server.R
Last active May 25, 2017 21:30
An example of doing prolonged, iterative computation in Shiny.
library(shiny)
shinyServer(function(input, output, session) {
# The number of iterations to perform
maxIter <- 50
# Track the start and elapsed time
startTime <- Sys.time()
output$elapsed <- renderText({
These code snippets have been tested on R 3.1.0 and Mac OS 10.9.3. They presumably do *not* work on R 2.X!
## Enter these commands in the Mac OS Terminal
# use faster vecLib library
cd /Library/Frameworks/R.framework/Resources/lib
ln -sf /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Versions/Current/libBLAS.dylib libRblas.dylib
# return to default settings
cd /Library/Frameworks/R.framework/Resources/lib