Skip to content

Instantly share code, notes, and snippets.

@mtandon09
mtandon09 / README.md
Last active May 8, 2020 03:54
Calculate variant allele frequencies of common mouse variants

Strain-specific variant allele frequencies in mice

This script does the following:

  1. Download mouse SNPs by strain provided by Sanger
  2. Break up the SNP VCF by chromosome
  3. For each site in each chromosome, the alternate allele frequency is calculated from the DP4 format tag as (DP4[3]+DP4[4])/sum(DP4[1..4])
  4. Merge the chromosome data to tab-separated values

Notes

@mtandon09
mtandon09 / Readme.md
Last active November 21, 2023 22:29
Automatically install missing R packages

Automatically install missing R packages

Motivation

When running shiny apps in RStudio using runGitHub(), I often found that the app would crash if required libraries couldn't be loaded. For complex apps, this was frustrating because it was difficult to know which libraries were required unless there's good documentation and/or code layout.

But this is a common problem when sharing code in general. So this little script was my own attempt at a solution.

Note: The pacman package has a similar motivation. But as far as I can tell, it requires loading libraries with the p_load function. So you could probably just recursively replace library or require calls with p_load as an alternative to this solution.

@mtandon09
mtandon09 / ccbr_seqlogo.png
Last active February 7, 2021 02:23
Acronym as Sequence Logo
ccbr_seqlogo.png