Skip to content

Instantly share code, notes, and snippets.

View Swarchal's full-sized avatar

Scott Warchal Swarchal

View GitHub Profile
@Swarchal
Swarchal / qstatus.sh
Last active November 2, 2016 19:47
SGE job summary (add to .bashrc)
# define some colours for pretty output
NC='\033[0m'
RED='\033[0;31m'
YELLOW='\033[0;33m'
GREEN='\033[0;32m'
alias=qstatus="echo -e '${NC}----------' ;\
echo -e '${GREEN}running:' ;\
qstat | grep ' r ' | wc -l ;\
echo -e '${NC}----------' ;\
@Swarchal
Swarchal / replace.sh
Created October 27, 2016 15:06
replace text in all files in current directory
sed -i -- "s/current/replacement/g" *
#!/usr/bin/env python3
from sys import argv
from math import factorial
def parse_fasta(in_file):
""" return sequence from single fasta """
seqs = [line for line in open(in_file) if not line.startswith(">")]
return "".join(seqs).replace("\n", "")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Swarchal
Swarchal / run_from_file.sh
Created September 20, 2016 10:35
Run qsub from a file of qsub commands
while read p; do qsub $p; done < to_run.txt
while read p
do qsub $p
done < to_run.txt
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Swarchal
Swarchal / list_comprehensions.ipynb
Last active September 16, 2017 23:04
list comprehension tutorial
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Swarchal
Swarchal / find_correlation.py
Last active June 23, 2022 04:17
findCorrelation in python
import pandas as pd
import numpy as np
def find_correlation(df, thresh=0.9):
"""
Given a numeric pd.DataFrame, this will find highly correlated features,
and return a list of features to remove
params:
- df : pd.DataFrame
#include <iostream>
#include <algorithm>
using namespace std;
//////////////////////////////////////////////////////////////////////////////
// Permute array of integers //
//////////////////////////////////////////////////////////////////////////////
// roll your own factorial function