Skip to content

Instantly share code, notes, and snippets.

View zdk123's full-sized avatar

Zachary Kurtz zdk123

View GitHub Profile
//! Prints the compressed-uncompressed position pairs of a GZ index.
//! Unmodified from:
//! https://github.com/zaeleus/noodles/blob/master/noodles-bgzf/examples/bgzf_gzi_inspect.rs
use std::{env, io, fs};
use std::io::prelude::*;
use std::io::BufReader;
use std::fs::File;
import { checkbox, search } from "@jashkenas/inputs"
export function searchCheckbox(
opts,
options = {
value: [],
optionsCheckboxes: undefined, // use this if you want to pass specific options to the checkboxes or the search
optionsSearch: undefined
}
library(SpiecEasi)
data(amgut1.filt)
depths <- rowSums(amgut1.filt)
amgut1.filt.n <- t(apply(amgut1.filt, 1, norm_to_total))
amgut1.filt.cs <- round(amgut1.filt.n * min(depths))
d <- ncol(amgut1.filt.cs)
n <- nrow(amgut1.filt.cs)
@zdk123
zdk123 / gdrivesession.py
Created November 17, 2019 19:52
A requests session for public google drive links
from requests import Session
from urllib.parse import urlparse, parse_qs, urlencode
class GDriveSession(Session):
"""
A Session for handling requests to public google drive URLs
"""
def __init__(self):

Keybase proof

I hereby claim:

  • I am zdk123 on github.
  • I am zdk123 (https://keybase.io/zdk123) on keybase.
  • I have a public key ASAHPTc3nWwEu67pHV0SLEAPuKriz0EpJjjNPXezi77fhAo

To claim this, I am signing this object:

packages <- c('rvest','dplyr','pipeR', 'knitr')
lapply(packages, library, character.only = T)
css_page <- "#pgl_basic"
getYear <- function(year='2017') {
url <- "https://www.basketball-reference.com/players/j/jamesle01/gamelog/%s"
url <- sprintf(url, as.character(year))
url %>>%
read_html %>>%
load_blast <- function(blastfile, indexcols = c("queryID"),
column_names = c("queryID", "subjectID", "percent.identity", "alignment.length", "mismatches",
"gap.openings", "qstart", "qend", "sstart", "send", "evalue", "bitscore")) {
# check index columns
for (ival in indexcols) {
if (!ival %in% column_names) {
stop(paste("bad values in the indexcols. only valid column names can be used:", paste(column_names, collapse = " ")))
}
}
@zdk123
zdk123 / AGSEdemo.R
Created March 25, 2016 23:50
Example pipeline for running SpiecEasi on biom files
library('devtools')
install_github('zdk123/SpiecEasi')
library(SpiecEasi)
library(phyloseq)
url <- "https://github.com/zdk123/SpiecEasi/blob/master/inst/extdata/study_1925_closed_reference_otu_table.biom"
download.file(url, desfile='AG1.biom' method='wget') ## download method is system dependent
amgut1 <- import_biom('AG1.biom')
## filter taxa that appear in fewer than 30% of the samples
#!/bin/octave -qf
## Compare AMD ordering output from:
## amdtest.cpp https://gist.github.com/zdk123/9c623b6bdf3a57018ae2
## Usage after compiling the above script:
## $ amdtest > data.txt
## $ octave -qf amdtest.m data.txt
arg_list = argv();
filename = arg_list{1};
@zdk123
zdk123 / amdtest.cpp
Created February 14, 2016 21:55
Test AMD ordering function from the Eigen library
#include <iostream>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <Eigen/Sparse>
#include <Eigen/OrderingMethods>
using Eigen::MatrixXd;
using Eigen::SparseMatrix;
using Eigen::Dynamic;
MatrixXd permuteMatAMD(const Eigen::SparseMatrix< double > A) {