Skip to content

Instantly share code, notes, and snippets.

@indraniel
indraniel / read-file.scm
Created May 12, 2018 15:35
An example file reading script with chicken scheme
#!/usr/bin/env csi -ss
;; An example file reading script with chicken scheme
(use extras)
(define (read-it file)
(let ((fh (open-input-file file)))
(let loop((c (read-line fh)))
(if (eof-object? c)
@indraniel
indraniel / Dockerfile
Last active March 8, 2018 00:06
Dockerfile to install MEDUSA (A Genome Assembler)
FROM ubuntu:16.04
MAINTAINER Pat Minx <pminx@wustl.edu>
# Volumes
VOLUME /build
VOLUME /release
# bootstrap build dependencies
RUN apt-get update -qq && \
apt-get -y install apt-transport-https && \
@indraniel
indraniel / chromecast-scheduler.py
Created December 29, 2017 16:59
Example sending a list of local videos to chromecast
#!/usr/bin/env python
# Based on: https://github.com/piedar/pychromecast/blob/cast/cast.py
# https://github.com/balloob/pychromecast/issues/8
# https://github.com/balloob/pychromecast/issues/154
# https://en.wikipedia.org/wiki/Multicast_DNS
# Copyright 2015 Benn Snyder <benn.snyder@gmail.com>
# Released under MIT license
#
@indraniel
indraniel / Dependencies.scala
Created July 18, 2017 18:48
Goofing around with embedding the scala REPL inside a sbt project
import sbt._
// project/Dependencies.scala
object Dependencies {
lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.0.1"
// lazy val ammonite = "com.lihaoyi" %% "ammonite" % "1.0.0" cross CrossVersion.full
// lazy val scalaCompiler = "org.scala-lang" % "scala-compiler" % scalaVersion.value
lazy val scalaCompiler = "org.scala-lang" % "scala-compiler" % "2.12.1"
lazy val jline = "org.scala-lang.modules" % "scala-jline" % "2.12.1"
@indraniel
indraniel / read-file.scm
Created July 17, 2017 16:49
An example file reading script with chicken scheme
#!/usr/bin/env csi -ss
;; An example file reading script with chicken scheme
(use extras)
(define (read-it file)
(let ((fh (open-input-file file)))
(let loop((c (read-line fh)))
(if (eof-object? c)
@indraniel
indraniel / bstop_myself.pl
Created July 12, 2017 22:47
LSF example to "bstop" a set of jobs
#!/gsc/bin/perl
# this was a test script created by thepler sometime on 2009-04-17
# test by running "bsub ./bstop_myself.pl" at a command prompt
use GSCApp;
App->init;
use Path::Class;
@indraniel
indraniel / get-last-passing-line-in-vcf.sh
Last active July 6, 2017 21:29
example to pass bash associative arrays to functions
#!/bin/bash
# Example usage: bash get-passing-line-in-vcf.sh /gscmnt/gc2758/analysis/ccdg_gatk_callsets/eocad_aa_2017.05.18/post-vqsr/12-concat-vcfs
# programs
BCFTOOLS=/gscmnt/gc2802/halllab/idas/software/local/bin/bcftools1.4
TABIX=/gscmnt/gc2802/halllab/idas/software/local/bin/tabix
SORT=/gscmnt/gc2802/halllab/idas/software/local/bin/lh3-sort
# data
@indraniel
indraniel / 4-identify-and-cleanup-corrupt-cadd-jobs.py
Last active June 8, 2017 21:37
scripts to undo/expunge and redo postvqsr38 pipeline steps (BIO-2310)
#!/usr/bin/env python
from __future__ import print_function, division
import os, sys, re, subprocess, time, datetime, shutil
def log(msg):
timestamp = datetime.datetime.now().strftime("%Y-%m-%d %T")
print('[-- {} --] {}'.format(timestamp, msg), file=sys.stderr)
def touch(fname, times=None):
@indraniel
indraniel / download-1000-genomes-vcf.py
Created May 26, 2017 23:08
Python example to download files from an anonymous FTP server (example case from 1000 Genomes)
#!/usr/bin/env python
from __future__ import print_function
import ftplib, datetime, sys
# ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/release/20130502/ALL.chr14.phase3_shapeit2_mvncall_integrated_v5a.20130502.genotypes.vcf.gz
def log(msg):
timestamp = datetime.datetime.now().strftime("%Y-%m-%d %T")
print('[-- {} --] {}'.format(timestamp, msg), file=sys.stderr)
@indraniel
indraniel / b37-annotate-w-gnomAD.sh
Last active June 30, 2023 03:45
A bash script to annotate a large VCF (i.e. containing many samples) with gnomAD (build 37 edition)
#!/bin/bash
# Usage:
# bash b37-annotate-w-gnomAD.sh </path/to/input.vcf.gz> </path/to/output.vcf.gz>
#
# Note:
# 1. This script with create a "scratch" directory to hold intermediate file
# states created during the annotation process. The scratch directory will
# be created next to the /path/to/outvcf.vcf.gz .
#