Skip to content

Instantly share code, notes, and snippets.

View ameintjes's full-sized avatar

Ayton Meintjes ameintjes

View GitHub Profile
@BlakeGardner
BlakeGardner / install nano.sh
Last active July 8, 2024 03:56
Syntax highlighting in nano on Mac OS
# Last updated May, 2024 for Apple silicon Macs
# Install Homebrew if you don't already have it: https://brew.sh
# install nano from homebrew
brew install nano nanorc
# update your nanorc file
echo 'include "'"$(brew --cellar nano)"'/*/share/nano/*.nanorc"' >> ~/.nanorc
# close and re-open your terminal and you'll have syntax highlighting
@idan
idan / gist:c27b2dd45a78273af848
Created October 8, 2014 13:13
Exploding Postgres HSTORE columns in Pandas
def explode_hstore(df, column):
"""Explode a column of a dataframe containing PostgreSQL hstore k-v pairs in the format of:
"foo"=>"bar", "baz"=>"quux", ...
Every key becomes a column. If a given row's pairs doesn't have a key, then the resulting column's value
will contain NaN.
"""
# split the tags column out as a new series, and break up each k=>v pair
s = df[column].str.split(', ').apply(pd.Series, 1).stack()
@tuxfight3r
tuxfight3r / 01.bash_shortcuts_v2.md
Last active July 28, 2024 08:25
Bash keyboard shortcuts

Bash Shortcuts

visual cheetsheet

Moving

command description
ctrl + a Goto BEGINNING of command line
@pbugnion
pbugnion / ipython_notebook_in_git.md
Last active October 22, 2023 12:25
Keeping IPython notebooks under Git version control

This gist lets you keep IPython notebooks in git repositories. It tells git to ignore prompt numbers and program outputs when checking that a file has changed.

To use the script, follow the instructions given in the script's docstring.

For further details, read this blogpost.

The procedure outlined here is inspired by this answer on Stack Overflow.

Byobu is a suite of enhancements to tmux, as a command line
tool providing live system status, dynamic window management,
and some convenient keybindings:
F1 * Used by X11 *
Shift-F1 Display this help
F2 Create a new window
Shift-F2 Create a horizontal split
Ctrl-F2 Create a vertical split
Ctrl-Shift-F2 Create a new session
@mattvonrocketstein
mattvonrocketstein / README.md
Last active August 21, 2019 16:21
neo4j setup with vagrant/ansible

Clone this gist into the working directory

git clone git@github.com:96670d2eb66a8ad9854b6f52a2b5339c.git vagrant-ansible-neo
cd vagrant-ansible-neo

Install the neo4j role into the working directory

ansible-galaxy install julienroubieu.neo4j -p .

Bring up the vagrant box

@sbamin
sbamin / sracmd
Last active December 5, 2022 15:35
Interact with NCBI SRA using aspera ascp command line client
#!/bin/bash
## Wrapper to interact with NCBI SRA using aspera ascp command line interface
## v 2.5 | 04/2017
## @sbamin
# More info: http://download.asperasoft.com/download/docs/ascp/2.7/html/
# usage
show_help() {
@dmig
dmig / mongod.json
Created May 13, 2018 06:10
lnav MongoDB log format
{
"mongod_log": {
"title": "MongoDB server log format",
"regex": {
"main": {
"pattern": "^(?<timestamp>\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}[,\\.]\\d+\\+\\d+)\\s+(?<level>\\w)\\s+(?<component>\\w+|-)\\s+\\[?(?<context>-?\\w+)?\\]\\s+(?<body>.*)$"
}
},
"level": {
"critical": "F",
@elowy01
elowy01 / BCFtools cheat sheet
Last active June 29, 2024 05:24
BCFtools cheat sheet
*bcftools filter
*Filter variants per region (in this example, print out only variants mapped to chr1 and chr2)
qbcftools filter -r1,2 ALL.chip.omni_broad_sanger_combined.20140818.snps.genotypes.hg38.vcf.gz
*printing out info for only 2 samples:
bcftools view -s NA20818,NA20819 filename.vcf.gz
*printing stats only for variants passing the filter:
bcftools view -f PASS filename.vcf.gz

Preimputation steps

Read the Sanger How-to page to make sure your vcf file meets all the requirements for Sanger imputation.

The preimputation steps for UMichigan and Sanger are relatively similar. The main difference is that VCF files are not split by chromosome under sanger imputation. I recommend carrying out the Michigan preimputation steps anyways. If you have already carried out the preimputation steps for U Mich imputation then the only other requirement will be to merge the chr.vcf files into one vcf file and sort the result.

#merge vcf files from list of files
bcftools concat --file-list ~/preimputation/vcf_list.txt -o merged.vcf
gzip merged.vcf