Skip to content

Instantly share code, notes, and snippets.

View davebridges's full-sized avatar

Dave Bridges davebridges

View GitHub Profile
@davebridges
davebridges / mousedb_access.R
Last active June 13, 2019 17:09
Code for extracting data from mousedb
#To use this you must supply:
#a cohort_id number
#an output datafile ('something.csv')
#the api_key to access the database
#for example:
#raw_data_file <- "Raw MRI Data.csv"
#cohort_id <- 35
#api_key <- 'SEE SLACK FOR THE API KEY'
@davebridges
davebridges / sample mapping code
Last active August 29, 2015 14:11
Sample mapping code
library(biomaRt)
ensembl=useMart("ensembl")
#show possible datasets
listDatasets(ensembl)
#your results are listed here
dataset <- read.csv('Hits_PvsM_HighinMimic_filt.csv')
#you have several different ensembl results
unique(substr(dataset$Gene, 1,7))
@davebridges
davebridges / counts_table.R
Created November 21, 2012 14:15
Generate Exon and Transcript Counts Table
require(GenomicFeatures)
require(biomaRt)
#set this to where your tophat_out directory is.
working_directory = "/some_directory/"
setwd(working_directory)
#make a database of transcripts from the ensembl assembly
#first get the current release 69 from ensembl, change this to your species if not using mice
txdb <- makeTranscriptDbFromBiomart(biomart="ensembl",dataset = 'mmusculus_gene_ensembl')
#make exon and transcript annotation objects
save(txdb, file="txdb.Robject")
@davebridges
davebridges / django-model-tests.py
Created September 23, 2012 13:40
Sample ModelTests for a Django App
"""
This package contains the unit tests for the :mod:`app` app.
There are tests for each model in this app.
"""
from django.test import TestCase
from django.test.client import Client
from django.contrib.auth.models import User
@davebridges
davebridges / django-view-tests.py
Created September 7, 2012 13:48
Sample View Tests for a Django App
"""This file contains tests for views."""
import datetime
from django.test import TestCase
from django.test.client import Client
from django.contrib.auth.models import User
from app.models import SampleModel