This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
function unique_combinations() { | |
# Returns all unique possible combinations | |
# of a collection of elements of a given length, | |
# to return all possible unique combinations, | |
# set the last argument equal to the length of | |
# the input collection, see example below: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
"""md5.py: calculates md5s of multiple files in parallel. | |
The md5 calculation is memory safe. It reads in a file | |
in blocks of 64 KiB. | |
USAGE: | |
python3 md5.py file1.txt file2.csv 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function err() { cat <<< "$@" 1>&2; } | |
function fatal() { cat <<< "$@" 1>&2; exit 1; } | |
function retry() { | |
# Tries to run a cmd 5 times before failing | |
# If a command is successful, it will break out of attempt loop | |
# Failed attempts are padding with the following exponential | |
# back-off strategy {4, 16, 64, 256, 1024} in seconds | |
# @INPUTS "$@"" = cmd to run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
help() { cat << EOF | |
Calculates S3 etag | |
USAGE: | |
s3etag [OPTIONS] input_file [chunk_size_in_MB] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |