Skip to content

Instantly share code, notes, and snippets.

View janxkoci's full-sized avatar

Jeňa Kočí janxkoci

View GitHub Profile
@janxkoci
janxkoci / awk_vcf_anim_chrom_pos.sh
Last active November 17, 2018 22:22
AWK script to parse info on a single sample and position from a VCF file
#!/bin/bash
# bash awk_vcf_anim_chrom_pos.sh in.vcf sample chrom pos
echo vcf: "$1"
echo sample: "$2"
echo chrom: "$3"
echo pos: "$4"
awk -v sample=$2 -v chrom="$3" -v pos=$4 \
@janxkoci
janxkoci / boxplot_magrittr.ipynb
Last active October 23, 2019 09:50
This short tutorial shows an example of how to make boxplots with help of the magrittr package, with additional features (e.g. means)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@janxkoci
janxkoci / PushBulletBookmarklet.js
Created April 1, 2020 15:57 — forked from rpavlik/PushBulletBookmarklet.js
PushBullet Bookmarklet
(function() {
var API_KEY = "YOUR_API_KEY_GOES_HERE";
// code for IE7+, Firefox, Chrome, Opera, Safari - forget IE6
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", "https://api.pushbullet.com/v2/pushes", true);
xmlhttp.setRequestHeader('Content-Type', 'application/json');
xmlhttp.setRequestHeader('Authorization', "Bearer " + API_KEY);
/// @todo needs oauth2 update? ugh.
@janxkoci
janxkoci / jupyteR_data_science.md
Last active April 14, 2020 07:56
Jupyter and R for Scientists

Comments: Jupyter and R for Scientists

This is a place to share comments about the post Jupyter and R for Scientists I published on my blog.

Contributing

If you'd like to improve the post, you can fork it on Github and submit a pull request.

Comments

@janxkoci
janxkoci / mendeley_bookmarklet.js
Created July 19, 2020 18:01
Mendeley bookmarklet for browsers such as Safari and Epiphany.
javascript:document.getElementsByTagName("body")[0].appendChild(document.createElement("script")).setAttribute("src","https://static.mendeley.com/bin/extensions/bookmarklet.js");
@janxkoci
janxkoci / revcomp_bioawk.sh
Last active August 17, 2020 09:35
Get a reverse complement of any sequence, given as a parameter. Great for quick searching of primers, adapters, etc.
#!/bin/bash
# USAGE:
# revcomp_bioawk.sh actgactg
# requires bioawk, which can be installed with conda:
# conda install -c conda-forge -c bioconda bioawk
seq=$1
@janxkoci
janxkoci / nightmode_bookmarklets.js
Last active January 18, 2021 19:47
NightMode bookmarklets (copy one or all)
// this one inverts colours on a page; second click reverts it (because it's exact negative)
javascript:(function(){function RGBtoHSL(RGBColor){with(Math){var R,G,B;var cMax,cMin;var sum,diff;var Rdelta,Gdelta,Bdelta;var H,L,S;R=RGBColor[0];G=RGBColor[1];B=RGBColor[2];cMax=max(max(R,G),B);cMin=min(min(R,G),B);sum=cMax+cMin;diff=cMax-cMin;L=sum/2;if(cMax==cMin){S=0;H=0;}else{if(L<=(1/2))S=diff/sum;else S=diff/(2-sum);Rdelta=R/6/diff;Gdelta=G/6/diff;Bdelta=B/6/diff;if(R==cMax)H=Gdelta-Bdelta;else if(G==cMax)H=(1/3)+Bdelta-Rdelta;else H=(2/3)+Rdelta-Gdelta;if(H<0)H+=1;if(H>1)H-=1;}return[H,S,L];}}function getRGBColor(node,prop){var rgb=getComputedStyle(node,null).getPropertyValue(prop);var r,g,b;if(/rgb\((\d+),\s(\d+),\s(\d+)\)/.exec(rgb)){r=parseInt(RegExp.$1,10);g=parseInt(RegExp.$2,10);b=parseInt(RegExp.$3,10);return[r/255,g/255,b/255];}return rgb;}function hslToCSS(hsl){return "hsl("+Math.round(hsl[0]*360)+", "+Math.round(hsl[1]*100)+"%, "+Math.round(hsl[2]*100)+"%)";}var props=["color","background-color","b
@janxkoci
janxkoci / pylab.yml
Last active January 21, 2021 13:51
Conda environment with Jupyter, Scientific Python, and ToyPlot
name: pylab
channels:
- conda-forge
dependencies:
- python=3
- jupyter
- jupyterthemes
- scipy
- numpy
- pandas
@janxkoci
janxkoci / plinkmds2tsv.sh
Last active March 25, 2022 12:10
A simple script for converting Plink MDS (with messy whitespace) to TSV format. Another one for generic tables (it's the same but with better name).
#!/bin/bash
# Script for converting plink MDS (with space-aligned columns) into TSV format.
INFILE=$1
NCOL=$(head -1 $INFILE | wc -w) # 5
COLS=$(echo '$'$(seq 1 $NCOL) | sed 's/ /,$/g') # $1,$2,$3,$4,$5
awk 'BEGIN {OFS="\t"} {print '"$COLS"'}' $INFILE
@janxkoci
janxkoci / ir.sh
Last active March 28, 2022 22:22
Launch R in Jupyter Console (useful on headless servers)
#!/bin/bash
## R in Jupyter Console
## Usage:
# ir.sh # jupyter-console
# ir.sh qt # jupyter-qtconsole
## Install Jupyter Console & R kernel (optional: install Jupyter Qtconsole too)
# conda install -c conda-forge jupyter_console r-base r-irkernel # qtconsole