Skip to content

Instantly share code, notes, and snippets.

View slowkow's full-sized avatar
🐄
moooooo

Kamil Slowikowski slowkow

🐄
moooooo
View GitHub Profile
@slowkow
slowkow / coding_lengths.png
Last active January 11, 2023 23:19
Count the number of coding base pairs in each Gencode gene.
coding_lengths.png
@slowkow
slowkow / ssh-tutorial.md
Last active February 11, 2024 16:48
ssh to a server without typing your password

How to ssh to a remote server without typing your password

Save yourself a few keystrokes. Follow the steps below:

  1. Run this Bash script on your laptop:

    #!/usr/bin/env bash
    

The hostname of your remote server.

@slowkow
slowkow / HapMap.py
Last active October 5, 2021 18:26
Play with HapMap SNP genotype data
#!/usr/bin/env python
"""
HapMap.py
Kamil Slowikowski
February 25, 2014
# Quickly read the data and automatically compute allele frequencies.
>>> from HapMap import HapMap
>>> ceu = HapMap("CEU", "/media/blue/data/EPI511/HapMap3/")
@slowkow
slowkow / zotero-pdf-program.md
Last active June 13, 2018 14:03
Open pdfs in Zotero with a different program than your other pdfs

I want to open pdf files with program A unless it is stored in Zotero, in which case I want to open it program B.

  1. Change the OS settings, so the default program for opening pdf files is the shell script shown below.
  2. Set Zotero preferences to store files in "zotero-data".

Below, I use playonlinux to launch Foxit Reader for my Zotero pdf files because Foxit has nice highlighting and annotation features that I like to use on scientific articles. I use [evince][4] for all other pdf files (figures, books, documents, etc.)

@slowkow
slowkow / gg_qqplot.R
Last active February 20, 2024 19:44
Create a Q-Q plot with ggplot2
#' Create a quantile-quantile plot with ggplot2.
#'
#' Assumptions:
#' - Expected P values are uniformly distributed.
#' - Confidence intervals assume independence between tests.
#' We expect deviations past the confidence intervals if the tests are
#' not independent.
#' For example, in a genome-wide association study, the genotype at any
#' position is correlated to nearby positions. Tests of nearby genotypes
#' will result in similar test statistics.
@slowkow
slowkow / freq.py
Created March 31, 2014 04:07
1000 Genomes SNP allele frequencies in different populations
#!/usr/bin/env python
"""
freq.py
Kamil Slowikowski
March 31, 2014
For each SNP, compute the reference allele frequency in all continental
populations and also in all subpopulations.
This script reads BEAGLE formatted genotypes from the 1000 Genomes Project.
@slowkow
slowkow / gists.py
Created April 2, 2014 03:38
Print an HTML list of your gists
#!/usr/bin/env python
"""
gists.py
Kamil Slowikowski
April 1, 2014
Print an HTML list of your gists:
./gists.py
@slowkow
slowkow / mycd.sh
Last active September 8, 2015 15:55 — forked from leipzig/mycd.sh
Record folder-specific history in `.dir_bash_history`
function cd_dir_history()
{
OLDPWD="$PWD"
echo "# $(date) $USER -> $@" >> "$HISTFILE"
command cd "$@"
# If this directory is writable then write to directory-based history file
# otherwise write history in the usual home-based history file.
touch "$PWD/.dir_bash_history" 2>/dev/null \
@slowkow
slowkow / Binomial-Probability-Mass-Function_Speed-Comparison.ipynb
Last active January 4, 2021 21:41
Implementations of the Binomial PMF in sympy, scipy, numpy, python, GSL, and C http://nbviewer.ipython.org/11504548
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@slowkow
slowkow / notify-toggle.sh
Last active August 15, 2017 08:18
Toggle notify-osd notifications, optionally toggle sound
#!/usr/bin/env bash
# notify-toggle.sh
# Kamil Slowikowski
# May 31, 2014
#
# Toggle libnotify notification bubbles that appear in the top-right corner
# of your screen.
# You can uncomment some lines to mute and unmute sound, too.
#
# Works on: