Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
filename=$1
datafile=$2
IFS=',' # splits rows by commas
while read ID symb chr start stop; do
cat $datafile | awk "(\$2==$chr) && (\$3>=$start) && (\$3<=$stop) {print}"
done < $filename > PGC1_315immunegenetest.txt
@pipitone
pipitone / mincswap
Last active December 30, 2015 10:19
#!/bin/bash
#
# Edits a minc header, swapping occurances of two strings
#
# (e.g. useful if you're trying to swap x/y dimension names)
minc=$1
attr1=$2
attr2=$3
tmpattr=att$RANDOM
#!/usr/bin/env python
obj = open('surface.obj')
_, _, _, _, _, _, np = obj.readline().strip().split()
np = int(np)
vertices=[]
normals=[]
triangles=[]
# np vertices as (x,y,z)
min_x, min_y, min_z = 0, 0, 0
@pipitone
pipitone / mccv
Created February 5, 2014 17:43
Monte Carlo Cross-Validation helper script
#!/bin/bash
#
# Monte Carlo Cross-Validation helper script
#
nfolds=$1
natlases=$2
ntemplates=$3
pool=(input/pool/brains/*.mnc)
function usage {
@pipitone
pipitone / sample_responses.csv
Last active August 29, 2015 14:00
swcarpentry sorting hat
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 1.
Timestamp,Your Name:,Email address:,What is your career stage?,What is your discipline?,"In three sentences or less, please describe your current field of work or your research question.",What OS will you use on the laptop you bring to the workshop?,"With which programming languages, if any, could you write a program from scratch which imports some data and calculates mean and standard deviation of that data?",What best describes how often you currently program?,What best describes the complexity of your programming? (Choose all that apply.),A tab-delimited file has two columns showing the date and the highest temperature on that day. Write a program to produce a graph showing the average highest temperature for each month.,How familiar are you with Git version control?,"Consider this task: given the URL for a project on GitHub, check out a working copy of that project, add a file called notes.txt, and commit the change.",How familiar are you with unit testing and code coverage?,"Consider this task: given a 2
@pipitone
pipitone / charts.Rmd
Last active August 29, 2015 14:02
RMarkdown plots for Nikhil's secret project
Bhagwat-Brain
=============
To view the plots in this document, run the following:
module load R/3.0.2-precise64
From within R, run:
install.packages('knitr')
@pipitone
pipitone / ypnone.yml
Created June 5, 2014 02:26
Ansible playbook replacement for NIS :-)
---
- name: YP
hosts: nis_slave:nis_client
sudo: yes
vars:
- min_uid: 1000
- min_gid: 1000
- nis_master: "{{groups['nis_master'][0]}}"
tasks:
# Basic idea here is we do things in two steps:
@pipitone
pipitone / autocrop+
Created September 22, 2014 19:07
minc-tools autocrop with -nearest_neighbour and -keep_real_range options for mincresample in order to use it on label volumes
#! /usr/bin/perl
#
# autocrop - a program for extracting and manipulating the bounds of a
# MINC volume, with the capability to output parameters for mincresample
# or mincreshape, or a whole new (cropped) MINC volume.
#
# --------------------------------------------------------------------
# Copyright (c) 1994-96 Greg Ward, McConnell Brain Imaging Centre,
# Montreal Neurological Institute, McGill University. Permission to
# use, copy, modify, and distribute this software and its
@pipitone
pipitone / datmerge.R
Last active August 29, 2015 14:16
It merges stuff. So well.
#
#
# ````````````
# ```.......................```
# ```..................................``
# `...........................................``
# `.................................................``
# ``......................................................`
# `............................................................`
# `................................................................`
@pipitone
pipitone / ukf.sh
Last active August 29, 2015 14:18
UKFTractography script
#!/bin/bash
source /etc/profile.d/modules.sh
source /etc/profile.d/quarantine.sh
module load slicer/4.4.0
module load FSL/5.0.7
module load DTIPrep/1.2.4
module load UKFTractography/2015-02-05
if [ -z "$4" ]; then
cat <<EOF