Skip to content

Instantly share code, notes, and snippets.

View rec3141's full-sized avatar

R. Eric Collins rec3141

  • University of Alaska Fairbanks
View GitHub Profile
/*
d3.phylogram.js
Wrapper around a d3-based phylogram (tree where branch lengths are scaled)
Also includes a radial dendrogram visualization (branch lengths not scaled)
along with some helper methods for building angled-branch trees.
d3.phylogram.build(selector, nodes, options)
Creates a phylogram.
Arguments:
selector: selector of an element that will contain the SVG
/*
d3.phylogram.js
Wrapper around a d3-based phylogram (tree where branch lengths are scaled)
Also includes a radial dendrogram visualization (branch lengths not scaled)
along with some helper methods for building angled-branch trees.
d3.phylogram.build(selector, nodes, options)
Creates a phylogram.
Arguments:
selector: selector of an element that will contain the SVG
@rec3141
rec3141 / lsa_mds.R
Created December 11, 2013 23:50 — forked from meefen/lsa_mds.R
# load required libraries
library(tm)
library(ggplot2)
library(lsa)
# 1. Prepare mock data
text <- c("transporting food by cars will cause global warming. so we should go local.",
"we should try to convince our parents to stop using cars because it will cause global warming.",
"some food, such as mongo, requires a warm weather to grow. so they have to be transported to canada.",
"a typical electronic circuit can be built with a battery, a bulb, and a switch.",
Q&A
@rec3141
rec3141 / gist:b2cc9d192d214687b575ab0cce02f5f8
Created February 9, 2018 07:18
bash reference manager: get DOI from titles
while read line; do title=`echo $line | sed 's/ /+/g'`; curl -s https://api.crossref.org/works?query.title=$title&rows=1 | tr ',' '\n' | tr -d '"\' | grep ^DOI | cut -f2- -d':'; done < titles.txt > titles.bib
@rec3141
rec3141 / gist:c6f318ae79e9695af6af14d04963f554
Created February 9, 2018 07:21
bash reference manager: get bibtext from DOIs
while read line; do curl -LH "Accept: application/x-bibtex" https://doi.org/$line | grep -v '^\s*[<"]'; done < dois.txt > dois.bib
@rec3141
rec3141 / gist:24090e42b4487635e8ac9f5c566ff417
Created February 9, 2018 10:28
get a bibtext file from a text reference list
while read line; do curl -s "https ://api.crossref.org/works?query=`echo $line | tr -sC '[^a-zA-Z]' '+'`" | tr "," "\n" | tr -d '"\' | grep ^DOI | cut -f2- -d':' | head -n1 | xargs -I{} curl -sLH "Accept: application/x-bibtex" https ://doi.org/{} | grep -v '^\s*[<"]'; done < file
@rec3141
rec3141 / run-hmmer.sh
Created April 6, 2018 00:45
run-hmmer.sh
#!/bin/sh
# run hmmer using hmm files
#INDIR=$1 #directory to search for .fastq.gz files
INDIR=~/work/NPRB
cd ~/work/hmm
for hmmfile in *.hmm; do
hmm=`basename $hmmfile .hmm`;
@rec3141
rec3141 / srun-metaspades.sh
Created April 6, 2018 01:26
srun-metaspades.sh
#!/bin/bash
NODE=bio
THREADS=7 #7 for bio, 24 for t1small
MEM=200 #128 max for t1small, 200+ for bio
mkdir -p spades-assembly
DIR='.'
#NPRB_meta_TBS.04.MEIO.R1.trimmed.fastq.gz
for PREFIX in `ls *.trimmed.fastq.gz | cut -f1-3 -d'.' | sort -u `; do
head -n1000 18*R1.fastq | grep -v -e '==> 18' -e '^$' | paste - - - - | cut -f2 | sort | uniq -c | sort -rn | head -n1000 | catg > 18s-top1000f.fa