Skip to content

Instantly share code, notes, and snippets.

Avatar

Skyler Kuhn skchronicles

View GitHub Profile
@skchronicles
skchronicles / HERVx.sh
Created Sep 3, 2020
Pipeline to characterize Human Endogenous Retrovirus (HERV) expression
View HERVx.sh
#!/usr/bin/env bash
set -euo pipefail
function usage() { cat << EOF
HERVx: Pipeline to characterize Human Endogenous Retrovirus (HERV) expression
USAGE:
HERVx.sh [OPTIONS] -r1 SRR4235541_1.fastq -r2 SRR4235541_2.fastq -o outdir_path
View multiqc_parser.py
from __future__ import print_function, division
import sys, os, re
import pandas as pd
# Configuration for defining valid files, cleaning sample names, parse fields, rename fields
# Add new files to parse and define their specifications below
config = {
".warning": ["\033[93m", "\033[00m"], ".error": ["\033[91m", "\033[00m"],
"multiqc_cutadapt.txt": {
@skchronicles
skchronicles / covid.sh
Last active Apr 30, 2020
Download the latest SARS-CoV-2 sequences from RefSeq and GenBank
View covid.sh
#!/bin/bash
# Functions
download() { echo -e "Saving output to file: $1"; curl --http1.1 --retry 5 --verbose -L 'https://www.ncbi.nlm.nih.gov/genomes/VirusVariation/vvsearch2/?q=*:*&fq=%7B!tag=SeqType_s%7DSeqType_s:(%22Nucleotide%22)&fq=VirusLineageId_ss:(2697049)&cmd=download&sort=SourceDB_s%20desc,CreateDate_dt%20desc&dlfmt=fasta&fl=id,Definition_s,Nucleotide_seq' > "$1" || echo 'Download failed... please try again!'; }
echoerr() { cat <<< "$@" 1>&2; }
help() { cat << EOF
Download the latest SARS-CoV-2 sequence from GeneBank and RefSeq. Please note that providing
the output filename of the downloaded sequences is optional.
@skchronicles
skchronicles / s3etag.sh
Created Apr 23, 2020
Calculate S3 ETag
View s3etag.sh
#!/bin/bash
set -euo pipefail
help() { cat << EOF
Calculates S3 etag
USAGE:
s3etag [OPTIONS] input_file [chunk_size_in_MB]
View xlsx_reader.py
from __future__ import print_function
import pandas as pd
import sys
usage = '''\
USAGE:
python xlsx_reader.py input.xlsx output_file_prefix [-h]
Positional Arguments:
@skchronicles
skchronicles / image2html.sh
Created Apr 21, 2020
Bash one-liners: covert images to base64 and embed in HTML
View image2html.sh
# USAGE: image2html /path/to/images/*.png > out.html
function image2html(){
for f in $@; do b=$(cat "$f" | base64 -w 0); echo "<img src=\"data:image/${f##*.};base64,${b}\" alt=\"${f%.*}\">"; done
}
export -f image2html