Skip to content

Instantly share code, notes, and snippets.

@elowy01
elowy01 / BCFtools cheat sheet
Last active April 22, 2024 18:28
BCFtools cheat sheet
*bcftools filter
*Filter variants per region (in this example, print out only variants mapped to chr1 and chr2)
qbcftools filter -r1,2 ALL.chip.omni_broad_sanger_combined.20140818.snps.genotypes.hg38.vcf.gz
*printing out info for only 2 samples:
bcftools view -s NA20818,NA20819 filename.vcf.gz
*printing stats only for variants passing the filter:
bcftools view -f PASS filename.vcf.gz
@pvik
pvik / smartparens-cheatsheet.md
Last active March 17, 2024 03:29
A Cheatsheet for Emacs Smarparens example configuration

An animated cheatsheet for smartparens using the example configuration specified here by the smartparens author. Inspired by this tutorial for paredit.

Traversal

C-M-f sp-forward-sexp
C-M-b sp-backward-sexp
@rain-1
rain-1 / example.tsv
Last active February 6, 2023 16:56
Tab Separated Values file format specification version 2.0
Name Age Address
Paul 23 1115 W Franklin
Bessy the Cow 5 Big Farm Way
Zeke 45 W Main St
@maciekrb
maciekrb / PubSub to BigQuery using Dataflow
Created December 25, 2017 12:25
Dataflow pipeline to read from a Google Pub/Sub topic and write into a BigQuery table
package com.healthifyme.dftrial;
import com.google.api.services.bigquery.model.TableRow;
import com.google.api.services.bigquery.model.TableSchema;
import com.google.api.services.bigquery.model.TableFieldSchema;
import com.healthifyme.dftrial.common.ExampleUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;
@korakot
korakot / colab_download.py
Created November 15, 2017 08:40
Google colab file upload/download
files.download('example.txt') # from colab to browser download
@borkdude
borkdude / text_xform.clj
Created September 1, 2017 13:07
Clojure text files transducer
(ns text-xform
(:require [clojure.java.io :as io]
[clojure.string :as str]
[cheshire.core :as json])
(:import [java.io BufferedReader]))
;;;; inspired by https://tech.grammarly.com/blog/building-etl-pipelines-with-clojure
(def db (atom 0))
@reborg
reborg / rich-already-answered-that.md
Last active February 23, 2024 13:09
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

@krlohnes
krlohnes / scalajdb.md
Last active January 27, 2022 18:31
Debugging with jdb in scala

#Debugging Scala with JDB

It seems impossible to find answers on how to debug Scala with jdb on Google. I wanted to consolidate what I've learned in a easy to digest guide. Please feel free to comment with other tips I may have missed, or corrections to what's here.

##Classes Setting a breakpoint in a class is just like debugging java stop at my.package.ClassName:22

@hswick
hswick / pca.md
Last active August 23, 2018 12:21
Principal Component Analysis in pure Clojure

Visualizing the Iris with Principal Component Analysis

This post will teach you how to visualize higher dimensional datasets in lower dimensions using Principal Component Analysis. And guess what?! Its all in Clojure! I was inspired to write this because I was curious how Principal Component Analysis worked, and there aren't a lot of data analysis resources out there for Clojure.

The best one I could find was from Data Sorcery https://data-sorcery.org/category/pca/.

Now that blog post was very informative on how to do Principal Component Analysis (will be referring to this as PCA as well) in Clojure. However, when I decided to use it on a larger dataset I got an out of memory exception because the pca function incanter provides requires a matrix as input. The input matrix requires a lot of memory if the dataset is rather large. So I decided to write my own implementation which could calculate the covariance matrix with an input as a lazyseq. That way my input could be as big as I wanted. And learning

@arohner
arohner / google-api.clj
Created November 5, 2016 21:53
Clojure example of accessing google APIs directly
(ns example.api.google
(:require [cemerick.url :as url]
[cheshire.core :as json]
[clj-jwt.core :as jwt]
[clj-jwt.key :as key]
[clj-time.core :as time]
[clj-http.client :as http]
[clojure.string :as str])
(:import java.io.StringReader))