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
#Copy to a script and run in a terminal to see the codes and their results (this is not an exhaustive list) | |
print("\033[0;37;40m Normal text\n") | |
print("\033[2;37;40m Underlined text\033[0;37;40m \n") | |
print("\033[1;37;40m Bright Colour\033[0;37;40m \n") | |
print("\033[3;37;40m Negative Colour\033[0;37;40m \n") | |
print("\033[5;37;40m Negative Colour\033[0;37;40m\n") | |
print("\033[1;37;40m \033[2;37:40m TextColour BlackBackground TextColour GreyBackground WhiteText ColouredBackground\033[0;37;40m\n") | |
print("\033[1;30;40m Dark Gray \033[0m 1;30;40m \033[0;30;47m Black \033[0m 0;30;47m \033[0;37;41m Black \033[0m 0;37;41m") | |
print("\033[1;31;40m Bright Red \033[0m 1;31;40m \033[0;31;47m Red \033[0m 0;31;47m \033[0;37;42m Black \033[0m 0;37;42m") |
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 python | |
# Slice subregions out of a genbank between 2 genes. | |
# Usage: | |
# slice_genes.py infile.gbk gene1:gene2:strand | |
from Bio import SeqIO | |
import sys, argparse | |
def get_args(): |
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
# Extract fasta files by their descriptors stored in a separate file. | |
# Requires biopython | |
from Bio import SeqIO | |
import sys | |
import argparse | |
def getKeys(args): | |
"""Turns the input key file into a list. May be memory intensive.""" |
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 -eo pipefail | |
# A small script to generate artemis comparison files (nucleic acid comparison) | |
# since all the webservers are apparently defunct! | |
# Script requires blastn (NOT LEGACY BLAST) and makeblastdb in path - check for existence: | |
command -v makeblastdb >/dev/null 2>&1 || { echo >&2 "makeblastdb doesn't appear to be installed. Aborting."; exit 1; } | |
command -v blastn >/dev/null 2>&1 || { echo >&2 "BLAST+ doesn't appear to be installed. Aborting."; exit 1; } |
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
# This script will calculate Shannon entropy from a MSA. | |
# Dependencies: | |
# Biopython, Matplotlib [optionally], Math | |
""" | |
Shannon's entropy equation (latex format): | |
H=-\sum_{i=1}^{M} P_i\,log_2\,P_i | |
Entropy is a measure of the uncertainty of a probability distribution (p1, ..... , pM) |
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/ruby | |
# Create display override file to force Mac OS X to use RGB mode for Display | |
# see http://embdev.net/topic/284710 | |
require 'base64' | |
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten |
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
# Step 1 | |
# Add the user with | |
sudo adduser username | |
# Ensure a temporary password is given to the account else it remains locked | |
# other options can be left blank | |
# Add the username to the AllowedUsers field in /etc/ssh/sshd_config (on the server) | |
# Next step is often easier to do as the new user to avoid messing up file ownership | |
sudo -i -u newuser |
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
""" | |
This script pulls in homologs of proteins from PDB | |
as determined by HHSuite. It then employs pychimera and | |
UCSF Chimera to structurally match them and get an | |
indication of how well they score (RMSD) in order | |
to pick the best simulation. | |
""" | |
import os | |
import subprocess | |
import sys |
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
\documentclass[a4paper, oneside, 11pt]{memoir} % Doc Setup | |
\usepackage[left=1cm, right=1cm, top=1cm, bottom=1cm]{geometry} % Doc Geometry | |
\usepackage{texshade} | |
\usepackage{lscape} | |
\usepackage[active, tightpage]{preview} | |
\begin{document} | |
\begin{landscape} | |
\begin{preview} |
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
# This gist contains 10 randomly selected kmers (9mers) from the reference human genome (GRCh38). | |
The following code was used to generate the output: | |
import re, sys | |
from Bio import SeqIO | |
import random | |
import time | |
k = 9 | |
n = 10 |
NewerOlder