Skip to content

Instantly share code, notes, and snippets.

@rdmpage
rdmpage / gbif.asc
Last active March 31, 2018 05:03
GenBank and GBIF

Cluster multiple occurrence records in GBIF

In this example we have the same sequence GQ247641 in two sequence datasets ("European Molecular Biology Laboratory Australian Mirror" and "Geographically tagged INSDC sequences"), and also the voucher specimen ("AM W.35546.001" or "AMS:W.35546") also occurs in GBIF (provided by "Australian Museum provider for OZCAM"). Linking the two sequence occurrences is trivial, we just link by the accession "GQ247641". Linking the sequence to the museum specimen requires matching the slightly different strings "AM W.35546.001" and "AMS:W.35546".

The graph links three records in GBIf that all refer to the same thing.

@rdmpage
rdmpage / cltools.sh
Created November 10, 2017 16:15 — forked from justinbellamy/cltools.sh
Install Autoconf and Automake on OS X El Capitan
#!/bin/sh
##
# Install autoconf, automake and libtool smoothly on Mac OS X.
# Newer versions of these libraries are available and may work better on OS X
#
# This script is originally from http://jsdelfino.blogspot.com.au/2012/08/autoconf-and-automake-on-mac-os-x.html
#
export build=~/devtools # or wherever you'd like to build
@rdmpage
rdmpage / jsonld.sh
Created April 18, 2017 19:29 — forked from jprante/jsonld.sh
JSON-LD in Elasticsearch
curl -XDELETE 'localhost:9200/jsonld'
curl -XPOST 'localhost:9200/jsonld'
curl -XPUT 'localhost:9200/jsonld/doc/1' -d '
{
"@context":
{
"dc": "http://purl.org/dc/elements/1.1/",
@rdmpage
rdmpage / index.html
Created March 7, 2014 13:28
GBIF data overlayed on Google Maps
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>GBIF and Google Maps</title>
<style type="text/css">
body {
margin: 0;
== Handling multiple identifiers
Many objects of interest will have multiple identifiers, and each identifier may have different, complementary data associated with it.
One approach is to treat each identifier as a node, and link it to node for the corresponding object (essentially the object is treated as a bnode). We therefore refer to an object as "the object identifier by <identifier>". If we have correctly associated multiple identifiers with the same object, then we can link the two objects together.
When we have a link to create to another object, we use MERGE (id)-[]-(object) to ensure that id-object exists, then we link to it. In the example below we have a work with DOI 10.3897/phytokeys.44.7993, which cites PMID 21653447. First we create the work with DOI 10.3897/phytokeys.44.7993.
//hide
//setup
@rdmpage
rdmpage / query.txt
Created May 19, 2016 10:08
Querying Wikipedia for links to BioStor
The Mediawiki API can be used to find qhat wikipedia pages link to BioStor, e.g.:
https://en.wikipedia.org/w/api.php?action=query&list=exturlusage&euquery=biostor.org&eulimit=20
See https://www.mediawiki.org/wiki/API:Lists/All#Exturlusage for details.
@rdmpage
rdmpage / Cricula.nexus
Created May 10, 2016 13:27
Cricula NEXUS
#NEXUS
Begin trees; [Treefile saved Thu Aug 20 21:42:14 2015]
[!
>Data file = /Users/rpage/Sites/geojson-phylogeny-demo/bold-api/service/tmp/SAUPA642-10/SAUPA642-10.nex
>Neighbor-joining search settings:
> Ties (if encountered) will be broken systematically
> Distance measure = uncorrected ("p")
> (Tree is unrooted)
]
@rdmpage
rdmpage / Cricula.geojson
Last active May 10, 2016 13:27
Cricula barcode map
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rdmpage
rdmpage / index.html
Last active April 20, 2016 21:46
Query GBIF by drawing on map
<!DOCTYPE html>
<html>
<head>
<title>GBIF search</title>
<meta charset="utf-8" />
<link
rel="stylesheet"
href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css"
/>
<link
@rdmpage
rdmpage / geojson-conversion.sh
Created January 11, 2016 13:15 — forked from benbalter/geojson-conversion.sh
Bulk convert shapefiles to geojson using ogr2ogr
# Bulk convert shapefiles to geojson using ogr2ogr
# For more information, see http://ben.balter.com/2013/06/26/how-to-convert-shapefiles-to-geojson-for-use-on-github/
# Note: Assumes you're in a folder with one or more zip files containing shape files
# and Outputs as geojson with the crs:84 SRS (for use on GitHub or elsewhere)
#geojson conversion
function shp2geojson() {
ogr2ogr -f GeoJSON -t_srs crs:84 "$1.geojson" "$1.shp"
}