Skip to content

Instantly share code, notes, and snippets.

View bow's full-sized avatar

Wibowo Arindrarto bow

View GitHub Profile
@bow
bow / Vagrantfile
Last active November 23, 2021 09:49
Stock Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API version
VAGRANTFILE_API = 2
# Set global VM name.
VM_NAME = ENV["VM_NAME"] || "stock"
# Environment-variable controlled config values with some defaults
@bow
bow / handy.sql
Last active April 19, 2018 12:29
Handy PostgreSQL queries
-- View index sizes and some of their stats, largest first.
SELECT idx.relname AS table_name,
idx.indexrelname AS index_name,
pg_size_pretty(pg_relation_size(cls.oid)) AS size,
cls.reltuples AS num_tuples,
idx.idx_scan AS num_scanned,
idx.idx_tup_read AS num_read,
idx.idx_tup_fetch AS num_fetched
FROM pg_stat_user_indexes idx,
pg_class cls,
@bow
bow / cli_argparse.py
Last active April 25, 2018 12:29
Python CLI templates
#!/usr/bin/env python
"""
One-line description.
More elaborate description.
"""
import argparse
@bow
bow / bioinf-format-gotchas.md
Created April 5, 2017 20:05
Bioinformatics file format-specific quirks
  • Coordinates are one-based, fully closed (i.e. position start at 1 and an interval's end position is included).
  • (for files released by GENCODE & Ensembl) CDS include start_codon but not stop_codon. stop_codon is included in the UTR instead.
  • Coordinates are zero-based, half open (i.e. position start at 0 and an interval's end position is not included).
  • (for refFlat.txt.gz file available via UCSC) CDS does include start and stop codons
@bow
bow / get_ucsc_rrna.sh
Last active November 23, 2021 09:50
Retrieve rRNA regions in the UCSC rmsk track as BED file
#!/usr/bin/env sh
# Script for retrieving rRNA regions denoted in UCSC as a BED file.
# Requirements: mysql and an internet connection.
GENOME_BUILD=${GENOME_BUILD:-hg38}
mysql --user=genome --host=genome-mysql.cse.ucsc.edu -A --column-names=FALSE << QUERY
USE ${GENOME_BUILD};
SELECT genoName, genoStart, genoEnd, repName, swScore, strand
@bow
bow / pip_deps.sh
Last active November 23, 2021 09:51
Retrieve all dependencies in a requirements.txt file in one line
for dep in `cat requirements.txt | grep -v git | sed 's/=.\+//g'`; do pip show $dep | grep Requires | sed 's/Requires: //g' | tr ", " "\n" | sed '/^$/d'; done | sort | uniq
@bow
bow / cigar_slice.py
Last active November 23, 2021 09:51
Slice CIGAR strings
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Wibowo Arindrarto <bow@bow.web.id>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
@bow
bow / conda-env.yml
Last active November 23, 2021 09:52
Extract VEP consequence table
name: vep-consequence-extract
dependencies:
- beautifulsoup4=4.4.1=py35_0
- libxml2=2.9.3=0
- libxslt=1.1.28=0
- lxml=3.6.0=py35_0
- openssl=1.0.2h=1
- pip=8.1.2=py35_0
- python=3.5.1=0
- readline=6.2=2
@bow
bow / sym2ensembl.sh
Last active November 23, 2021 09:53
Query the Ensembl Gene ID given its gene symbol
#!/usr/bin/env sh
#
# sym2ensembl.sh
#
# Quick bash script for querying the Ensembl Gene ID given its gene symbol.
#
# Input : file containing gene symbols to query (one per line).
#
# Output: mapping between the gene symbol to its Ensembl Gene ID.
#

Keybase proof

I hereby claim:

  • I am bow on github.
  • I am bow (https://keybase.io/bow) on keybase.
  • I have a public key whose fingerprint is 07EF EC69 6E46 0E86 A036 8C94 D4EF 801C 7A10 C00C

To claim this, I am signing this object: