Skip to content

Instantly share code, notes, and snippets.

@mojaveazure
mojaveazure / subsample.sh
Last active June 8, 2023 22:12
A script to subsample Fasta/FastQ files using Seqtk
#!/bin/bash
set -e
set -u
set -o pipefail
# A script to subsample Fasta/FastQ files using Seqtk
if ! `command -v seqtk > /dev/null 2> /dev/null`
then
echo "Failed to find seqtk!"
@mojaveazure
mojaveazure / downloadSRA.sh
Last active September 2, 2015 16:27
A simple shell script to download samples from the SRA
#!/bin/bash
set -e
set -u
set -o pipefail
if ! `command -v fastq-dump > /dev/null 2> /dev/null`
then
echo "Can't find fastq-dump!"
exit 1
@mojaveazure
mojaveazure / barcodeToAdapter.sh
Created September 26, 2015 22:55
Create an adapter sequence file from the barcodes in sample names
#!/bin/bash
set -e
set -o pipefail
###########################################################################################################################
######################################### Usage Information #########################################
# This is a script to extract adapter sequences that use barcodes embedded in the names of files
# To use, add a list of samples to the SAMPLE_INFO field on line 34
# This should look like:
@mojaveazure
mojaveazure / checkExtension.sh
Created September 29, 2015 17:27
A function that checks the extension of a file
#!/bin/bash
# A function that checks the extension of a file
function checkExtension() {
FILE="$1"
EXTENSION="$2"
if [[ "${FILE: -4}" == "${EXTENSION}" ]]
then
echo yes
return 0
@mojaveazure
mojaveazure / switch_arg.py
Last active December 11, 2015 23:21
An example of a switch argument in Python
#!/usr/bin/env python
import argparse
parser = argparse.ArgumentParser(add_help=True, description="A switch argument in Python")
parser.add_argument('-s',
'--switch',
help="The switch",
action='store_true',
@mojaveazure
mojaveazure / installSAMTools.sh
Created December 18, 2015 22:43
Install SAMTools without needing root privileges
#!/bin/bash
# This script downloads and installs SAMTools
# The current version of SAMTools is v1.3
set -e
set -o pipefail
# What versions of SAMTools are we downloading?
SAMTOOLS_VERSION="1.3"
@mojaveazure
mojaveazure / R_Formulas.md
Created December 18, 2015 22:44
Some stuff about formulas in R

R Formula Specifications

Adapted from the National Park Service


Right-Side

Right Side Meaning
A + B Main effects of A and B
A:B Interaction of A with B
@mojaveazure
mojaveazure / regionsFromBED.sh
Last active January 7, 2016 23:51
Extract regions from a BED file and format it for use with ANGSD and ANGSD-wrapper
#!/bin/bash
set -e
set -o pipefail
# Extract regions from a BED file and format it for use with ANGSD and ANGSD-wrapper
function Usage() {
echo -e "\
Usage: $(basename $0) BED_FILE NUMBER [OUTFILE] [SEED] \n\
@mojaveazure
mojaveazure / InstallPlatypusMSI.sh
Last active February 20, 2017 18:04
Install Platypus on MSI
#!/bin/bash
# This script is designed to install Platypus on MSI
set -e
set -o pipefail
INSTALL_DIR=${1:-$(pwd)}
echo "Installing Platypus into ${INSTALL_DIR}..." >&2
@mojaveazure
mojaveazure / pileup.sh
Last active February 5, 2016 00:11
Perform a pileup using SAMTools and BCFTools
#!/bin/bash
set -e
set -o pipefail
# Check for dependent programs
if ! `command -v samtools > /dev/null 2> /dev/null`; then echo "Please install SAMTools and place in your PATH"; exit 1; fi # Do we have SAMTools installed?
if ! `command -v bcftools > /dev/null 2> /dev/null`; then echo "Please install BCFTools and place in your PATH"; exit 1; fi # Do we have BCFTools installed?
# Create a usage message