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 | |
inpdir=$1 | |
if ! test -d "${inpdir}" ; then | |
echo "$0 must be passed in a directory of subproblems (with ott###.tre files)." | |
exit 1 | |
fi | |
rpwd=`realpath .` | |
rpid=`realpath $inpdir` | |
if test "${rpwd}" = "${rpid}" ; then | |
echo "$0 Cannot be run in place." |
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 python3 | |
'''Reverses the order of the first n-1 lines of a file | |
and writes it to stdout. | |
''' | |
import sys | |
fp = sys.argv[1] | |
with open(fp, 'r', encoding='utf-8') as inp: | |
lines = inp.readlines() | |
last = lines.pop(-1) | |
lines.reverse() |
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/env python | |
import json | |
import sys | |
import subprocess | |
import itertools | |
inpjson = 'subproblem_size_summary.json' | |
with open(inpjson, 'r', encoding='utf-8') as inp: | |
summary_blob = json.load(inp) |
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/env python | |
import json | |
import sys | |
import subprocess | |
import itertools | |
DEBUG = False | |
def count_tips_and_inf_splits(fn): | |
out = subprocess.check_output(['otc-degree-distribution', fn], stderr=subprocess.DEVNULL).decode('utf-8') |
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 | |
otc-tree-tool --indented-table labelled_supertree/labelled_supertree_simplified_ottnames.tre > subproblems/indented-table.txt | |
cat subproblems/indented-table.txt | sed -E '/ +mrca/d' | sed -E 's/.* ott([0-9]+) : ([0-9]+)/"ott\1": \2,/' > num_tips_for_ott_internals_in_labelled_tree.json | |
rm subproblems/indented-table.txt |
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 | |
# This needs to be made part of the propinquity process. | |
# MTH ran steps that made up the basis of this before the | |
# Jan 2020 SSB workshop. So the resulting file will be in | |
# the https://files.opentreeoflife.org/synthesis/opentree12.3/opentree12.3/subproblems/ | |
# folder, but (perversely enough) not in the tar archive at https://files.opentreeoflife.org/synthesis/opentree12.3/opentree12.3.tgz | |
# If all goes as planned, we'll start adding this to the tree build process so that it will be in | |
# builds and archives made after 12.3 | |
# This is to be run with the working directory being the propinquity |
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/env python3 | |
import sys | |
import dendropy | |
import re | |
id_extractor = re.compile('.*ott([0-9]+)$') | |
tree_filepath = sys.argv[1] | |
id_filepath = sys.argv[2] | |
tree = dendropy.Tree.get(path=tree_filepath, schema='newick', suppress_internal_node_taxa=False) | |
# Get the list of IDs to retain |
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 | |
fp=$1 | |
fn=$(basename $fp) | |
if ! test -f $fp ; then | |
echo "$fp does not exist" | |
exit 1 | |
fi | |
o=`grep '"^ot:ottId": ' "$fp" | sed 's/".*": //' | sort -g | sed ':a;N;$!ba;s/\n/ /g' | sed -E 's/ +/ /g'` | |
echo "\"${fn}\": frozenset([ ${o} ])," |
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 python3 | |
# -*- coding: <encoding name> -*- | |
from __future__ import print_function | |
from collections import defaultdict | |
from math import log | |
import codecs | |
from ctypes import c_uint64 as c_trie_node_type | |
import sys | |
""" Pseudocode from Maly, 1976 Appendix B |
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/python3 | |
import requests | |
import time | |
from threading import Thread | |
machine='http://localhost:1984' | |
# machine='https://ot39.opentreeoflife.org' | |
# machine='https://api.opentreeoflife.org' |