This file contains hidden or 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 | |
| import dendropy | |
| def get_tree(r): | |
| tree_str = "((C:1.3,D:4.)34:0.034,(A:1.1,(B:1.2,X:1.6)26:0.026)12:0.0126,E:1.5);" | |
| tree = dendropy.Tree.get( | |
| data=tree_str, | |
| schema="newick", | |
| rooting=r, |
This file contains hidden or 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 | |
| echo 'This script installs the tools needed for propinquity as subdirectories' | |
| echo 'of the working directory. This assumes that you have a C++ dev environment (g++, boost, automake, libtool)' | |
| echo 'installed. See README files for propinquity and otcetera if those builds fail' | |
| echo 'Also assumes virtualenv for python' | |
| CONTEXT_DIR="${PWD}" | |
| virtualenv propinquity-env | |
| source propinquity-env/bin/activate |
This file contains hidden or 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 | |
| from collections import defaultdict | |
| import dendropy | |
| import sys | |
| import os | |
| _SCRIPT_NAME = os.path.split(sys.argv[0])[-1] | |
| def error(msg): | |
| sys.stderr.write('{}: Error: {}\n'.format(_SCRIPT_NAME, msg)) | |
| OUT = sys.stdout |
This file contains hidden or 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 | |
| import sys | |
| import os | |
| import json | |
| import codecs | |
| dn = sys.argv[1] | |
| outfn = sys.argv[2] | |
| d = {} | |
| for s in os.listdir(dn): | |
| if s.endswith('.out'): |
This file contains hidden or 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 | |
| import sys | |
| ''' | |
| python gen-curl-oti.py template.txt studies.txt | |
| where studies.txt is the list of studies used in synthesis. | |
| and template is a cURL call with XYZ inplace of the study id (and no other XYZ) | |
| cURL | |
| ''' |
This file contains hidden or 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 | |
| import sys | |
| import re | |
| inp = sys.stdin | |
| outp = sys.stdout | |
| JS_PAT = re.compile(r'^<script src="/opentree/static/(.+)" type="text/javascript"></script>\s+$') | |
| CSS_PAT = re.compile(r'^<link href="/opentree/static/(.+)" rel="stylesheet" type="text/css" />\s+$') |
This file contains hidden or 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 | |
| from dendropy import DnaCharacterMatrix, Tree | |
| import sys | |
| d = DnaCharacterMatrix.get(path=sys.argv[1], | |
| schema='fasta') | |
| # make the taxon_namespace immutable, so the tree does not add | |
| # new labels... | |
| d.taxon_namespace.is_mutable = False | |
| tree = Tree.get(path=sys.argv[2], | |
| schema='newick', |
This file contains hidden or 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 | |
| from StringIO import StringIO | |
| import sys | |
| out = sys.stdout | |
| def get_indented(x, indent): | |
| start_indent = indent | |
| written_something = False | |
| out = StringIO() | |
| for letter in x: |
This file contains hidden or 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
| /* Most of this code is from GBParsy which available from https://code.google.com/p/gbfp/ | |
| T.-H. Lee, Y.-K. Kim and B.H. Nahm (2008) GBParsy: A GenBank flatfile parser library with high speed. BMC Bioinformatics, 9:321. | |
| That code is released under the GPL (see bottom of file). | |
| Mark T. Holder only wrote the slight modification to parsing of the GI and a simpliefied main | |
| function (based on the example seqext.c from gbfpy) |
This file contains hidden or 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 | |
| import codecs | |
| import sys | |
| chars = set() | |
| for filepath in sys.argv[1:]: | |
| with codecs.open(filepath, 'r', encoding='utf-8') as fo: | |
| for line in fo: | |
| chars.update(iter(line)) | |
| c = list(chars) | |
| c.sort() |