Skip to content

Instantly share code, notes, and snippets.

@slowkow
slowkow / README.md
Last active May 10, 2021 22:47
Generate a DESCRIPTION file with all of your installed packages

Problem

We need to install a lot of R packages each time we upgrade to a new version of R.

Solution

  1. Before installing the new R, run Rscript make_description.R to write a list of all installed packages.
  2. Install the new version of R.
  3. Use devtools to reinstall the packages.
@jfeala
jfeala / batch.py
Created April 18, 2017 12:33
AWS Batch wrapper for Luigi
"""
AWS Batch wrapper for Luigi
From the AWS website:
AWS Batch enables you to run batch computing workloads on the AWS Cloud.
Batch computing is a common way for developers, scientists, and engineers
to access large amounts of compute resources, and AWS Batch removes the
undifferentiated heavy lifting of configuring and managing the required
@adefelicibus
adefelicibus / install-samtools-bcftools-and-htslib.md
Last active April 3, 2024 20:49
Install samtools, bcftools and htslib on linux

Install Samtools, BCFTools and htslib on linux

Install some build dependencies

sudo apt-get install autoconf automake make gcc perl zlib1g-dev libbz2-dev liblzma-dev libcurl4-gnutls-dev libssl-dev libncurses5-dev

[samtools]

@dyndna
dyndna / kallisto_install_fixes.md
Created May 11, 2016 02:52
Fix for errors on installing kallisto - cmake, GLIBCXX, GCC, LD LIBRARY PATHS

Install kallisto on HPC

cd kallisto-0.42.5/build
cmake ..

-- The C compiler identification is GNU 4.4.7 -- The CXX compiler identification is GNU 4.4.7 -- Check for working C compiler: /usr/bin/cc

@ckandoth
ckandoth / ensembl_vep_82_with_offline_cache.md
Last active March 29, 2019 18:07
Install Ensembl's VEP v82 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:

sudo yum install -y curl rsync tar make perl perl-core
## OR ##
sudo apt-get install -y curl rsync tar make perl perl-base

You'll also need samtools and tabix in your $PATH, which can be found at htslib.org

@slowkow
slowkow / counts_to_tpm.R
Last active August 12, 2025 20:50
Convert read counts to transcripts per million (TPM).
#' Convert counts to transcripts per million (TPM).
#'
#' Convert a numeric matrix of features (rows) and conditions (columns) with
#' raw feature counts to transcripts per million.
#'
#' Lior Pachter. Models for transcript quantification from RNA-Seq.
#' arXiv:1104.3889v2
#'
#' Wagner, et al. Measurement of mRNA abundance using RNA-seq data:
#' RPKM measure is inconsistent among samples. Theory Biosci. 24 July 2012.
@stephenturner
stephenturner / deseq2-analysis-template.R
Created July 30, 2014 12:20
Template for analysis with DESeq2
## RNA-seq analysis with DESeq2
## Stephen Turner, @genetics_blog
# RNA-seq data from GSE52202
# http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=gse52202. All patients with
# ALS, 4 with C9 expansion ("exp"), 4 controls without expansion ("ctl")
# Import & pre-process ----------------------------------------------------
# Import data from featureCounts
@slowkow
slowkow / coding_lengths.png
Last active March 31, 2025 08:04
Count the number of coding base pairs in each Gencode gene.
coding_lengths.png
@slowkow
slowkow / GTF.py
Last active July 24, 2025 19:02
GTF.py is a simple module for reading GTF and GFF files
#!/usr/bin/env python
"""
GTF.py
Kamil Slowikowski
December 24, 2013
Read GFF/GTF files. Works with gzip compressed files and pandas.
http://useast.ensembl.org/info/website/upload/gff.html