Skip to content

Instantly share code, notes, and snippets.

@davidliwei
davidliwei / getinsertsize.py
Last active October 25, 2022 06:15
Estimating NGS paired-end read insert size (or fragment length) from SAM/BAM files
#!/usr/bin/env python
'''
Automatically estimate insert size of the paired-end reads for a given SAM/BAM file.
Usage: getinsertsize.py <SAM file> or samtools view <BAM file> | getinsertsize.py -
Author: Wei Li
Copyright (c) <2015> <Wei Li>
library(cn.mops)
library(RUnit)
tumor_gr <- getReadCountsFromBAM("tumorA.chr4.bam",
refSeqName="chr4",WL=10000,mode="unpaired")
normal_gr <- getReadCountsFromBAM("normalA.chr4.bam",
refSeqName="chr4",WL=10000,mode="unpaired")
ref_analysis_norm0 <- referencecn.mops(tumor_gr, normal_gr,norm=0)
library(cn.mops)
library(RUnit)
tumor_gr <- getReadCountsFromBAM("tumorA.chr4.bam",
refSeqName="chr4",WL=10000,mode="unpaired")
normal_gr <- getReadCountsFromBAM("normalA.chr4.bam",
refSeqName="chr4",WL=10000,mode="unpaired")
# We need a special normalization because the tumor has made large CNVs
X <- tumor_gr
@PoisonAlien
PoisonAlien / rna_seq_variant_pipeline.sh
Created August 7, 2015 09:35
RNA seq Variant calling pipeline according to gatk best practices
#!/bin/bash
#
# AUTHOR: Anand M.
# RNA-Seq variant calling pieline accoring to GATK Best practices.
# https://www.broadinstitute.org/gatk/guide/article?id=3891
#
# Call with following arguments
# bash rna_seq_variant_pipeline.sh <Input_Reads1.fq.gz> <Input_Reads2.fq.gz> <output_basename>
#
# Assumes STAR aligner is under path
@PoisonAlien
PoisonAlien / oncotate.r
Last active February 18, 2019 16:13
Takes variants as input and annotates them using borads oncotator api (http://www.broadinstitute.org/oncotator/). Output is a dataframe of annotated variants in maf format.
# Usage
#
# oncotate(maflite, header = FALSE, basename = NULL)
# Arguments
#
# maflite
# input tsv file with chr, start, end, ref_allele, alt_allele columns. (rest of the columns, if present will be attached to the output maf)
#
# header
# logical. Whether input has a header line. Default is FALSE.
@ckandoth
ckandoth / ensembl_vep_86_with_offline_cache.md
Last active July 15, 2021 16:26
Install Ensembl's VEP v86 with various caches for running offline

Ensembl's VEP (Variant Effect Predictor) is popular for how it picks a single effect per gene as detailed here, its CLIA-compliant HGVS variant format, and Sequence Ontology nomenclature for variant effects.

To follow these instructions, we'll assume you have these packaged essentials installed:

## For Debian/Ubuntu system admins ##
sudo apt-get install -y build-essential git libncurses-dev

## For RHEL/CentOS system admins ##
sudo yum groupinstall -y 'Development Tools'
sudo yum install -y git ncurses-devel