This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # Adds allelic depth (AD)=2 to a VCF. | |
| # Usage: bcftools view my.vcf.gz | addad.py | bcftools sort -Oz -o my.ad.vcf.gz && tabix my.ad.vcf.gz | |
| import pysam | |
| vcf_in=pysam.VariantFile("-","r") | |
| vcf_in.header.formats.add("AD",".","Integer","Allelic depth, hard-coded as 2") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Start window and pane indices at 1 instead of 0 | |
| set -g base-index 1 | |
| set -g pane-base-index 1 | |
| # Shift arrow keys to move around panes | |
| bind -n S-Up select-pane -U | |
| bind -n S-Down select-pane -D | |
| bind -n S-Left select-pane -L | |
| bind -n S-Right select-pane -R |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| n <- 1e7 | |
| x <- sample(n, size=n, replace=TRUE) | |
| length(unique(x))/n | |
| # [1] 0.6321897 | |
| 1-exp(-1) | |
| # [1] 0.6321206 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Compile and install htslib, bcftools, samtools 1.9 to home directory | |
| # Set up dirs where stuff will be installed | |
| mkdir -p ${HOME}/bin/htslib | |
| mkdir -p ${HOME}/bin/bcftools | |
| mkdir -p ${HOME}/bin/samtools | |
| # Make a dir to build | |
| mkdir -p ${HOME}/tmp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Load some packages | |
| library(knitr) | |
| library(tidyverse) | |
| library(DT) | |
| # Get licenses for all installed packages. | |
| installed_licenses <- installed.packages() %>% | |
| as.data.frame() %>% | |
| rownames_to_column("package") %>% | |
| as_tibble() %>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl | |
| use warnings; | |
| use strict; | |
| use Getopt::Long; | |
| Getopt::Long::Configure('bundling'); | |
| my ($verbose, $no_act, $force, $op); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| have <- tibble::tribble( | |
| ~id1, ~id2, ~value, | |
| "a", "b", 1L, | |
| "c", "a", 2L, | |
| "c", "b", 3L | |
| ) | |
| have | |
| want <- tibble::tribble( | |
| ~id1, ~id2, ~value, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "name": "Sci-Hub Lookup", | |
| "alias": "Sci-Hub", | |
| "icon": "null", | |
| "_urlTemplate": "https://sci-hub.tw/{z:DOI}", | |
| "description": "Sci-Hub full text PDF search", | |
| "hidden": false, | |
| "_urlParams": [], | |
| "_urlNamespaces": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| d <- tibble::tribble( | |
| ~disease, ~gene, ~chr, ~inheritance, | |
| "flu", "x", 1L, "infectious", | |
| "flu", "y", 2L, "infectious", | |
| "flu", "z", 3L, "infectious", | |
| "aids", "x", 1L, "st", | |
| "aids", "p", 4L, "st" | |
| ) %>% print() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Use My Amazon Affiliate Code | |
| // @namespace http://www.lysator.liu.se/~jhs/userscript | |
| // @description Puts your own Amazon affiliate ID in Amazon links | |
| // @include http://* | |
| // @include https://* | |
| // ==/UserScript== | |
| // leave intact to sponsor my scripting, or set to your own: | |
| const affiliate = 'gettgenedone-20'; |