Skip to content

Instantly share code, notes, and snippets.

🐄

Kamil Slowikowski slowkow

🐄
Block or report user

Report or block slowkow

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@slowkow
slowkow / writeMMgz.R
Created Mar 16, 2020
Write a gzip compressed Matrix Market file in R.
View writeMMgz.R
#' @param x A sparse matrix from the Matrix package.
#' @param file A filename that ends in ".gz".
writeMMgz <- function(x, file) {
mtype <- "real"
if (is(x, "ngCMatrix")) {
mtype <- "integer"
}
writeLines(
c(
sprintf("%%%%MatrixMarket matrix coordinate %s general", mtype),
@slowkow
slowkow / needleman-wunsch.py
Created Feb 5, 2020
A simple version of the Needleman-Wunsch algorithm in Python.
View needleman-wunsch.py
#!/usr/bin/env python
"""
The Needleman-Wunsch Algorithm
==============================
This is a dynamic programming algorithm for finding the optimal alignment of
two strings.
Example
-------
@slowkow
slowkow / read_cellranger.R
Created Jan 17, 2020
Read Cell Ranger HDF5 .h5 files in R
View read_cellranger.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"
)
@slowkow
slowkow / install-units.md
Last active Oct 1, 2019
Install the 'units' R package on Partners
View install-units.md

Summary

I had a difficult time installing the units R package on the Partners ERIS servers.

I hope this post helps you to figure out how to work around the errors.

Instructions

@slowkow
slowkow / pubmed-publications.html
Created May 3, 2019
Get an HTML list of PubMed publications
View pubmed-publications.html
<!DOCTYPE html>
<body>
<!-- Copied directly from http://www.ephys.org/ by Damian J Williams -->
<input placeholder="Kamil Slowikowski" name="name"/>
<p id="demo"></p>
<script>
@slowkow
slowkow / README.md
Last active May 15, 2019
Generate a DESCRIPTION file with all of your installed packages
View README.md

Problem

We need to install a lot of R packages each time we upgrade to a new version of R.

Solution

  1. Before installing the new R, run Rscript make_description.R to write a list of all installed packages.
  2. Install the new version of R.
  3. Use devtools to reinstall the packages.
@slowkow
slowkow / out.pdf
Last active Feb 5, 2019
Make a PCA plot in Bash with the OpenCPU API
View out.pdf
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@slowkow
slowkow / contentScript.js
Created Jan 10, 2019
Chrome extension to automatically click the "Send SMS" button on okta.com
View contentScript.js
/*
* The purpose of this script is to automatically click the "Send SMS"
* button as soon as the page is loaded, instead of clicking on it manually.
*
* This is the page with the button:
*
* https://partnershealthcare.okta.com/signin/verify/okta/sms
*
*/
@slowkow
slowkow / rsg2018.json
Last active Dec 12, 2018
RSGDREAM2018 poster abstracts in JSON format
View rsg2018.json
[
{
"id": "1",
"title": "Methods for Identifying Tumor Heterogeneity and Rare Subclones in Single Cell DNA Sequence Data",
"text": "Background With the advancements of single cell sequencing technologies it is now possible to interrogate thousands of cells in a single experiment. Single-cell RNA-Seq has been available for several years but high-throughput single-cell DNA analysis is in its infancy. Therefore, it is essential to develop new capabilities for assessing genetic variation present in rare cells and to better understand the role that these cells play in the evolution of tumor progression. To address these challenges and enable the characterization of genetic diversity in cancer cell populations, we developed a novel approach to identify mutation signatures which define subclones present in a tumor population. Methods Here we present a two-step clustering and subclone identification method using data generated on the Tapestri single-cell DNA platform which can generate upto 10000 cells
View flatten.R
flatten_points <- function(plot, width = 10, height = 5, dpi = 200) {
is_geom_point <- sapply(plot$layers, function(layer) {
"GeomPoint" %in% class(layer$geom)
})
plot_flat <- plot + ggplot2::theme_void()
plot_vector <- plot
plot_flat$layers <- plot$layers[is_geom_point]
plot_vector$layers <- plot$layers[!is_geom_point]
You can’t perform that action at this time.