Skip to content

Instantly share code, notes, and snippets.

View rpetit3's full-sized avatar
🐫
I may be slow to respond.

Robert A. Petit III rpetit3

🐫
I may be slow to respond.
View GitHub Profile
# Simulation of proposal power analysis
# Y (response) --- Expect Pr(Human) >> Pr(Non-Human)
# Expect N_samples > 5000
# Testing Pr(Human) = c(0.8, 0.85, 0.90, 0.95)
#
# X (predictor) --- Prescence or Abscence of accessory gene
# Expect 2000-4000 accessory genes (tests)
# Testing Pr(Accessory Gene) = c(0.05, 0.10, 0.15, 0.20, 0.25)
#
# Odds Ratios --- 1.1 (small), 1.5 (medium), 2.5 (large)
@rpetit3
rpetit3 / HGCC_set_up.sh
Last active August 29, 2015 14:27
Setting Up Everything On HGCC
# Begin at home directory
# Setting up Linuxbrew
git clone https://github.com/Homebrew/linuxbrew.git ~/.linuxbrew
# Add the following to .bashrc (without # of course!)
# # Linuxbrew
# export PATH="/home/rpetit/.linuxbrew/bin:$PATH"
# export MANPATH="/home/rpetit/.linuxbrew/share/man:$MANPATH"
# export INFOPATH="/home/rpetit/.linuxbrew/share/info:$INFOPATH"
@rpetit3
rpetit3 / rename-fasta-header.py
Created March 18, 2016 18:57
rename-fasta-header.py
#! /usr/bin/env python
"""
Prefix a set of FASTA (STDIN) headers with a given string.
Example run: zcat my_fasta.gz | ./rename-fasta-header.py headers.txt PREFIX
"""
from __future__ import print_function
if __name__ == '__main__':
import sys
@rpetit3
rpetit3 / subsample-fq.sh
Created August 10, 2016 15:38
Subsample S. aureus FASTQ to a given coverage using SeqTK
#! /bin/bash
# Subsample reads from a given S. aureus FASTQ file.
#
# Program: seqtk (https://github.com/lh3/seqtk)
# Version: commit 43ff625a3211b51f301cb356a34fb8d1e593d50a
#
# Example: subsample-fq.sh 0.25 saureus.fastq.gz
#
set -x # Echo all commands
# Use N315 genome size
@rpetit3
rpetit3 / example-loma-job.sh
Last active September 8, 2016 15:13
An example outline for submitting jobs to SGE on Loma.
#! /bin/bash
#$ -wd YOUR_WORKING_DIRECTORY
#$ -V # << Imports current environment variables
#$ -N YOUR_JOB_NAME
#$ -S /bin/bash # << which shell to use
#$ -pe orte NUM_CPU # << Loma has 20 slots to give, if more than 10 only one job will run
#$ -o YOUR_JOB_STDOUT
#$ -e YOUR_JOB_STDERR
# Example Environment Variables
@rpetit3
rpetit3 / elasticsearch.yml
Last active January 11, 2017 22:38
Staphopia elasticsearch.yml For Data Nodes
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
# Before you set out to tweak and tune the configuration, make sure you
# understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please see the documentation for further information on configuration options:
@rpetit3
rpetit3 / elasticsearch.default
Last active January 11, 2017 22:32
Staphopia Elasticsearch Defaults(/etc/default/elasticsearch)
################################
# Elasticsearch
################################
# Elasticsearch home directory
ES_HOME=/usr/share/elasticsearch
# Elasticsearch Java path
#JAVA_HOME=
@rpetit3
rpetit3 / Snakefile
Created October 18, 2017 23:06
FASTQ cleanup using Snakemake
PATH = '/home/rpetit/staphopia/apps/analysis-pipeline'
sample = 'N315_R1'
rule all:
input:
'analyses/fastq-stats/{sample}.cleanup.fastq.json'.format(
sample=sample
)
rule bbduk_phix:
@rpetit3
rpetit3 / rufus-cleanup.py
Created October 18, 2017 23:08
Ruffus version of FASTQ clean up
#! /usr/bin/env python
"""Clean up an input FASTQ file."""
import sys
from ruffus import *
from staphopia.helpers.time_job import time_job
from staphopia.tasks import fastq, shared
parser = cmdline.get_argparse(description='Cleanup FASTQ files')
@rpetit3
rpetit3 / staphopia.nf
Created October 20, 2017 13:30
Nextflow workflow
#!/usr/bin/env nextflow
params.output = null
params.sample = null
params.fq1 = null
params.fq2 = null
params.cpu = 1
params.coverage = 100
params.is_paired = false
params.no_length_filter = false