Skip to content

Instantly share code, notes, and snippets.

View vsoch's full-sized avatar
💭
rawr

Vanessasaurus vsoch

💭
rawr
View GitHub Profile
@vsoch
vsoch / xls_to_sql.m
Created January 3, 2014 22:05
This script reads in an excel sheet and converts it into sql insert statements. The first row is expected to be the titles for the tables, followed by rows of raw data.
function xls_to_sql(input,sheet,outfile,database,table)
% This script reads in an excel sheet and converts it into sql insert
% statements. The first row is expected to be the titles for the tables,
% followed by rows of raw data.
%-------------------------------------------------------------------------
% INPUT
% input ----- input excel file should be excel file, .xls or .xlsx
% sheet ----- name of sheet to read from
% outfile ----- name of output file (without extension)
@vsoch
vsoch / covcheck_free.m
Created January 3, 2014 22:13
Coverage Checking for SPM Analysis
function covcheck_free()
% COVERAGE CHECKING for SPM ANALYSIS (covcheck_free.m)
% Vanessa Sochat
%
% This script takes in a list of subjects processed in SPM, an ROI mask
% that will be used for group analysis, and a user specified coverage
% percentage. It will calculate the size of a single subject mask and
% determine if the subject has that percentage coverage.
%__________________________________________________________________________
%
@vsoch
vsoch / grabtimeseries.m
Created January 3, 2014 22:22
Creates a matrix of average mean timeseries for each VOI in individual subject folders, separating out VOI name and number of subjects included. This data is then formatted into a csv file to be used to create an interactive chart with Google Charts (Gapminder)
%% GRAB TIMESERIES:
% Creates a matrix of average mean timeseries for each VOI in individual subject folders, separating out VOI name and number of subjects included
% This data is then formatted into a csv file to be used to create an interactive chart with Google Charts (Gapminder)
%% GET DATA TIMESERIES
% Get list of all subjects in Analyzed Folder
anadir = 'path/path/path'; cd(anadir); all = dir;
% These are set in advance so we have control over our charts
@vsoch
vsoch / madlib.py
Created January 3, 2014 22:33
Madlib game for python! Reads in a user selected text file with a story and words to be filled in, words are in the format SUB_ADJECTIVE_SUB, where the ADJECTIVE will get presented to the user to specify the input desired.
#!/usr/bin/python
import sys
import os.path
import re
import datetime
#-MADLIB---------------------------------------------------------------------
@vsoch
vsoch / beerrank.m
Last active January 2, 2016 03:59
beerrank(): takes in a list of beers, ranking criteria, and allows the user to enter rankings and produce a chart of averages and winners! % Created on December 14, 2010 for the LoNG annual Tasting Party! % Creator of script does not drink!
function beerrank()
%-------------------------------------------------------------------------
% beerrank(): takes in a list of beers, ranking criteria, and allows the
% user to enter rankings and produce a chart of averages and winners!
% Created on December 14, 2010 for the LoNG annual Tasting Party!
%-------------------------------------------------------------------------
% RUNNING:
% - should be run with no input arguments
% - will take in a number of beers, and output file name
% if outfile already exists, will append data to next empty row
@vsoch
vsoch / confirmation_email.m
Last active January 2, 2016 04:39
Confirmation and reminder emails for experimental research in Matlab, as well as a script to send brain images to participants.
function confirmation_email(contactemail)
% CONFIRMATION_EMAIL
% Vanessa Sochat
%
% This script sends confirmation emails for imaging and battery appointments
% added to the calendar the previous day.
%
% -------------------------------------------------------------------------
% VARIABLES:
@vsoch
vsoch / compileABASampleMNI.R
Created January 11, 2014 23:15
This script reads in text files with 1) Allen Brain Atlas dataset MNI coordinates for each of 3702 samples, and 2) associated structures and parent structures, and outputs to .RData and .csv files for later analysis
# This script will read in individual brain datasets
# (a MNI coordinate file, and a structure ID file)
# compile into one matrix, and save to both text and Rdata file
# Read in data for each brain, save to matrix
filenames = c("H0351.2002","H0351.2001","H0351.1009","H0351.1012","H0351.1015","H0351.1016")
filey = filenames[1]
MNI = read.csv(paste('data/human_ma_samples_MNI_',filey,'.txt',sep=""),head=FALSE,sep="")
STRUC = read.csv(paste('data/human_ma_samples_region_',filey,'.txt',sep=""),head=FALSE,sep="")
@vsoch
vsoch / mapASD.R
Created February 6, 2014 20:55
mapASD.R: Use the foursquare API to create a resource map for a search term of interest
# foursquareASD will create a map of ASD locations across the United States
library(RJSONIO)
library(RCurl)
options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")))
# First, read in file with latitudes and longitudes of major cities
# Obtained from http://notebook.gaslampmedia.com/download-zip-code-latitude-longitude-city-state-county-csv/
ll = read.csv('zip_codes_states.csv',sep=",",head=TRUE)
@vsoch
vsoch / pseq_startup_script.sh
Created February 7, 2014 21:11
Startup script for pseq-instance on GCE
#!/bin/bash
# Key off existence of the "data" mount point to determine whether
# this is the first boot.
if [[ ! -e /mnt/data ]]; then
# Basic setup - get the JRE installed
apt-get update
apt-get install --fix-broken
mkdir -p /mnt/data
fi
@vsoch
vsoch / geneToKegg.R
Created April 21, 2014 17:22
Convert Gene Symbols to Kegg (KO) identifiers
# This script will convert a list of gene symbols to kegg (KO) identifiers
# We need libraries to read and parse URL
library(RCurl)
options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")))
# Read in file with Gene Symbols
# This is tab separated file with Id, Label, color from Geshi
infile = '/home/vanessa/Desktop/group5[Nodes].csv'
data = read.table(infile,sep="\t",head=TRUE)