Skip to content

Instantly share code, notes, and snippets.

View JEFworks's full-sized avatar

Jean Fan JEFworks

View GitHub Profile
@slowkow
slowkow / read_cellranger.R
Last active October 21, 2024 07:50
Read Cell Ranger HDF5 .h5 files in R
# install.packages(c("Matrix", "rhdf5", "tidyverse"))
library(Matrix)
library(rhdf5)
library(tidyverse)
library(glue)
my_h5_files <- Sys.glob(
"path/to/cellranger-per-channel/output/*/filtered_feature_bc_matrix.h5"
)
# Easy extraction for a number of archive formats
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
@slowkow
slowkow / pdfoptim.sh
Last active August 18, 2023 22:13
Optimize PDF files with Ghostscript.
#!/usr/bin/env bash
# pdfoptim.sh
#
# Optimize a PDF with Ghostscript
#
# Usage: bash pdfoptim.sh FILE.pdf
#
# This will copy the input file to FILE-original.pdf
# And write an optimized file to FILE.pdf
#
@gungorbudak
gungorbudak / mannwhitneyu.js
Last active October 17, 2023 16:24
Mann Whitney U test Javascript implementation
'use strict';
(function(exports) {
var rank = {
/*
* Standart ranking
*
* The MIT License, Copyright (c) 2014 Ben Magyar
*/
@slowkow
slowkow / make_aspera_manifest.sh
Created April 24, 2015 20:03
Make a manifest file for Aspera.
#!/usr/bin/env bash
# make_aspera_manifest.sh
# Kamil Slowikowski
#
# Make a manifest file suitable for Aspera.
#
# Example
# -------
#
# Suppose we wish to send a folder full of files called "data". We want
@casallas
casallas / rjags_mac.md
Last active January 31, 2024 23:16
Installing rjags on a Mac

To install

  1. Install jags: in the terminal using homebrew brew install jags
  2. Install rjags: in R
install.packages("rjags")
library(rjags)

Potential issues

@stevenworthington
stevenworthington / ipak.R
Created July 25, 2012 19:44
Install and load multiple R packages at once
# ipak function: install and load multiple R packages.
# check to see if packages are installed. Install them if they are not, then load them into the R session.
ipak <- function(pkg){
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
if (length(new.pkg))
install.packages(new.pkg, dependencies = TRUE)
sapply(pkg, require, character.only = TRUE)
}
@Phrogz
Phrogz / SVG Path to Polygon.js
Created February 27, 2011 04:28
Convert a SVG path to a Polygon by sampling the path, but also including all control points in the result. See http://phrogz.net/SVG/convert_path_to_polygon.xhtml
// http://phrogz.net/SVG/convert_path_to_polygon.xhtml
function pathToPolygon(path,samples){
if (!samples) samples = 0;
var doc = path.ownerDocument;
var poly = doc.createElementNS('http://www.w3.org/2000/svg','polygon');
// Put all path segments in a queue
for (var segs=[],s=path.pathSegList,i=s.numberOfItems-1;i>=0;--i) segs[i] = s.getItem(i);
var segments = segs.concat();