Skip to content

Instantly share code, notes, and snippets.

View chapmanb's full-sized avatar

Brad Chapman chapmanb

View GitHub Profile
chrI 230218
chrII 813184
chrIII 316620
chrIV 1531933
chrV 576874
chrVI 270161
chrVII 1090940
chrVIII 562643
chrIX 439888
chrX 745751
@chapmanb
chapmanb / vagrant_pallet.clj
Created June 20, 2011 11:26
Running pallet with manual specification of a server; example with vagrant virtualbox
(ns distblast-cluster.vagrant
(:require [pallet.compute :as compute]
[pallet.phase :as phase]
[pallet.core :as core]
[pallet.utils :as utils]
[pallet.compute.node-list :as node-list]
[pallet.action.exec-script :as exec-script]))
(defn test-script [session]
(-> session
@chapmanb
chapmanb / gist:727625
Created December 3, 2010 21:57
retrieve_gene.py
from Bio import Entrez
def fetch_gene_coordinates(search_term):
handle = Entrez.esearch(db="gene", term=search_term)
rec = Entrez.read(handle)
gene_id = rec["IdList"][0] # assuming best match works
handle = Entrez.efetch(db="gene", id=gene_id, retmode="xml")
rec = Entrez.read(handle)[0]
gene_locus = rec["Entrezgene_locus"][0]
@chapmanb
chapmanb / arvados_add_update.py
Created October 31, 2021 00:15
Example of adding and updating a sequence in Arvados, with required remove/save step to avoid certificate error
def simple_add_update():
"""Test adding and updating a collection to reproduce certificate error.
"""
project_uuid = "pirca-j7d0g-h13mew3i5ya8cqq"
name = "save_new_test"
fname = "seqs.fa"
avoid_an_error = True
arvados_conn = get_connection_config()
c = arvados.collection.Collection(apiconfig=arvados_conn)
with c.open(fname, "wb") as writer:
@chapmanb
chapmanb / tcga_capture.R
Created November 8, 2018 17:29
Query TCGA API for exome capture BED files -- thanks to Sehyun Oh
#!/usr/bin/env Rscript
library(GenomicDataCommons)
library(dplyr)
manifest = GenomicDataCommons::files() %>%
GenomicDataCommons::filter(~ cases.project.project_id == "TCGA-LUAD" &
experimental_strategy == "WXS" &
data_format == "BAM") %>%
GenomicDataCommons::manifest()
with open ("dna.txt", "r") as myfile:
data=myfile.readlines()
mRNA=data[1]
def next_transcript(mRNA, cur_pos):
initial=mRNA.find("AUG", cur_pos)
for i in range(initial, len(mRNA),3):
if mRNA[i:i+3] == "UAG":
return initial, i
sample locus alleles expected validates
NA12878 A HLA-A*01:01;HLA-A*11:01 HLA-A*01:01;HLA-A*11:01 yes
NA12878 B HLA-B*56:01;HLA-B*08:01 HLA-B*08:01;HLA-B*56:01 yes
NA12878 C HLA-C*07:01;HLA-C*01:02 HLA-C*01:02;HLA-C*07:01 yes
NA12891 A HLA-A*24:02;HLA-A*01:01 HLA-A*01:01;HLA-A*24:02 yes
NA12891 B HLA-B*08:01;HLA-B*07:02 HLA-B*07:02;HLA-B*08:01 yes
NA12891 C HLA-C*07:01;HLA-C*07:02 HLA-C*07:01;HLA-C*07:02 yes
NA18526 A HLA-A*24:02;HLA-A*33:03 HLA-A*24:02;HLA-A*33:03 yes
NA18526 B HLA-B*40:01;HLA-B*58:01 HLA-B*40:01;HLA-B*58:01;HLA-B*58:02 no
NA18526 C HLA-C*03:02;HLA-C*07:02 HLA-C*03:02;HLA-C*07:02 yes
@chapmanb
chapmanb / snpeff
Created January 31, 2014 13:25
Bash wrapper script for snpeff
#!/bin/bash
# snpEff executable shell script
# http://snpeff.sourceforge.net/
# Extracts memory and system property Java arguments from the list of provided arguments
# (ie -Xms 1g -Xmx 2g)
jardir="$(cd "$(dirname "$0")" && pwd -P)"
java=java
if [ -e "$JAVA_HOME/bin/java" ]
2-584759 no MET
2-584751 MET (FISH and ddPCR)
2-584699 MET (FISH and ddPCR)
#!/bin/bash
set -eu -o pipefail
export TARGETDIR=`pwd`/anaconda
export BINDIR=`pwd`
wget http://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh
bash Miniconda2-latest-Linux-x86_64.sh -b -p $TARGETDIR
$TARGETDIR/bin/conda install --yes -c conda-forge -c bioconda bcbio-nextgen
$TARGETDIR/bin/conda install --yes -c conda-forge -c bioconda bcbio-nextgen-vm
mkdir -p $BINDIR/bin