Skip to content

Instantly share code, notes, and snippets.

View widdowquinn's full-sized avatar

Leighton Pritchard widdowquinn

View GitHub Profile
@widdowquinn
widdowquinn / pca_prcomp_explanation.R
Last active September 10, 2020 20:48
A short explanation of prcomp in R, using R's example data
require(graphics)
# Let's use some example data from the R libraries: USArrests
# Have a quick look at the data
head(USArrests)
summary(USArrests)
# You should see that the measured variables are on
# different scales: Assault varies from 45 to 337, but
# all other variables only from 1 to 90.
# If we use raw values, it's possible that the absolutely,
@widdowquinn
widdowquinn / anaplasma_cmd.txt
Created November 10, 2013 10:05
Commands for running Anaplasma blog examplestime python calculate_ani.py -i test_anaplasma/ -m ANIb -o anaplasma_anib -g
time python calculate_ani.py -i test_anaplasma/ -m ANIb -o anaplasma_anib -g
time python calculate_ani.py -i test_anaplasma/ -m ANIb -o anaplasma_anib -g -v --noclobber -f --format png --skip_blast
time python calculate_ani.py -i test_anaplasma/ -m ANIm -o anaplasma_anim -g -v
time python calculate_ani.py -i test_anaplasma/ -m ANIm -o anaplasma_anim -g -v --noclobber -f --format png --skip_nucmer
time python calculate_ani.py -i test_anaplasma/ -m TETRA -o anaplasma_tetra -g -v -f
time python calculate_ani.py -i test_anaplasma/ -m TETRA -o anaplasma_tetra -g -v -f --format png
@widdowquinn
widdowquinn / anaplasma.txt
Last active December 27, 2015 21:59
List of files for Anaplasma ANI blog example.
ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Anaplasma_centrale_Israel_uid42155/NC_013532.fna
ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Anaplasma_marginale_Dawn_uid226994/NC_022760.fna
ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Anaplasma_marginale_Florida_uid58577/NC_012026.fna
ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Anaplasma_marginale_Maries_uid57629/NC_004842.fna
ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Anaplasma_phagocytophilum_Dog2_uid213225/NC_021881.fna
ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Anaplasma_phagocytophilum_HZ2_uid213224/NC_021879.fna
ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Anaplasma_phagocytophilum_HZ_uid57951/NC_007797.fna
ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Anaplasma_phagocytophilum_JM_uid213223/NC_021880.fna
@widdowquinn
widdowquinn / chlorobium_cmd.txt
Last active December 27, 2015 20:49
Command lines for running the calculate_ani.py script on downloaded Chlorobium sequences in the test_isolates subdirectory, drawing graphical output and keeping a verbose log in each case.
time python calculate_ani.py -i test_isolates/ -m ANIb -o chlorobium_anib -g -v -l chlorobium_anib.log
time python calculate_ani.py -i test_isolates/ -m ANIm -o chlorobium_anim -g -v -l chlorobium_anim.log
time python calculate_ani.py -i test_isolates/ -m TETRA -o chlorobium_tetra -g -v -l chlorobium_tetra.log
@widdowquinn
widdowquinn / chlorobium_dl.txt
Last active December 27, 2015 20:49
Grab Chlorobium genome sequences, using the chlorobium.txt file.
mkdir test_isolates
cd test_isolates/
wget -i chlorobium.txt
cd ..
@widdowquinn
widdowquinn / chlorobium.txt
Last active December 27, 2015 20:48
Download locations for Chlorobium genomes.
ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Chlorobium_chlorochromatii_CaD3_uid58375/NC_007514.fna
ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Chlorobium_limicola_DSM_245_uid58127/NC_010803.fna
ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Chlorobium_luteolum_DSM_273_uid58175/NC_007512.fna
ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Chlorobium_phaeobacteroides_BS1_uid58131/NC_010831.fna
ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Chlorobium_phaeobacteroides_DSM_266_uid58133/NC_008639.fna
ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Chlorobium_phaeovibrioides_DSM_265_uid58129/NC_009337.fna
ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Chlorobium_tepidum_TLS_uid57897/NC_002932.fna
@widdowquinn
widdowquinn / boy-girl.py
Created March 10, 2013 13:02
Python code to illustrate the Tuesday Boy paradox ("I have two children. One is a boy born on a Tuesday. What is the probability I have two boys") for a blog post. This time, unlike paradox.py, parents with one child of either sex are free to choose which child they tell you about, and rephrase the question accordingly.
# boy-girl.py
#
# Python code to illustrate the Tuesday Boy paradox ("I have two children.
# One is a boy born on a Tuesday. What is the probability I have two boys")
# for a blog post.
#
# This time, unlike paradox.py, we're not assuming that there is preselection
# for telling you that one of the children is a boy, or a boy born on a Tuesday.
# This radically alters the solution of the problem.
#
@widdowquinn
widdowquinn / paradox.py
Created February 9, 2013 17:32
Python code to illustrate the Tuesday Boy paradox ("I have two children. One is a boy born on a Tuesday. What is the probability I have two boys") for a blog post.
# paradox.py
#
# Python code to illustrate the Tuesday Boy paradox ("I have two children.
# One is a boy born on a Tuesday. What is the probability I have two boys")
# for a blog post.
#
# We're simulating two sampling modes to illustrate how the approach to
# sampling, and posing the initial question, is important. This has general
# implications for what we can reasonably infer from experiments where we
# did not design the experiment to answer a specific question.
@widdowquinn
widdowquinn / kgml_ex3.py
Created February 1, 2013 18:45
Example code to generate three renderings of a modified metabolic map, highlighting a specific set of pathways.
import KGML_parser
from KGML_scrape import retrieve_KEGG_pathway
from KGML_vis import KGMLCanvas
# Get list of pathway elements to enhance
glyc_path = retrieve_KEGG_pathway('ko00010')
tca_path = retrieve_KEGG_pathway('ko00020')
enhance_list = []
for pathway in (glyc_path, tca_path):
for e in pathway.entries.values():
@widdowquinn
widdowquinn / kgml_ex2.py
Created February 1, 2013 18:07
Example code to generate three renderings of a non-metabolic KEGG pathway, with important information in the .png.
import KGML_parser
from KGML_scrape import retrieve_KEGG_pathway
from KGML_vis import KGMLCanvas
from Bio.Graphics.ColorSpiral import ColorSpiral
# Get the ko03070 map from KEGG, and write it out to file, visualised as
# the .png, and as the elements from the KGML file
pathway = retrieve_KEGG_pathway('ko03070')
kgml_map = KGMLCanvas(pathway, show_maps=True)