Skip to content

Instantly share code, notes, and snippets.

@dansmith01
dansmith01 / bytesSI.js
Last active August 28, 2018 19:59
Convert bytes to human readable, keeping 3 significant figures.
function bytesSI(bytes) {
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return bytes;
var suffix = ' Bytes';
var suffixes = [' KB', ' MB', ' GB', ' TB', ' PB', ' EB', ' ZB', ' YB'];
while (suffixes.length && bytes >= 1000) {
bytes = (bytes + 0.0001) / 1000;
suffix = suffixes.shift();
}
return bytes.toString().substr(0,4).concat(suffix).replace(". ", " ");
};
@dansmith01
dansmith01 / mapper.pl
Last active October 28, 2016 00:42
Generate an amino acid alignment with phylogenetic tree and detected peptides overlay.
#!/usr/bin/perl
#--------------------------------------------------------------#
# Author: Daniel Patrick Smith #
# Version: 1.0 / April 21st, 2010 #
# Affiliation: Giovannoni Laboratory, Oregon State University #
# Copyright: GNU General Public License v3 #
# Please Cite: Sowell et al, ISME (2009) 3, 93-105 #
#--------------------------------------------------------------#
#!/usr/bin/perl
#--------------------------------------------------------------------------#
# Description: Combines multiple peptide readings into protein- #
# centric data #
# #
# Author: Daniel Patrick Smith #
# Version: 2.0 / November 29th, 2011 #
# Affiliation: Giovannoni Laboratory, Oregon State University #
# License: GNU General Public License v3 #
@dansmith01
dansmith01 / fastq_split.pl
Created December 10, 2012 20:47
Demultiplexes and quality-checks Illumina sequencing reads. (Fastq in, Fasta out)
#!/usr/bin/perl
#
# ---------------------------------------- #
# Daniel Smith - October 1st, 2012 #
# Argonne National Laboratory #
# Creative Commons License BY-SA 3.0 #
# ---------------------------------------- #
#
use strict;
@dansmith01
dansmith01 / fastq-barcode.pl
Created October 19, 2012 19:25
Syncs a barcode.fastq file to the joined.fastq file produce by ea-util's fastq-join script.
#!/usr/bin/perl
#
# ---------------------------------------- #
# Daniel Smith - October 1st, 2012 #
# Argonne National Laboratory #
# Creative Commons License BY-SA 3.0 #
# ---------------------------------------- #
#
use strict;