Skip to content

Instantly share code, notes, and snippets.

View danielecook's full-sized avatar
😀
Things are going good

Daniel E Cook danielecook

😀
Things are going good
View GitHub Profile
@danielecook
danielecook / data_dictionary.R
Last active April 19, 2020 15:32
Data Dictionary
# Generate data dictionary
DESCRIPTIONS <- list(mpg = "Miles Per Gallon")
# data dict function
data_dict <- function(data, descriptions = NA, print_table = FALSE){
# Adapted from https://github.com/pw2/Data-Dictionary-Function/blob/master/Data%20Dictionary%20Function.R
if(!require(pacman)) install.packages("pacman")
pacman::p_load('tidyverse', 'psych', 'ggpubr', 'gridExtra', 'knitr', 'data.table')
@danielecook
danielecook / ipinfo.sh
Created March 24, 2020 15:43
IP info; ipinfo.io #bash-utils
# ipinfo.io
# Retrieve information on your IP address
# JSON response
curl ipinfo.io
# Retrieve just the IP address
curl ipinfo.io/ip
# Retrieve the hostname
@danielecook
danielecook / chrom_list.sh
Created March 6, 2020 10:36
Generate chrom list
{
for i in `seq 1 22`;
do echo ${i};
done;
echo "X";
echo "Y";
echo "MT";
} > names.txt
@danielecook
danielecook / dump_params.groovy
Created March 3, 2020 16:40
Dump #nextflow params to json
import groovy.json.JsonOutput
json_param_file = "${workflow.projectDir}/pipeline_info/params.json"
new File(json_param_file).withWriter('utf-8') {
writer ->
def json_params = JsonOutput.prettyPrint(JsonOutput.toJson(params));
writer.write(json_params);
}
@danielecook
danielecook / nextflow.Dockerfile
Created February 27, 2020 22:50
#Nextflow Docker File
# docker build --file manta.Dockerfile -t swantonlab/manta .
FROM continuumio/miniconda3
RUN apt-get update && apt-get install -y procps
RUN conda config --add channels defaults && \
conda config --add channels bioconda && \
conda config --add channels conda-forge
RUN conda create -n manta bioconda::manta=1.6.0 && conda clean -a
ENV PATH /opt/conda/envs/manta/bin:$PATH
RUN conda env export --name manta > manta.yml
@danielecook
danielecook / filter_bams.sh
Last active February 26, 2020 16:54
fix bam merge
fd --extension bam --change-older-than "2020-02-26 00:00:00" | head -n 100
@danielecook
danielecook / setup_wormbase_genome.sh
Created February 24, 2020 23:12
setup wormbase genome
# This script will download, index, and prep reference genomes.
# Prep N2 reference genome
RELEASE=WS274
PROJECT=PRJNA13758
mkdir -p "${PROJECT}.${RELEASE}" && cd "${PROJECT}.${RELEASE}"
# Annotation file
wget ftp://ftp.ensembl.org/pub/current_gff3/caenorhabditis_elegans/Caenorhabditis_elegans.WBcel235.99.gff3.gz
@danielecook
danielecook / extract_params.sh
Created February 20, 2020 17:10
Extract params from nextflow files
ag -o params\\.[A-Za-z\_0-9]+ *.nf | sort | uniq
@danielecook
danielecook / prep_stdin.sh
Last active February 22, 2020 19:06
Prep stdin for igv
function test_igv {
cat - > test.${1}
igvtools index test.${1}
}
@danielecook
danielecook / fetch_remote.sh
Created February 13, 2020 15:10
Git fetch all remote branches, fetch, and pull
# https://stackoverflow.com/questions/10312521/how-to-fetch-all-git-branches
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all