Skip to content

Instantly share code, notes, and snippets.

View jasonsahl's full-sized avatar

Jason Sahl jasonsahl

  • Northern Arizona University
View GitHub Profile
@jasonsahl
jasonsahl / extract_PI_SNPs.py
Last active June 11, 2019 00:24
count and extract parsimony informative SNPs from a multi-fasta
#!/usr/bin/env python
"""retrieve only parsimony infomative
sites from a nucleotide multiple sequence alignment"""
from optparse import OptionParser
import sys
try:
from Bio import SeqIO
except:
@jasonsahl
jasonsahl / parse_kmer_frequencies.py
Last active March 5, 2020 18:13
Parse Kmer frequencies from a Kmer matrix
#!/usr/bin/env python
"""parse frequencies from a Kmer matrix"""
from __future__ import division
import sys
import os
import optparse
from optparse import OptionParser
from collections import deque
@jasonsahl
jasonsahl / transpose_matrix.py
Created March 29, 2021 16:19
transpose a BSR matrix
#!/usr/bin/env python
import sys
from sys import argv
try:
out_matrix = open("transposed_matrix.matrix", "w")
reduced = []
with open(argv[1]) as my_file:
for line in my_file:
@jasonsahl
jasonsahl / mashPy.py
Last active February 17, 2022 15:57
Create a distance dendrogram from MASH distances
#!/usr/bin/env python
#A python implementation of building clusters from MASH distances
import optparse
import sys
from optparse import OptionParser
try:
from scipy.cluster.hierarchy import weighted
import scipy.spatial.distance as ssd