Skip to content

Instantly share code, notes, and snippets.

Handy commands

Extract bam according to a bed file

bedtools intersect -abam path/to/input.bam -b path/to/regions.bed > out.bam

Extract region of a VCF

@mattions
mattions / Exploring different distribution.ipynb
Created July 30, 2013 14:32
Shapes and definition of some statistical PDFs, handy to do some modelling. You can see the rendered version on nbviewer here: http://nbviewer.ipython.org/urls/gist.github.com/mattions/6113437/raw/c5468ea930d6960225d83e112d7f3d00d9c13398/Exploring+different+distribution.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mattions
mattions / gist:2421351
Created April 19, 2012 14:36
Temporary gist for git crash course

================= Git: Crash course

How git is controlled

General config file

FHIR2Metadata bridge

Retrieving the data from the INCLUDE FHIR Data via the FHIR_resource.

Quick help:

 python fhir_trisomy_bridge.py --help
usage: fhir_trisomy_bridge.py [-h] --cavatica_token CAVATICA_TOKEN --cavatica_project CAVATICA_PROJECT
                              --include_fhir_authentication_cookie INCLUDE_FHIR_AUTHENTICATION_COOKIE
@mattions
mattions / sbfs-privileged.sh
Created April 6, 2018 09:42
Seven Bridges Filesystem helper script
# SBFS Privileged helper script
# Allow root to see projects. Needed if you want to use docker
#
# Note: export the $SBG_SBFS_MOUNT_POINT variable in your
# .bashrc
#
# For Example:
# export SBG_SBFS_MOUNT_POINT=~/sbfs_mount_point
# Make sure the `~/sbfs_mount_point` directory exists
#
/*!
* Bootstrap v3.2.0 (http://getbootstrap.com)
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*//*! normalize.css v3.0.1 | MIT License | git.io/normalize */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:cont
@mattions
mattions / parse_git.sh
Last active December 7, 2020 10:54
parse_git function in bash which updates your prompt with the git branch if it is a git repo
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/(\1$(parse_git_dirty))/"
}
export PS1='\u@\h \[\033[1;33m\]\w\[\033[0m\]$(parse_git_branch)$ '
import sevenbridges as sbg
c = sbg.Config(profile='cavatica')
api = sbg.Api(config=c)
bg = api.billing_groups.get(id='14bc19f2-6a6a-4a44-bb07-f86020dad9c0')
breakdown = bg.breakdown()
for project_breakdown in breakdown.project_breakdown:
project_id_parsed = (project_breakdown.href.split("/")[-2:])
project_id = "/".join(project_id_parsed)
print(project_id)
@mattions
mattions / setup.sh
Last active October 25, 2018 14:25 — forked from fracasula/setup.sh
How to install Bluejeans on Ubuntu
sudo apt install alien -y
sudo alien bluejeans_1.28.9-2_amd64.rpm # or whatever is the file you downloaded from the bluejeans website
sudo dpkg -i bluejeans_1.28.9-2_amd64.deb
cd /lib/x86_64-linux-gnu
#sudo ln -s libudev.so libudev.so.0
sudo ln -s libudev.so.1 libudev.so.0
# now you can launch bluejeans
/opt/bluejeans/bluejeans-bin
@mattions
mattions / launch_st_viewer.sh
Last active May 4, 2018 16:06
SBG FS and ST Viewer helper scripts
# Launch the docker container of the latest st_viewer
# Note: We are using the $SBG_SBFS_MOUNT_POINT variable
# You can replace that with the actual path if you do not
# want to use the env variable. Check the `sbfs-privileges.sh`
# file for details.
#
# The mounted projects will be found at `/STDatasets` mount point
# within the docker container
xhost +local:root