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
| { | |
| "screening": 8, | |
| "date": 1476908234241, | |
| "uid": "UID-16-0003", | |
| "linkage_matrix": [[2, 3, 0.06571365, 2], | |
| [0, 10, 0.07951425, 2], | |
| [5, 6, 0.09405724, 2], | |
| [11, 13, 0.10182075, 3], | |
| [1, 12, 0.12900146, 3], | |
| [14, 15, 0.13498948, 5], |
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
| def parse(tree, p): | |
| path = p[:] | |
| path.append(str(tree.get_id())) | |
| if tree.is_leaf(): | |
| print('.'.join(path)) | |
| else: | |
| #Here I assume get_left() returns some falsey value for no left child | |
| left = tree.get_left() | |
| if left: | |
| parse(left, path) |
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
| linkage_matrix = | |
| [[2, 3, 0.06571365, 2], [0, 10, 0.07951425, 2], [5, 6, 0.09405724, 2], [11, 13, 0.10182075, 3], [1, 12, 0.12900146, 3], [14, 15, 0.13498948, 5], [8, 9, 0.16806049, 2], [7, 16, 0.1887918, 4], [17, 19, 0.2236683, 9], [18, 20, 0.29471335, 11], [4, 21, 0.45878, 12]] | |
| from scipy.cluster import hierarchy | |
| a = hierarchy.to_tree(linkage_matrix) | |
| def parse_tree(tree, path): | |
| path = path | |
| if path ==[]: | |
| path.append(str(tree.get_id())) |
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
| def parse_tree(tree, path): | |
| path = path | |
| if path ==[]: | |
| path.append(str(tree.get_id())) | |
| if tree.is_leaf() is False: | |
| left = tree.get_left() | |
| left_id = str(left.get_id()) | |
| if left.is_leaf() is False: | |
| path.append(left_id) | |
| parse_tree(left, path) |
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
| def parse_tree(tree, path): | |
| path = path | |
| path.append(str(tree.get_id())) | |
| if tree.is_leaf() is False: | |
| right = tree.get_right() | |
| parse_tree(right, path) | |
| left = tree.get_left() | |
| parse_tree(left, path) | |
| else: | |
| print(('.').join(path)) |
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
| CREATE OR REPLACE FUNCTION process_inv_audit() RETURNS TRIGGER AS $inv_audit$ | |
| BEGIN | |
| IF (TG_OP = 'DELETE') THEN | |
| INSERT INTO inventory_audit (id, old_column, op, location, notes, amount, original_amount, units, original_units, lot, batch, date_opened, date_expired, plant_material_id, uid, is_active, received_date, order_date, secondary_location, price, country_code, vendor_code, legacy_id, brand, status) VALUES (nextval('inventory_audit_id_seq'), OLD.id, 'D', OLD.location, OLD.notes, OLD.amount, OLD.original_amount, OLD.units, OLD.original_units, OLD.lot, OLD.batch, OLD.date_opened, OLD.date_expired, OLD.plant_material_id, OLD.uid, OLD.is_active, OLD.received_date, OLD.order_date, OLD.secondary_location, OLD.price, OLD.country_code, OLD.vendor_code, OLD.legacy_id, OLD.brand, OLD.status); | |
| RETURN OLD; | |
| ELSIF (TG_OP = 'UPDATE') THEN | |
| INSERT INTO inventory_audit (id, old_column, op, location , notes, amount, original_amount, units, original_units, lot, batch, da |
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
| from bs4 import BeautifulSoup | |
| import logging | |
| try: | |
| from Queue import Queue # PY2 | |
| except ImportError: | |
| from queue import Queue # PY3 | |
| import requests | |
| from requests.exceptions import RequestException | |
| from six import iteritems | |
| from threading import Thread |
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
| <!DOCTYPE html> | |
| <html> | |
| <meta charset="utf-8"> | |
| <link href="slider.css" rel="stylesheet"> | |
| <!-- Example based on http://bl.ocks.org/mbostock/3887118 --> | |
| <!-- Tooltip example from http://www.d3noob.org/2013/01/adding-tooltips-to-d3js-graph.html --> |
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
| import pandas as pd | |
| from bokeh.plotting import ColumnDataSource, figure, output_file, show | |
| from bokeh.models import HoverTool | |
| output_file("scatter.html") | |
| df = pd.read_csv('/Users/jzollars/07_isolate_selection.csv') | |
| hash = {} | |
| c = ('aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black', | |
| 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', |
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
| import pandas as pd | |
| from bokeh.charts import Scatter, output_file, show | |
| output_file("scatter.html") | |
| df = pd.read_csv('/Users/jzollars/07_isolate_selection.csv') | |
| hash = {} | |
| # List colors: | |
| c = ('aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkgrey', 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray', 'darkslategrey', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dimgrey', 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow', 'grey', 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen |