This graph gist demonstrates use of Jaccard calculation to determine similarity between two sets of nodes
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
Peter investigates the taxonomy of Diplazium tomentosum. | |
//console | |
He starts with one of the types from the Leiden herbarium (http://plants.jstor.org/specimen/l0051073): | |
[source,cypher] | |
---- | |
CREATE (s:Specimen{id:"L0051073" | |
,jstorUrl:'http://plants.jstor.org/specimen/l0051073' |
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
= The taxonomic mind-mapper | |
Nicky Nicolson, Peter Hovenkamp | |
:neo4j-version: 2.1.0 | |
:author: Nicky Nicolson | |
:twitter: nickynicolson | |
== Domain | |
We investigate the use of the scheme in: https://docs.google.com/document/d/1FIxNrrGrIZs0l4QJEdGfctXbYVL4cQhKspmMEHmKAGg/edit with a use case in the taxonomy of Diplazium tomentosum (https://docs.google.com/document/d/1vni44RBwGNZ7iRCFf243NtcD-7xwjHrDeAPehato7KY/edit?usp=sharing) | |
== Data model |
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
// Create meta-graph with orphan counts | |
MATCH (n) | |
/* ugly string replace to convert collection of labels to colon delimited string */ | |
WITH replace(replace(replace(replace(str(labels(n)),'[',''),']',''),'"',''),',',':') AS l, count(distinct n) AS c | |
MERGE (mn:Meta_Node {name:l,count:c}) | |
WITH mn | |
MATCH (a)-[r]->(b) | |
WITH replace(replace(replace(replace(str(labels(a)),'[',''),']',''),'"',''),',',':') AS a_labels | |
, count(distinct a) AS from_count | |
, type(r) AS rel_type |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
import urllib | |
import urllib2 | |
try: | |
# Base url for the TNRS match_names API | |
url = 'http://api.opentreeoflife.org/v2/tnrs/match_names' | |
# Encode data value to be looked up as an array of names: | |
data = '{"names": ["'+value+'"]}' | |
print "Looking up: " + data | |
# Set HTTP headers: |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="text" indent="yes" encoding="UTF-8"/> | |
<xsl:variable name="delimiter" select="'	'"/> | |
<xsl:variable name="newline" select="' '"/> | |
<xsl:template match="/"> | |
<!-- header line --> | |
<xsl:value-of select="concat('primary_accession',$delimiter,'date_created',$delimiter,'date_last_amended', $delimiter, 'definition', $delimiter, 'title', $delimiter, 'reference', $delimiter, 'doi', $delimiter, 'specimen_voucher', $delimiter, 'bio_material', $delimiter, 'organism', $newline)"/> | |
<!-- data --> |
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
from sklearn.metrics import confusion_matrix | |
import pandas as pd | |
def cm2df(cm, labels): | |
df = pd.DataFrame() | |
# rows | |
for i, row_label in enumerate(labels): | |
rowdata={} | |
# columns | |
for j, col_label in enumerate(labels): |
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
import networkx as nx | |
import numpy as np | |
import matplotlib as mpl | |
import matplotlib.pyplot as plt | |
import mplleaflet | |
import sys | |
def main(): | |
inputfile=sys.argv[1] | |
outputfile_base=sys.argv[2] |
OlderNewer